[gst-cvs] gst-plugins-bad: mpegtsdemux: Add mapping for DVD and Bluray subpicture streams.

Jan Schmidt thaytan at kemper.freedesktop.org
Tue May 26 08:47:00 PDT 2009


Module: gst-plugins-bad
Branch: master
Commit: 471640e3f34bcce673966a587ac726ad660b2bb2
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=471640e3f34bcce673966a587ac726ad660b2bb2

Author: Jan Schmidt <thaytan at noraisin.net>
Date:   Wed May 20 08:50:37 2009 +0100

mpegtsdemux: Add mapping for DVD and Bluray subpicture streams.

Add output subpicture pads for DVD (video/x-dvd-subpicture) and Bluray PGS
(subpicture/x-pgs) streams. Remove an unused variable from
the PES filter.

---

 gst/mpegdemux/gstmpegdefs.h    |    2 ++
 gst/mpegdemux/gstmpegtsdemux.c |   28 +++++++++++++++++++++++++---
 gst/mpegdemux/gstmpegtsdemux.h |    1 +
 gst/mpegdemux/gstpesfilter.h   |    2 --
 4 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/gst/mpegdemux/gstmpegdefs.h b/gst/mpegdemux/gstmpegdefs.h
index d63667d..7ad1e25 100644
--- a/gst/mpegdemux/gstmpegdefs.h
+++ b/gst/mpegdemux/gstmpegdefs.h
@@ -173,6 +173,8 @@
 #define ST_HDV_PRIVATE_A0		0xa0
 #define ST_HDV_PRIVATE_A1		0xa1
 #define ST_PS_DVD_SUBPICTURE            0xff
+/* Blu-ray PGS subpictures */
+#define ST_BD_PGS_SUBPICTURE            0x90
 
 /* Un-official time-code stream */
 #define ST_PS_TIMECODE                  0xd2
diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c
index cd64a29..ef0de2c 100644
--- a/gst/mpegdemux/gstmpegtsdemux.c
+++ b/gst/mpegdemux/gstmpegtsdemux.c
@@ -157,6 +157,10 @@ enum
     "audio/x-dts" \
   )
 
+/* Can also use the subpicture pads for text subtitles? */
+#define SUBPICTURE_CAPS \
+    GST_STATIC_CAPS ("subpicture/x-pgs; video/x-dvd-subpicture")
+
 static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
@@ -175,6 +179,12 @@ GST_STATIC_PAD_TEMPLATE ("audio_%04x",
     GST_PAD_SOMETIMES,
     AUDIO_CAPS);
 
+static GstStaticPadTemplate subpicture_template =
+GST_STATIC_PAD_TEMPLATE ("subpicture_%04x",
+    GST_PAD_SRC,
+    GST_PAD_SOMETIMES,
+    SUBPICTURE_CAPS);
+
 static GstStaticPadTemplate private_template =
 GST_STATIC_PAD_TEMPLATE ("private_%04x",
     GST_PAD_SRC,
@@ -250,10 +260,14 @@ gst_mpegts_demux_base_init (GstMpegTSDemuxClass * klass)
   klass->sink_template = gst_static_pad_template_get (&sink_template);
   klass->video_template = gst_static_pad_template_get (&video_template);
   klass->audio_template = gst_static_pad_template_get (&audio_template);
+  klass->subpicture_template =
+      gst_static_pad_template_get (&subpicture_template);
   klass->private_template = gst_static_pad_template_get (&private_template);
 
   gst_element_class_add_pad_template (element_class, klass->video_template);
   gst_element_class_add_pad_template (element_class, klass->audio_template);
+  gst_element_class_add_pad_template (element_class,
+      klass->subpicture_template);
   gst_element_class_add_pad_template (element_class, klass->private_template);
   gst_element_class_add_pad_template (element_class, klass->sink_template);
 
@@ -675,6 +689,14 @@ gst_mpegts_demux_fill_stream (GstMpegTSStream * stream, guint8 id,
       caps = gst_caps_new_simple ("audio/x-lpcm", NULL);
       break;
     case ST_PS_DVD_SUBPICTURE:
+      template = klass->subpicture_template;
+      name = g_strdup_printf ("subpicture_%04x", stream->PID);
+      caps = gst_caps_new_simple ("video/x-dvd-subpicture", NULL);
+      break;
+    case ST_BD_PGS_SUBPICTURE:
+      template = klass->subpicture_template;
+      name = g_strdup_printf ("subpicture_%04x", stream->PID);
+      caps = gst_caps_new_simple ("subpicture/x-pgs", NULL);
       break;
     default:
       break;
@@ -992,8 +1014,8 @@ gst_mpegts_demux_data_cb (GstPESFilter * filter, gboolean first,
       goto unknown_type;
 
     GST_DEBUG_OBJECT (demux,
-        "New stream 0x%04x of type %d with caps %" GST_PTR_FORMAT, stream->PID,
-        stream->stream_type, GST_PAD_CAPS (stream->pad));
+        "New stream 0x%04x of type 0x%02x with caps %" GST_PTR_FORMAT,
+        stream->PID, stream->stream_type, GST_PAD_CAPS (stream->pad));
 
     srcpad = stream->pad;
 
@@ -1017,7 +1039,7 @@ gst_mpegts_demux_data_cb (GstPESFilter * filter, gboolean first,
 unknown_type:
   {
     GST_DEBUG_OBJECT (demux, "got unknown stream id 0x%02x, type 0x%02x",
-        filter->id, filter->type);
+        filter->id, stream->stream_type);
     gst_buffer_unref (buffer);
     return gst_mpegts_demux_combine_flows (demux, stream, GST_FLOW_NOT_LINKED);
   }
diff --git a/gst/mpegdemux/gstmpegtsdemux.h b/gst/mpegdemux/gstmpegtsdemux.h
index dad2b02..fde6892 100644
--- a/gst/mpegdemux/gstmpegtsdemux.h
+++ b/gst/mpegdemux/gstmpegtsdemux.h
@@ -228,6 +228,7 @@ struct _GstMpegTSDemuxClass {
   GstPadTemplate    * sink_template;
   GstPadTemplate    * video_template;
   GstPadTemplate    * audio_template;
+  GstPadTemplate    * subpicture_template;
   GstPadTemplate    * private_template;
 };
 
diff --git a/gst/mpegdemux/gstpesfilter.h b/gst/mpegdemux/gstpesfilter.h
index b35d874..ccc8461 100644
--- a/gst/mpegdemux/gstpesfilter.h
+++ b/gst/mpegdemux/gstpesfilter.h
@@ -84,8 +84,6 @@ struct _GstPESFilter {
   gboolean           unbounded_packet;
   guint16            length;
 
-  guint8             type;
-
   gint64             pts;
   gint64             dts;
 };





More information about the Gstreamer-commits mailing list