summaryrefslogtreecommitdiff
authorWim Taymans <wim.taymans@collabora.co.uk>2009-04-30 12:22:27 (GMT)
committer Wim Taymans <wim.taymans@collabora.co.uk>2009-04-30 12:22:27 (GMT)
commitb5d84439fd63e47f54fcbd281cd9f9aa89e756d0 (patch) (side-by-side diff)
treee45430b83904bceeb7bbfb4b4d3bdc52d6bc1246
parent28afc6e59103f6f7c3d72ba7c74df3f6c883aaf4 (diff)
downloadgst-plugins-good-b5d84439fd63e47f54fcbd281cd9f9aa89e756d0.zip
gst-plugins-good-b5d84439fd63e47f54fcbd281cd9f9aa89e756d0.tar.gz
qtdemux: add support for subtitle pictures
Add support for subtitle pictures. Fixes #568278.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gst/qtdemux/qtdemux.c55
-rw-r--r--gst/qtdemux/qtdemux.h1
-rw-r--r--gst/qtdemux/qtdemux_fourcc.h1
3 files changed, 57 insertions, 0 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index 6440205..d18d4df 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -272,6 +272,12 @@ GST_STATIC_PAD_TEMPLATE ("audio_%02d",
GST_PAD_SOMETIMES,
GST_STATIC_CAPS_ANY);
+static GstStaticPadTemplate gst_qtdemux_subpsrc_template =
+GST_STATIC_PAD_TEMPLATE ("subp_%02d",
+ GST_PAD_SRC,
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS_ANY);
+
static GstElementClass *parent_class = NULL;
static void gst_qtdemux_class_init (GstQTDemuxClass * klass);
@@ -303,6 +309,9 @@ static GstCaps *qtdemux_video_caps (GstQTDemux * qtdemux,
static GstCaps *qtdemux_audio_caps (GstQTDemux * qtdemux,
QtDemuxStream * stream, guint32 fourcc, const guint8 * data, int len,
gchar ** codec_name);
+static GstCaps *qtdemux_subp_caps (GstQTDemux * qtdemux,
+ QtDemuxStream * stream, guint32 fourcc, const guint8 * data,
+ gchar ** codec_name);
GType
gst_qtdemux_get_type (void)
@@ -1333,6 +1342,7 @@ gst_qtdemux_change_state (GstElement * element, GstStateChange transition)
qtdemux->n_streams = 0;
qtdemux->n_video_streams = 0;
qtdemux->n_audio_streams = 0;
+ qtdemux->n_subp_streams = 0;
gst_segment_init (&qtdemux->segment, GST_FORMAT_TIME);
break;
}
@@ -3273,6 +3283,13 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux,
qtdemux->n_audio_streams++;
} else if (stream->subtype == FOURCC_strm) {
GST_DEBUG_OBJECT (qtdemux, "stream type, not creating pad");
+ } else if (stream->subtype == FOURCC_subp) {
+ gchar *name = g_strdup_printf ("subp_%02d", qtdemux->n_subp_streams);
+
+ stream->pad =
+ gst_pad_new_from_static_template (&gst_qtdemux_subpsrc_template, name);
+ g_free (name);
+ qtdemux->n_subp_streams++;
} else {
GST_DEBUG_OBJECT (qtdemux, "unknown stream type");
goto done;
@@ -4268,6 +4285,18 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
goto unknown_stream;
}
stream->sampled = TRUE;
+ } else if (stream->subtype == FOURCC_subp) {
+ guint32 fourcc;
+
+ stream->sampled = TRUE;
+
+ offset = 16;
+ stream->fourcc = fourcc = QT_FOURCC (stsd_data + offset + 4);
+ GST_LOG_OBJECT (qtdemux, "st type: %" GST_FOURCC_FORMAT,
+ GST_FOURCC_ARGS (fourcc));
+
+ stream->caps =
+ qtdemux_subp_caps (qtdemux, stream, fourcc, stsd_data, &codec);
} else {
goto unknown_stream;
}
@@ -5723,3 +5752,29 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
}
return caps;
}
+
+static GstCaps *
+qtdemux_subp_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
+ guint32 fourcc, const guint8 * stsd_data, gchar ** codec_name)
+{
+ GstCaps *caps;
+
+ GST_DEBUG_OBJECT (qtdemux, "resolve fourcc %08x", fourcc);
+
+ switch (fourcc) {
+ case GST_MAKE_FOURCC ('m', 'p', '4', 's'):
+ _codec ("DVD subtitle");
+ caps = gst_caps_new_simple ("video/x-dvd-subpicture", NULL);
+ break;
+ default:
+ {
+ char *s;
+
+ s = g_strdup_printf ("audio/x-gst-fourcc-%" GST_FOURCC_FORMAT,
+ GST_FOURCC_ARGS (fourcc));
+ caps = gst_caps_new_simple (s, NULL);
+ break;
+ }
+ }
+ return caps;
+}
diff --git a/gst/qtdemux/qtdemux.h b/gst/qtdemux/qtdemux.h
index d227b7f..7b7c135 100644
--- a/gst/qtdemux/qtdemux.h
+++ b/gst/qtdemux/qtdemux.h
@@ -62,6 +62,7 @@ struct _GstQTDemux {
gint n_streams;
gint n_video_streams;
gint n_audio_streams;
+ gint n_subp_streams;
guint major_brand;
GNode *moov_node;
diff --git a/gst/qtdemux/qtdemux_fourcc.h b/gst/qtdemux/qtdemux_fourcc.h
index aa9a1f2..adae4fb 100644
--- a/gst/qtdemux/qtdemux_fourcc.h
+++ b/gst/qtdemux/qtdemux_fourcc.h
@@ -62,6 +62,7 @@ G_BEGIN_DECLS
#define FOURCC_stco GST_MAKE_FOURCC('s','t','c','o')
#define FOURCC_vide GST_MAKE_FOURCC('v','i','d','e')
#define FOURCC_soun GST_MAKE_FOURCC('s','o','u','n')
+#define FOURCC_subp GST_MAKE_FOURCC('s','u','b','p')
#define FOURCC_strm GST_MAKE_FOURCC('s','t','r','m')
#define FOURCC_rtsp GST_MAKE_FOURCC('r','t','s','p')
#define FOURCC_co64 GST_MAKE_FOURCC('c','o','6','4')