experiments
authorFraxinas <andreas.frisch@multimedia-labs.de>
Wed, 9 Jun 2010 00:29:39 +0000 (02:29 +0200)
committerFraxinas <andreas.frisch@multimedia-labs.de>
Wed, 9 Jun 2010 08:06:28 +0000 (10:06 +0200)
data/skin_default.xml
lib/python/Screens/AudioSelection.py
lib/service/servicemp3.cpp
lib/service/servicemp3.h

index 9f70e0d037cf39072abcfaa945990f62ec303d08..aceafd73278243c1cf0427fde3024b5088d9b40f 100755 (executable)
                <widget name="statuspic" pixmaps="skin_default/buttons/button_green.png,skin_default/buttons/button_green_off.png" position="130,380" zPosition="10" size="15,16" transparent="1" alphatest="on"/>
        </screen>
        <!-- Audio selection -->
-<<<<<<< HEAD
        <screen name="AudioSelection" position="center,center" size="560,330" title="Audio">
                <widget name="config" position="50,10" size="500,110" scrollbarMode="showOnDemand" />
-=======
-       <screen name="AudioSelection" position="center,center" size="520,330" title="Audio">
-               <widget name="config" position="50,10" size="460,110" scrollbarMode="showOnDemand" />
->>>>>>> more experimenting on vobsubs
-               
-               <widget source="key_red" render="Pixmap" pixmap="skin_default/buttons/key_red.png" position="10,10" size="35,25" alphatest="on">
-                       <convert type="ConditionalShowHide" />
-               </widget>
-               <widget source="key_green" render="Pixmap" pixmap="skin_default/buttons/key_green.png" position="10,35" size="35,25" alphatest="on">
-                       <convert type="ConditionalShowHide" />
-               </widget>
-               <widget source="key_yellow" render="Pixmap" pixmap="skin_default/buttons/key_yellow.png" position="10,60" size="35,25" alphatest="on">
-                       <convert type="ConditionalShowHide" />
-               </widget>
-               <widget source="key_blue" render="Pixmap" pixmap="skin_default/buttons/key_blue.png" position="10,85" size="35,25" alphatest="on">
-                       <convert type="ConditionalShowHide" />
-               </widget>
-               
-<<<<<<< HEAD
                
                <widget source="key_red" render="Pixmap" pixmap="skin_default/buttons/key_red.png" position="10,10" size="35,25" alphatest="on">
                        <convert type="ConditionalShowHide" />
                
                <ePixmap pixmap="skin_default/div-h.png" position="10,112" zPosition="10" size="540,2" />
 
-
                <widget source="streams" render="Listbox" scrollbarMode="showOnDemand" position="10,120" size="540,200" zPosition="3" transparent="1" >
