From c443b776e07c18301f9c7d05b80741e6a6aea681 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Tue, 6 Jul 2010 12:47:53 +0200 Subject: [PATCH] fix playback of containers with PGS subpicture streams (by ignoring them) --- lib/service/servicemp3.cpp | 18 +++++++++++++----- lib/service/servicemp3.h | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 1aa3b5b5..5cccbaea 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -21,7 +21,9 @@ #include #include -static GstStaticPadTemplate subsinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS("text/plain; text/x-pango-markup; video/x-dvd-subpicture")); +static GstStaticPadTemplate subsinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS("text/plain; text/x-pango-markup; video/x-dvd-subpicture; subpicture/x-pgs")); +// int ret = gst_pad_set_caps (ghostpad, caps2); +// gst_caps_unref(caps2);)); // eServiceFactoryMP3 @@ -350,7 +352,7 @@ eServiceMP3::eServiceMP3(eServiceReference ref) GstPad *ghostpad = gst_ghost_pad_new_no_target_from_template("sink", templ); gst_element_add_pad (m_gst_subtitlebin, ghostpad); - GstCaps* caps = gst_caps_from_string("text/plain; text/x-pango-markup; video/x-raw-rgb"); + GstCaps* caps = gst_caps_from_string("text/plain; text/x-pango-markup; video/x-raw-rgb; subpicture/x-pgs"); g_object_set (G_OBJECT (appsink), "caps", caps, NULL); gst_caps_unref(caps); @@ -1160,6 +1162,8 @@ subtype_t getSubtitleType(GstPad* pad, gchar *g_codec=NULL) type = stSSA; else if ( !strcmp(g_type, "text/plain") ) type = stPlainText; + else if ( !strcmp(g_type, "subpicture/x-pgs") ) + type = stPGS; else eDebug("getSubtitleType::unsupported subtitle caps %s (%s)", g_type, g_codec); } @@ -1537,7 +1541,7 @@ void eServiceMP3::gstCBsubtitleAvail(GstElement *appsink, gpointer user_data) gboolean eServiceMP3::gstGhostpadSinkEvent(GstPad * pad, GstEvent * event) { - eDebug("eServiceMP3::gstGhostpadSinkEvent %s", gst_structure_get_name (event->structure)); +// eDebug("eServiceMP3::gstGhostpadSinkEvent %s", gst_structure_get_name (event->structure)); // eServiceMP3 *_this = (eServiceMP3*) (gst_pad_get_parent (pad)); eServiceMP3 *_this = g_object_get_data (G_OBJECT (pad), "application-instance"); @@ -1603,7 +1607,7 @@ gboolean eServiceMP3::gstGhostpadSinkEvent(GstPad * pad, GstEvent * event) } ret = _this->m_ghost_pad_subtitle_sink_event (pad, gst_event_ref (event)); -eDebug("original EVENTFUNC returned %i", ret); +// eDebug("original EVENTFUNC returned %i", ret); if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) { gboolean update; @@ -1886,7 +1890,7 @@ void eServiceMP3::pullSubtitle() m_subtitle_pages.push_back(subtitlepage); pushSubtitles(); } - else + else if ( m_subtitleStreams[m_currentSubtitleStream].type == stVOB ) { eDebug("got new subpicture @ buf_pos = %lld ns (in pts=%lld), duration=%lld ns, len=%i bytes. ", buf_pos, buf_pos/11111, duration_ns, len); eVobSubtitlePage* page = new eVobSubtitlePage; @@ -1903,6 +1907,10 @@ void eServiceMP3::pullSubtitle() m_subtitle_pages.push_back(subtitlepage); pushSubtitles(); } + else + { + eDebug("unsupported subpicture... ignoring"); + } } gst_buffer_unref(buffer); } diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index 7a5b152e..4057f022 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -47,7 +47,7 @@ public: typedef struct _GstElement GstElement; typedef enum { atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC } audiotype_t; -typedef enum { stUnknown, stPlainText, stSSA, stASS, stSRT, stVOB } subtype_t; +typedef enum { stUnknown, stPlainText, stSSA, stASS, stSRT, stVOB, stPGS } subtype_t; typedef enum { ctNone, ctMPEGTS, ctMPEGPS, ctMKV, ctAVI, ctMP4, ctVCD, ctCDA } containertype_t; struct SubtitlePage -- 2.30.2