From cc366765588bfabc84a52b0bc3e3511078191b84 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Wed, 9 Jun 2010 02:29:39 +0200 Subject: [PATCH] experiments --- data/skin_default.xml | 68 +++++----------------- lib/python/Screens/AudioSelection.py | 22 +++++-- lib/service/servicemp3.cpp | 85 ++++++++++++++++------------ lib/service/servicemp3.h | 1 - 4 files changed, 78 insertions(+), 98 deletions(-) diff --git a/data/skin_default.xml b/data/skin_default.xml index 9f70e0d0..aceafd73 100755 --- a/data/skin_default.xml +++ b/data/skin_default.xml @@ -62,28 +62,8 @@ -<<<<<<< HEAD -======= - - ->>>>>>> more experimenting on vobsubs - - - - - - - - - - - - - - -<<<<<<< HEAD @@ -100,18 +80,7 @@ - -======= - - - ->>>>>>> more experimenting on vobsubs - - {"templates": - {"default": (25, [ - MultiContentEntryText(pos = (0, 0), size = (35, 25), font = 0, flags = RT_HALIGN_LEFT, text = 1), # key, -<<<<<<< HEAD {"templates": {"default": (25, [ @@ -121,9 +90,6 @@ 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, @@ -137,26 +103,6 @@ } -======= - 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 - } - - @@ -670,7 +616,19 @@ self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y())) - + + + {"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 + } + + diff --git a/lib/python/Screens/AudioSelection.py b/lib/python/Screens/AudioSelection.py index 0245cffb..2d35cff6 100644 --- a/lib/python/Screens/AudioSelection.py +++ b/lib/python/Screens/AudioSelection.py @@ -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"] diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 58d89281..f29d0c52 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -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); diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index 7aa6cdd7..c31090e7 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -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 m_subtitle_pages; -- 2.30.2