-=======
-               <ePixmap pixmap="skin_default/div-h.png" position="10,112" size="500,2" />
-
-               <widget source="streams" render="Listbox" scrollbarMode="showOnDemand" position="10,120" size="500,200" zPosition="3" transparent="1" >
->>>>>>> more experimenting on vobsubs
-                       <convert type="TemplatedMultiContent">
-                               {"templates":
-                                       {"default": (25, [ 
-                                               MultiContentEntryText(pos = (0, 0),   size = (35, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 1), # key,
-<<<<<<< HEAD
                        <convert type="TemplatedMultiContent">
                                {"templates":
                                        {"default": (25, [ 
                                                MultiContentEntryText(pos = (240, 0), size = (200, 25), font = 0, flags = RT_HALIGN_LEFT,  text = 4), # language,
                                                MultiContentEntryText(pos = (450, 4), size = (90, 25),  font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection,
                                        ], True, "showNever"),
-                                       "notselected": (25, [ 
-                                               MultiContentEntryText(pos = (0, 0),   size = (35, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 1), # key,
-                                       ], True, "showNever"),
                                        "notselected": (25, [ 
                                                MultiContentEntryText(pos = (0, 0),   size = (35, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 1), # key,
                                                MultiContentEntryText(pos = (40, 0),  size = (60, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 2), # number,
                                }
                        </convert>
                </widget>
-=======
-                                               MultiContentEntryText(pos = (40, 0),  size = (55, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 2), # number,
-                                               MultiContentEntryText(pos = (100, 0), size = (120, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 3), # description,
-                                               MultiContentEntryText(pos = (230, 0), size = (200, 25), font = 0, flags = RT_HALIGN_LEFT,  text = 4), # language,
-                                               MultiContentEntryText(pos = (440, 4), size = (60, 25),  font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection,
-                                       ], True, "showNever"),
-                                       "notselected": (25, [ 
-                                               MultiContentEntryText(pos = (0, 0),   size = (35, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 1), # key,
-                                               MultiContentEntryText(pos = (40, 0),  size = (55, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 2), # number,
-                                               MultiContentEntryText(pos = (100, 0), size = (120, 25),  font = 0, flags = RT_HALIGN_LEFT,  text = 3), # description,
-                                               MultiContentEntryText(pos = (230, 0), size = (200, 25), font = 0, flags = RT_HALIGN_LEFT,  text = 4), # language,
-                                               MultiContentEntryText(pos = (440, 4), size = (60, 25),  font = 1, flags = RT_HALIGN_RIGHT, text = 5), # selection,
->>>>>>> more experimenting on vobsubs
-                                       ], False, "showNever")
-                                       },
-                               "fonts": [gFont("Regular", 20), gFont("Regular", 16)],
-                               "itemHeight": 25
-                               }
-                       </convert>
-               </widget>
        </screen>
        <!-- Bouquet selector -->
        <screen name="BouquetSelector" position="center,center" size="300,240" title="Choose bouquet">
@@ -670,7 +616,19 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y()))
                <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
                <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
                <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
-               <widget name="list" position="5,50" size="550,280" scrollbarMode="showOnDemand" zPosition="10"/>
+               <widget source="list" render="Listbox" position="5,50" size="550,280" zPosition="10" scrollbarMode="showOnDemand">
+                       <convert type="TemplatedMultiContent"> <!--  iface, name, description, interfacepng, defaultpng, activepng, divpng  -->
+                               {"template": [
+                                               MultiContentEntryText(pos = (85, 6), size = (440, 28), font=0, flags = RT_HALIGN_LEFT|RT_VALIGN_TOP, text = 1), # index 1 is the interfacename
+                                               MultiContentEntryText(pos = (85, 43), size = (440, 20), font=1, flags = RT_HALIGN_LEFT|RT_VALIGN_BOTTOM, text = 2), # index 2 is the description
+                                               MultiContentEntryPixmapAlphaTest(pos = (2, 8), size = (54, 54), png = 3), # index 3 is the interface pixmap
+                                               MultiContentEntryPixmapAlphaTest(pos = (63, 46), size = (15, 16), png = 4), # index 4 is the default pixmap
+                                       ],
+                               "fonts": [gFont("Regular", 28),gFont("Regular", 20)],
+                               "itemHeight": 70
+                               }
+                       </convert>
+               </widget>
                <ePixmap pixmap="skin_default/div-h.png" position="0,340" zPosition="1" size="560,2" />
                <widget source="introduction" render="Label" position="0,350" size="560,50" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
        </screen>
index 0245cffbb084fcda26a78c7d500eff30f0ec5e89..2d35cff6f188b1cb404731671fc2060c8de30600 100644 (file)
@@ -50,25 +50,33 @@ class AudioSelection(Screen, ConfigListScreen):
 
                self.settings = ConfigSubsection()
                choicelist = [(PAGE_AUDIO,_("audio tracks")), (PAGE_SUBTITLES,_("Subtitles"))]
+               print "debug 1: choicelist", page
                self.settings.menupage = ConfigSelection(choices = choicelist, default=page)
                self.settings.menupage.addNotifier(self.fillList)
+               print "debug 2"
                self.onLayoutFinish.append(self.__layoutFinished)
+               print "debug 3"
 
        def __layoutFinished(self):
+               print "[__layoutFinished]"
                self["config"].instance.setSelectionEnable(False)
+               print "after instance.setSelectionEnable"
                self.focus = FOCUS_STREAMS
+               print "debug 4"
 
        def fillList(self, arg=None):
+               print "debug fillList"
                streams = []
                conflist = []
                selectedidx = 0
                
-               service = self.session.nav.getCurrentService()
-               self.audioTracks = audio = service and service.audioTracks()
-               n = audio and audio.getNumberOfTracks() or 0
+               print "debug fillList 2"
                
                if self.settings.menupage.getValue() == PAGE_AUDIO:
                        self.setTitle(_("Select audio track"))
+                       service = self.session.nav.getCurrentService()
+                       self.audioTracks = audio = service and service.audioTracks()
+                       n = audio and audio.getNumberOfTracks() or 0
                        if SystemInfo["CanDownmixAC3"]:
                                self.settings.downmix = ConfigOnOff(default=config.av.downmix_ac3.value)
                                self.settings.downmix.addNotifier(self.changeAC3Downmix, initial_call = False)
@@ -110,13 +118,12 @@ class AudioSelection(Screen, ConfigListScreen):
                                        streams.append((x, "", number, description, language, selected))
 
                        else:
-                               conflist.append(getConfigListEntry("", self.settings.dummy))
-                               self["key_green"].setBoolean(False)
                                streams = []
                                conflist.append(('',))
                                self["key_green"].setBoolean(False)
 
                elif self.settings.menupage.getValue() == PAGE_SUBTITLES:
+                       print "debug PAGE_SUBTITLES"
                        self.setTitle(_("Subtitle selection"))
                        conflist.append(('',))
                        conflist.append(('',))
@@ -131,6 +138,7 @@ class AudioSelection(Screen, ConfigListScreen):
                        idx = 0
                        
                        subtitlelist = self.getSubtitleList()
+                       print ">>>>>>>>subtitlelist", subtitlelist
 
                        if len(subtitlelist):
                                for x in subtitlelist:
@@ -162,6 +170,7 @@ class AudioSelection(Screen, ConfigListScreen):
                                                description = types[x[2]]
 
                                        streams.append((x, "", number, description, language, selected))
+                                       print "appending", x, "", number, description, language, selected
                                        idx += 1
                        
                        else:
@@ -312,4 +321,5 @@ class AudioSelection(Screen, ConfigListScreen):
 
 class SubtitleSelection(AudioSelection):
        def __init__(self, session, infobar=None):
-               AudioSelection.__init__(self, session, infobar, PAGE_SUBTITLES)
+               AudioSelection.__init__(self, session, infobar, page=PAGE_SUBTITLES)
+               self.skinName = ["AudioSelection"]
index 58d89281dedf2b806d6a7162f2bf62e10d4a053c..f29d0c520e1c10dea251a55ded69485b4a6c59b3 100644 (file)
@@ -326,48 +326,40 @@ eServiceMP3::eServiceMP3(eServiceReference ref)
        g_free(uri);
 
        m_gst_subtitlebin = gst_bin_new("subtitle_bin");
-       
+
        GstElement *appsink = gst_element_factory_make("appsink", "subtitle_sink");
+       GstElement *fakesink = gst_element_factory_make("fakesink", "subtitle_fakesink");
 
        if (!appsink)
                eDebug("eServiceMP3::sorry, can't play: missing gst-plugin-appsink");
 // <<<<<<< HEAD
 //     else
 //     {
-//             m_subs_to_pull_handler_id = g_signal_connect (subsink, "new-buffer", G_CALLBACK (gstCBsubtitleAvail), this);
-//             g_object_set (G_OBJECT (subsink), "caps", gst_caps_from_string("text/plain; text/x-plain; text/x-pango-markup"), NULL);
-//             g_object_set (G_OBJECT (m_gst_playbin), "text-sink", subsink, NULL);
+//             m_subs_to_pull_handler_id = g_signal_connect (appsink, "new-buffer", G_CALLBACK (gstCBsubtitleAvail), this);
+//             g_object_set (G_OBJECT (appsink), "caps", gst_caps_from_string("text/plain; text/x-pango-markup"), NULL);
+//             g_object_set (G_OBJECT (m_gst_playbin), "text-sink", appsink, NULL);    
 //     }
 // =======
 
-//     GstElement *dvdsubdec = gst_element_factory_make("dvdsubdec", "vobsubtitle_decoder");
-//     if ( !dvdsubdec )
-//             eDebug("eServiceMP3::sorry, can't play: missing gst-plugin-dvdsub");
-// 
-//     gst_bin_add_many(GST_BIN(m_gst_subtitlebin), dvdsubdec, appsink, NULL);
-//     GstPad *ghostpad = gst_ghost_pad_new("sink", gst_element_get_static_pad (appsink, "sink"));
+       GstElement *dvdsubdec = gst_element_factory_make("dvdsubdec", "vobsubtitle_decoder");
+       if ( !dvdsubdec )
+               eDebug("eServiceMP3::sorry, can't play: missing gst-plugin-dvdsub");
+
+       gst_bin_add_many(GST_BIN(m_gst_subtitlebin), dvdsubdec, appsink, fakesink, NULL);
+       GstPad *ghostpad = gst_ghost_pad_new("sink", gst_element_get_static_pad (fakesink, "sink"));
 // //  GstPad *ghostpad = gst_ghost_pad_new("sink", gst_element_get_static_pad (dvdsubdec, "sink"));
-//     gst_element_add_pad (m_gst_subtitlebin, ghostpad);
-//     eDebug("eServiceMP3::construct dvdsubdec=%p, appsink=%p, ghostpad=%p,", dvdsubdec, appsink, ghostpad);
-// 
-//     g_signal_connect (ghostpad, "notify::caps", G_CALLBACK (gstCBsubtitleCAPS), this);
-// 
-//     GstCaps* caps = gst_caps_from_string("text/plain; text/x-pango-markup; video/x-raw-rgb");
-//     g_object_set (G_OBJECT (appsink), "caps", caps, NULL);
-//     g_object_set (G_OBJECT (dvdsubdec), "singlebuffer", TRUE, NULL);
-//     gst_caps_unref(caps);
-// 
-//     int ret = gst_element_link(dvdsubdec, appsink);
-//     eDebug("eServiceMP3::linking elements dvdsubdec and subsink appsink %i", ret);
-       
-//     g_object_set (G_OBJECT (m_gst_playbin), "text-sink", m_gst_subtitlebin, NULL);
+       gst_element_add_pad (m_gst_subtitlebin, ghostpad);
+       eDebug("eServiceMP3::construct dvdsubdec=%p, appsink=%p, fakesink=%p, ghostpad=%p,", dvdsubdec, appsink, fakesink, ghostpad);
+
+       g_signal_connect (ghostpad, "notify::caps", G_CALLBACK (gstCBsubtitleCAPS), this);
 
-       GstCaps* caps = gst_caps_from_string("text/plain; text/x-pango-markup");
+       GstCaps* caps = gst_caps_from_string("text/plain; text/x-pango-markup; video/x-raw-rgb");
        g_object_set (G_OBJECT (appsink), "caps", caps, NULL);
-       
-       g_object_set (G_OBJECT (m_gst_playbin), "text-sink", appsink, NULL);
+       g_object_set (G_OBJECT (dvdsubdec), "singlebuffer", TRUE, NULL);
+       gst_caps_unref(caps);
+
+       g_object_set (G_OBJECT (m_gst_playbin), "text-sink", m_gst_subtitlebin, NULL);
        m_subs_to_pull_handler_id = g_signal_connect (appsink, "new-buffer", G_CALLBACK (gstCBsubtitleAvail), this);
-// >>>>>>> fix empty streams list crash, correctly show/hide color key buttons, re-implement plugin-hook for blue key, fix possible exit crash
 
        if ( m_gst_playbin )
        {
@@ -404,6 +396,7 @@ eServiceMP3::~eServiceMP3()
 {
        // disconnect subtitle callback
        GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_subtitlebin), "subtitle_sink");
+//     GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin), "subtitle_sink");
 
        if (appsink)
        {
@@ -686,6 +679,7 @@ RESULT eServiceMP3::getPlayPosition(pts_t &pts)
 
        /* pos is in nanoseconds. we have 90 000 pts per second. */
        pts = pos / 11111;
+       eDebug("gst_element_query_position %lld pts (%lld ms)", pts, pos/1000000);
        return 0;
 }
 
@@ -1145,19 +1139,25 @@ subtype_t getSubtitleType(GstPad* pad, gchar *g_codec=NULL)
                        type = stSSA;
                else if ( !strcmp(g_type, "text/plain") )
                        type = stPlainText;
+               else
+                       eDebug("getSubtitleType::unsupported subtitle caps %s (%s)", g_type, g_codec);
        }
        else if ( g_codec )
        {
                eDebug("getSubtitleType::subtitle probe codec tag=%s", g_codec);
                if ( !strcmp(g_codec, "VOB") )
                        type = stVOB;
-               else if ( !strcmp(g_codec, "SubStation Alpha") )
+               else if ( !strcmp(g_codec, "SubStation Alpha") || !strcmp(g_codec, "SSA") )
                        type = stSSA;
                else if ( !strcmp(g_codec, "ASS") )
                        type = stASS;
                else if ( !strcmp(g_codec, "UTF-8 plain text") )
                        type = stPlainText;
+               else
+                       eDebug("getSubtitleType::unsupported subtitle codec %s", g_codec);
        }
+       else
+               eDebug("getSubtitleType::unidentifiable subtitle stream!");
 
        return type;
 }
@@ -1208,8 +1208,8 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
                                }       break;
                                case GST_STATE_CHANGE_READY_TO_PAUSED:
                                {
-//                                     GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_subtitlebin), "subtitle_sink");
-                                       GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin), "subtitle_sink");
+                                       GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_subtitlebin), "subtitle_sink");
+//                                     GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin), "subtitle_sink");
                                        if (appsink)
                                        {
                                                g_object_set (G_OBJECT (appsink), "max-buffers", 2, NULL);
@@ -1357,6 +1357,7 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
                                gchar *g_codec = NULL, *g_lang = NULL;
                                g_signal_emit_by_name (m_gst_playbin, "get-text-tags", i, &tags);
                                subtitleStream subs;
+                               int ret;
 
                                g_lang = g_strdup_printf ("und");
                                if ( tags && gst_is_tag_list(tags) )
@@ -1367,7 +1368,7 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
                                }
 
                                subs.language_code = std::string(g_lang);
-                               eDebug("eServiceMP3::subtitle stream=%i language=%s", i, g_lang);
+                               eDebug("eServiceMP3::subtitle stream=%i language=%s codec=%s", i, g_lang, g_codec);
                                
                                GstPad* pad = 0;
                                g_signal_emit_by_name (m_gst_playbin, "get-text-pad", i, &pad);
@@ -1560,22 +1561,34 @@ void eServiceMP3::gstCBsubtitleLink(subtype_t type, gpointer user_data)
                GstElement *dvdsubdec = gst_bin_get_by_name(GST_BIN(_this->m_gst_subtitlebin), "vobsubtitle_decoder");
                GstPad *subdecsinkpad = gst_element_get_static_pad (dvdsubdec, "sink");
                int ret = gst_ghost_pad_set_target((GstGhostPad*)ghostpad, subdecsinkpad);
+               GstElement *appsink = gst_bin_get_by_name(GST_BIN(_this->m_gst_subtitlebin), "subtitle_sink");
+               ret += gst_element_link(dvdsubdec, appsink);
                eDebug("gstCBsubtitleLink:: dvdsubdec=%p, subdecsinkpad=%p, ghostpad=%p, link=%i", dvdsubdec, subdecsinkpad, ghostpad, ret);
        }
-       else
+       else if ( type < stVOB && type > stUnknown )
        {
                GstPad *ghostpad = gst_element_get_static_pad(_this->m_gst_subtitlebin, "sink");
                GstElement *appsink = gst_bin_get_by_name(GST_BIN(_this->m_gst_subtitlebin), "subtitle_sink");
                GstPad *appsinkpad = gst_element_get_static_pad (appsink, "sink");
+               GstElement *dvdsubdec = gst_bin_get_by_name(GST_BIN(_this->m_gst_subtitlebin), "vobsubtitle_decoder");
+               gst_element_unlink(dvdsubdec, appsink);
                int ret = gst_ghost_pad_set_target((GstGhostPad*)ghostpad, appsinkpad);
                eDebug("gstCBsubtitleLink:: appsink=%p, appsinkpad=%p, ghostpad=%p, link=%i", appsink, appsinkpad, ghostpad, ret);
        }
+       else
+       {
+               GstPad *ghostpad = gst_element_get_static_pad(_this->m_gst_subtitlebin, "sink");
+               GstElement *fakesink = gst_bin_get_by_name(GST_BIN(_this->m_gst_subtitlebin), "subtitle_fakesink");
+               GstPad *fakesinkpad = gst_element_get_static_pad (fakesink, "sink");
+               int ret = gst_ghost_pad_set_target((GstGhostPad*)ghostpad, fakesinkpad);
+               eDebug("gstCBsubtitleLink:: unsupported subtitles ... throwing them into fakesink");
+       }
 }
 
 void eServiceMP3::pullSubtitle()
 {
-//     GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_subtitlebin), "subtitle_sink");
-       GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin), "subtitle_sink");
+       GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_subtitlebin), "subtitle_sink");
+//     GstElement *appsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin), "subtitle_sink");
 
        if (appsink)
        {
@@ -1754,7 +1767,7 @@ eDebug ("eServiceMP3::enableSubtitles g_object_set");
 eDebug ("eServiceMP3::enableSubtitles cleared");
 //     }
 
-//     gstCBsubtitleLink(m_subtitleStreams[m_currentSubtitleStream].type, this);
+       gstCBsubtitleLink(m_subtitleStreams[m_currentSubtitleStream].type, this);
 
        m_subtitle_widget = 0;
        m_subtitle_widget = new eSubtitleWidget(parent);
index 7aa6cdd776d1dd3cb22b95aee9c165aed7985be7..c31090e7856dfe1876d42855f6277cfddabe4b03 100644 (file)
@@ -215,7 +215,6 @@ private:
        static void gstCBsubtitleAvail(GstElement *element, gpointer user_data);
        static void gstCBsubtitleCAPS(GObject *obj, GParamSpec *pspec, gpointer user_data);
        static void gstCBsubtitleLink(subtype_t type, gpointer user_data);
-       GstPad* gstCreateSubtitleSink(eServiceMP3* _this, subtype_t type);
        void gstPoll(const int&);
 
        std::list<SubtitlePage> m_subtitle_pages;