summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-02-18 17:20:48 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-02-18 17:20:48 +0000
commitd9f6178249e4fc1529c1c9662c6a526dd5cb2ae7 (patch)
treeaed1a2c109660093705246eb3fc4171f6497c789
parent495d5c58a70c0dd11849d154d5f9c51456545675 (diff)
gst/matroska/: Recognise SSA/ASS and USF subtitle formats and set proper caps when they are found.
Original commit message from CVS: * gst/matroska/matroska-demux.c: (gst_matroska_demux_subtitle_caps), (gst_matroska_demux_plugin_init): * gst/matroska/matroska-ids.h: Recognise SSA/ASS and USF subtitle formats and set proper caps when they are found.
-rw-r--r--ChangeLog9
-rw-r--r--gst/matroska/matroska-demux.c28
-rw-r--r--gst/matroska/matroska-ids.h3
3 files changed, 40 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 5b31cfb8b3..60aa63ec4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-02-18 Tim-Philipp Müller <tim at centricular dot net>
+
+ * gst/matroska/matroska-demux.c:
+ (gst_matroska_demux_subtitle_caps),
+ (gst_matroska_demux_plugin_init):
+ * gst/matroska/matroska-ids.h:
+ Recognise SSA/ASS and USF subtitle formats and
+ set proper caps when they are found.
+
2006-02-17 Tim-Philipp Müller <tim at centricular dot net>
* ext/jpeg/gstjpegdec.c: (gst_jpeg_dec_decode_direct),
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c
index b5cfd84dd7..38824507ee 100644
--- a/gst/matroska/matroska-demux.c
+++ b/gst/matroska/matroska-demux.c
@@ -3408,13 +3408,38 @@ gst_matroska_demux_subtitle_caps (GstMatroskaTrackSubtitleContext *
(GstMatroskaTrackContext *) subtitlecontext; */
GstCaps *caps = NULL;
+ /* for backwards compatibility */
+ if (!g_ascii_strcasecmp (codec_id, "S_TEXT/ASCII"))
+ codec_id = GST_MATROSKA_CODEC_ID_SUBTITLE_UTF8;
+ else if (!g_ascii_strcasecmp (codec_id, "S_SSA"))
+ codec_id = GST_MATROSKA_CODEC_ID_SUBTITLE_SSA;
+ else if (!g_ascii_strcasecmp (codec_id, "S_ASS"))
+ codec_id = GST_MATROSKA_CODEC_ID_SUBTITLE_ASS;
+ else if (!g_ascii_strcasecmp (codec_id, "S_USF"))
+ codec_id = GST_MATROSKA_CODEC_ID_SUBTITLE_USF;
+
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_UTF8)) {
caps = gst_caps_new_simple ("text/plain", NULL);
+ } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_SSA)) {
+ caps = gst_caps_new_simple ("application/x-ssa", NULL);
+ } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_ASS)) {
+ caps = gst_caps_new_simple ("application/x-ass", NULL);
+ } else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_USF)) {
+ caps = gst_caps_new_simple ("application/x-usf", NULL);
} else {
GST_DEBUG ("Unknown subtitle stream: codec_id='%s'", codec_id);
caps = gst_caps_new_simple ("application/x-subtitle-unknown", NULL);
}
+ if (data != NULL && size > 0) {
+ GstBuffer *buf;
+
+ buf = gst_buffer_new_and_alloc (size);
+ memcpy (GST_BUFFER_DATA (buf), data, size);
+ gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, buf, NULL);
+ gst_buffer_unref (buf);
+ }
+
return caps;
}
@@ -3501,6 +3526,9 @@ gst_matroska_demux_plugin_init (GstPlugin * plugin)
};
const gchar *subtitle_id[] = {
GST_MATROSKA_CODEC_ID_SUBTITLE_UTF8,
+ GST_MATROSKA_CODEC_ID_SUBTITLE_SSA,
+ GST_MATROSKA_CODEC_ID_SUBTITLE_ASS,
+ GST_MATROSKA_CODEC_ID_SUBTITLE_USF,
/* FILLME */
NULL
};
diff --git a/gst/matroska/matroska-ids.h b/gst/matroska/matroska-ids.h
index 906e489ba9..71dfc63437 100644
--- a/gst/matroska/matroska-ids.h
+++ b/gst/matroska/matroska-ids.h
@@ -168,6 +168,9 @@
/* TODO: AC3-9/10 (?), Musepack, Quicktime */
#define GST_MATROSKA_CODEC_ID_SUBTITLE_UTF8 "S_TEXT/UTF8"
+#define GST_MATROSKA_CODEC_ID_SUBTITLE_SSA "S_TEXT/SSA"
+#define GST_MATROSKA_CODEC_ID_SUBTITLE_ASS "S_TEXT/ASS"
+#define GST_MATROSKA_CODEC_ID_SUBTITLE_USF "S_TEXT/USF"
/*
* Matrodka tags. Strings.