From 7c2e7b1a4f819f57bd57623c768e0f3e7fca07bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 2 Sep 2012 02:41:34 +0100 Subject: [PATCH] text/plain + text/x-pango-markup -> text/x-raw --- ext/ogg/gstoggstream.c | 3 ++- ext/ogg/gstogmparse.c | 6 ++++-- ext/pango/gstbasetextoverlay.c | 5 +++-- ext/pango/gsttextoverlay.c | 6 +++--- ext/pango/gsttextrender.c | 4 ++-- gst-libs/gst/pbutils/gstdiscoverer.c | 6 +++--- gst/encoding/gstencodebin.c | 5 ++--- gst/playback/gstrawcaps.h | 3 +-- gst/subparse/gstssaparse.c | 6 ++++-- gst/subparse/gstsubparse.c | 29 ++++++++++++++++++---------- tests/check/elements/subparse.c | 28 ++++++++++++++------------- tests/check/elements/textoverlay.c | 8 +++++--- tests/icles/playbin-text.c | 2 +- 13 files changed, 64 insertions(+), 47 deletions(-) diff --git a/ext/ogg/gstoggstream.c b/ext/ogg/gstoggstream.c index 1c5484a9e5..297155d656 100644 --- a/ext/ogg/gstoggstream.c +++ b/ext/ogg/gstoggstream.c @@ -1575,7 +1575,8 @@ setup_ogmtext_mapper (GstOggStream * pad, ogg_packet * packet) if (pad->granulerate_d <= 0) return FALSE; - pad->caps = gst_caps_new_empty_simple ("text/plain"); + pad->caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING, + "utf8", NULL); pad->n_header_packets = 1; pad->is_ogm = TRUE; diff --git a/ext/ogg/gstogmparse.c b/ext/ogg/gstogmparse.c index b8bd212671..565fdfe430 100644 --- a/ext/ogg/gstogmparse.c +++ b/ext/ogg/gstogmparse.c @@ -312,7 +312,8 @@ static void gst_ogm_text_parse_base_init (GstOgmParseClass * klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - GstCaps *caps = gst_caps_new_simple ("text/plain", NULL, NULL); + GstCaps *caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING, + "utf8", NULL); gst_element_class_set_static_metadata (element_class, "OGM text stream parser", "Codec/Decoder/Subtitle", @@ -604,7 +605,8 @@ gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size) GST_LOG_OBJECT (ogm, "Type: %s, s/u: %" G_GINT64_FORMAT ", timeunit=%" G_GINT64_FORMAT, ogm->hdr.streamtype, ogm->hdr.samples_per_unit, ogm->hdr.time_unit); - caps = gst_caps_new_empty_simple ("text/plain"); + caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING, + "utf8", NULL); break; } default: diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c index 6df566ca03..21d658cd7c 100644 --- a/ext/pango/gstbasetextoverlay.c +++ b/ext/pango/gstbasetextoverlay.c @@ -744,10 +744,11 @@ static gboolean gst_base_text_overlay_setcaps_txt (GstBaseTextOverlay * overlay, GstCaps * caps) { GstStructure *structure; + const gchar *format; structure = gst_caps_get_structure (caps, 0); - overlay->have_pango_markup = - gst_structure_has_name (structure, "text/x-pango-markup"); + format = gst_structure_get_string (structure, "format"); + overlay->have_pango_markup = (strcmp (format, "pango-markup") == 0); return TRUE; } diff --git a/ext/pango/gsttextoverlay.c b/ext/pango/gsttextoverlay.c index ad918bd8fa..9c5e8a35e0 100644 --- a/ext/pango/gsttextoverlay.c +++ b/ext/pango/gsttextoverlay.c @@ -68,7 +68,7 @@ * ]| * One can also feed arbitrary live text into the element: * |[ - * gst-launch fdsrc fd=0 ! text/plain ! txt. videotestsrc ! \ + * gst-launch fdsrc fd=0 ! text/x-raw,format=utf8 ! txt. videotestsrc ! \ * textoverlay name=txt shaded-background=yes font-desc="Serif 40" wait-text=false ! \ * xvimagesink * ]| This shows new text as entered on the terminal (stdin). This is not suited @@ -86,10 +86,10 @@ #include static GstStaticPadTemplate text_sink_template_factory = - GST_STATIC_PAD_TEMPLATE ("text_sink", +GST_STATIC_PAD_TEMPLATE ("text_sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("text/x-pango-markup; text/plain") + GST_STATIC_CAPS ("text/x-raw, format = { pango-markup, utf8 }") ); G_DEFINE_TYPE (GstTextOverlay, gst_text_overlay, GST_TYPE_BASE_TEXT_OVERLAY); diff --git a/ext/pango/gsttextrender.c b/ext/pango/gsttextrender.c index 6c0a07ced4..ff0755b65b 100644 --- a/ext/pango/gsttextrender.c +++ b/ext/pango/gsttextrender.c @@ -96,10 +96,10 @@ GST_STATIC_PAD_TEMPLATE ("src", ); static GstStaticPadTemplate sink_template_factory = - GST_STATIC_PAD_TEMPLATE ("sink", +GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("text/x-pango-markup; text/plain") + GST_STATIC_CAPS ("text/x-raw, format = { pango-markup, utf8 }") ); #define GST_TYPE_TEXT_RENDER_VALIGN (gst_text_render_valign_get_type()) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index a3f5b9ee9e..2630eaa3b8 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -498,10 +498,10 @@ _event_probe (GstPad * pad, GstPadProbeInfo * info, PrivateStream * ps) return GST_PAD_PROBE_OK; } -static GstStaticCaps subtitle_caps = GST_STATIC_CAPS ("text/plain; " - "text/x-pango-markup; subpicture/x-pgs; subpicture/x-dvb; " +static GstStaticCaps subtitle_caps = GST_STATIC_CAPS ("text/x-raw; " + "subpicture/x-pgs; subpicture/x-dvb; subpicture/x-dvd; " "application/x-subtitle-unknown; application/x-ssa; application/x-ass; " - "subtitle/x-kate; application/x-kate; subpicture/x-dvd"); + "subtitle/x-kate; application/x-kate"); static gboolean is_subtitle_caps (const GstCaps * caps) diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c index 8d2efe1d28..db45f57116 100644 --- a/gst/encoding/gstencodebin.c +++ b/gst/encoding/gstencodebin.c @@ -232,8 +232,7 @@ struct _StreamGroup #define DEFAULT_RAW_CAPS \ "video/x-raw; " \ "audio/x-raw; " \ - "text/plain; " \ - "text/x-pango-markup; " \ + "text/x-raw; " \ "subpicture/x-dvd; " \ "subpicture/x-pgs" @@ -483,7 +482,7 @@ gst_encode_bin_init (GstEncodeBin * encode_bin) encode_bin->raw_video_caps = gst_caps_from_string ("video/x-raw"); encode_bin->raw_audio_caps = gst_caps_from_string ("audio/x-raw"); /* encode_bin->raw_text_caps = */ - /* gst_caps_from_string ("text/plain;text/x-pango-markup"); */ + /* gst_caps_from_string ("text/x-raw"); */ encode_bin->queue_buffers_max = DEFAULT_QUEUE_BUFFERS_MAX; encode_bin->queue_bytes_max = DEFAULT_QUEUE_BYTES_MAX; diff --git a/gst/playback/gstrawcaps.h b/gst/playback/gstrawcaps.h index 7ebdb29d16..c2860a55b6 100644 --- a/gst/playback/gstrawcaps.h +++ b/gst/playback/gstrawcaps.h @@ -28,8 +28,7 @@ G_BEGIN_DECLS #define DEFAULT_RAW_CAPS \ "video/x-raw; " \ "audio/x-raw; " \ - "text/plain; " \ - "text/x-pango-markup; " \ + "text/x-raw; " \ "subpicture/x-dvd; " \ "subpicture/x-pgs" diff --git a/gst/subparse/gstssaparse.c b/gst/subparse/gstssaparse.c index bea39b6978..8b8b06f848 100644 --- a/gst/subparse/gstssaparse.c +++ b/gst/subparse/gstssaparse.c @@ -41,7 +41,7 @@ static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink", static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("text/x-pango-markup") + GST_STATIC_CAPS ("text/x-raw, format=pango-markup") ); #define gst_ssa_parse_parent_class parent_class @@ -196,7 +196,9 @@ gst_ssa_parse_setcaps (GstPad * sinkpad, GstCaps * caps) gst_buffer_unmap (priv, &map); gst_buffer_unref (priv); - outcaps = gst_caps_new_empty_simple ("text/x-pango-markup"); + outcaps = gst_caps_new_simple ("text/x-raw", + "format", G_TYPE_STRING, "pango-markup", NULL); + ret = gst_pad_set_caps (parse->srcpad, outcaps); gst_caps_unref (outcaps); diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index fa98efd1ef..8e7519044d 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -76,7 +76,7 @@ static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink", static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("text/plain; text/x-pango-markup") + GST_STATIC_CAPS ("text/x-raw, format= { pango-markup, utf8 }") ); @@ -1340,36 +1340,45 @@ gst_sub_parse_format_autodetect (GstSubParse * self) switch (format) { case GST_SUB_PARSE_FORMAT_MDVDSUB: self->parse_line = parse_mdvdsub; - return gst_caps_new_empty_simple ("text/x-pango-markup"); + return gst_caps_new_simple ("text/x-raw", + "format", G_TYPE_STRING, "pango-markup", NULL); case GST_SUB_PARSE_FORMAT_SUBRIP: self->parse_line = parse_subrip; - return gst_caps_new_empty_simple ("text/x-pango-markup"); + return gst_caps_new_simple ("text/x-raw", + "format", G_TYPE_STRING, "pango-markup", NULL); case GST_SUB_PARSE_FORMAT_MPSUB: self->parse_line = parse_mpsub; - return gst_caps_new_empty_simple ("text/plain"); + return gst_caps_new_simple ("text/x-raw", + "format", G_TYPE_STRING, "utf8", NULL); #ifndef GST_DISABLE_XML case GST_SUB_PARSE_FORMAT_SAMI: self->parse_line = parse_sami; sami_context_init (&self->state); - return gst_caps_new_empty_simple ("text/x-pango-markup"); + return gst_caps_new_simple ("text/x-raw", + "format", G_TYPE_STRING, "pango-markup", NULL); #endif case GST_SUB_PARSE_FORMAT_TMPLAYER: self->parse_line = parse_tmplayer; self->state.max_duration = 5 * GST_SECOND; - return gst_caps_new_empty_simple ("text/plain"); + return gst_caps_new_simple ("text/x-raw", + "format", G_TYPE_STRING, "utf8", NULL); case GST_SUB_PARSE_FORMAT_MPL2: self->parse_line = parse_mpl2; - return gst_caps_new_empty_simple ("text/x-pango-markup"); + return gst_caps_new_simple ("text/x-raw", + "format", G_TYPE_STRING, "pango-markup", NULL); case GST_SUB_PARSE_FORMAT_DKS: self->parse_line = parse_dks; - return gst_caps_new_empty_simple ("text/plain"); + return gst_caps_new_simple ("text/x-raw", + "format", G_TYPE_STRING, "utf8", NULL); case GST_SUB_PARSE_FORMAT_SUBVIEWER: self->parse_line = parse_subviewer; - return gst_caps_new_empty_simple ("text/plain"); + return gst_caps_new_simple ("text/x-raw", + "format", G_TYPE_STRING, "utf8", NULL); case GST_SUB_PARSE_FORMAT_QTTEXT: self->parse_line = parse_qttext; qttext_context_init (&self->state); - return gst_caps_new_empty_simple ("text/x-pango-markup"); + return gst_caps_new_simple ("text/x-raw", + "format", G_TYPE_STRING, "pango-markup", NULL); case GST_SUB_PARSE_FORMAT_UNKNOWN: default: GST_DEBUG ("no subtitle format detected"); diff --git a/tests/check/elements/subparse.c b/tests/check/elements/subparse.c index 5e55c7e5c4..75f3a351f9 100644 --- a/tests/check/elements/subparse.c +++ b/tests/check/elements/subparse.c @@ -28,7 +28,7 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("text/plain; text/x-pango-markup") + GST_STATIC_CAPS ("text/x-raw, format = { pango-markup, utf8 }") ); static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, @@ -240,8 +240,9 @@ test_srt_do_test (SubParseInputChunk * input, guint start_idx, guint num) /* check caps */ fail_unless (outcaps != NULL); buffer_caps_struct = gst_caps_get_structure (outcaps, 0); - fail_unless_equals_string (gst_structure_get_name (buffer_caps_struct), - "text/x-pango-markup"); + fail_unless (gst_structure_has_name (buffer_caps_struct, "text/x-raw")); + fail_unless_equals_string (gst_structure_get_string (buffer_caps_struct, + "format"), "pango-markup"); } gst_caps_unref (outcaps); @@ -277,7 +278,7 @@ GST_START_TEST (test_srt) GST_END_TEST; static void -do_test (SubParseInputChunk * input, guint num, const gchar * media_type) +do_test (SubParseInputChunk * input, guint num, const gchar * format) { guint n; GstCaps *outcaps; @@ -333,8 +334,9 @@ do_test (SubParseInputChunk * input, guint num, const gchar * media_type) /* check caps */ fail_unless (outcaps != NULL); buffer_caps_struct = gst_caps_get_structure (outcaps, 0); - fail_unless_equals_string (gst_structure_get_name (buffer_caps_struct), - media_type); + fail_unless (gst_structure_has_name (buffer_caps_struct, "text/x-raw")); + fail_unless_equals_string (gst_structure_get_string (buffer_caps_struct, + "format"), format); } gst_caps_unref (outcaps); @@ -344,13 +346,13 @@ do_test (SubParseInputChunk * input, guint num, const gchar * media_type) static void test_tmplayer_do_test (SubParseInputChunk * input, guint num) { - do_test (input, num, "text/plain"); + do_test (input, num, "utf8"); } static void test_microdvd_do_test (SubParseInputChunk * input, guint num) { - do_test (input, num, "text/x-pango-markup"); + do_test (input, num, "pango-markup"); } GST_START_TEST (test_tmplayer_multiline) @@ -575,7 +577,7 @@ GST_START_TEST (test_mpl2) "Normal\nItalic"} }; - do_test (mpl2_input, G_N_ELEMENTS (mpl2_input), "text/x-pango-markup"); + do_test (mpl2_input, G_N_ELEMENTS (mpl2_input), "pango-markup"); } GST_END_TEST; @@ -606,7 +608,7 @@ GST_START_TEST (test_subviewer) "The heavens shook as the armies\nof Falis, God of Light..."} }; - do_test (subviewer_input, G_N_ELEMENTS (subviewer_input), "text/plain"); + do_test (subviewer_input, G_N_ELEMENTS (subviewer_input), "utf8"); } GST_END_TEST; @@ -638,7 +640,7 @@ GST_START_TEST (test_subviewer2) "AND THE GREAT HERDS RUN FREE.\nSO WHAT?!"} }; - do_test (subviewer2_input, G_N_ELEMENTS (subviewer2_input), "text/plain"); + do_test (subviewer2_input, G_N_ELEMENTS (subviewer2_input), "utf8"); } GST_END_TEST; @@ -655,7 +657,7 @@ GST_START_TEST (test_dks) "AND THE GREAT HERDS RUN FREE.\nSO WHAT?!"} }; - do_test (dks_input, G_N_ELEMENTS (dks_input), "text/plain"); + do_test (dks_input, G_N_ELEMENTS (dks_input), "utf8"); } GST_END_TEST; @@ -692,7 +694,7 @@ GST_START_TEST (test_sami) "This is a third comment.\nThis is a fourth comment."} }; - do_test (sami_input, G_N_ELEMENTS (sami_input), "text/x-pango-markup"); + do_test (sami_input, G_N_ELEMENTS (sami_input), "pango-markup"); } GST_END_TEST; diff --git a/tests/check/elements/textoverlay.c b/tests/check/elements/textoverlay.c index b546f32c5e..446a9baeaf 100644 --- a/tests/check/elements/textoverlay.c +++ b/tests/check/elements/textoverlay.c @@ -59,7 +59,7 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", static GstStaticPadTemplate text_srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS ("text/plain") + GST_STATIC_CAPS ("text/x-raw, format=utf8") ); static GstStaticPadTemplate video_srctemplate = GST_STATIC_PAD_TEMPLATE ("src", @@ -510,7 +510,8 @@ GST_START_TEST (test_video_waits_for_text) GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - caps = gst_caps_new_empty_simple ("text/plain"); + caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING, "utf8", + NULL); gst_pad_set_caps (mytextsrcpad, caps); gst_caps_unref (caps); @@ -684,7 +685,8 @@ GST_START_TEST (test_render_continuity) NULL, FALSE, NULL); fail_unless (thread != NULL); - caps = gst_caps_new_empty_simple ("text/plain"); + caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING, "utf8", + NULL); gst_pad_set_caps (mytextsrcpad, caps); gst_caps_unref (caps); diff --git a/tests/icles/playbin-text.c b/tests/icles/playbin-text.c index edf0a9631c..a8129e98c1 100644 --- a/tests/icles/playbin-text.c +++ b/tests/icles/playbin-text.c @@ -143,7 +143,7 @@ main (int argc, char *argv[]) g_object_set (G_OBJECT (app->textsink), "ts-offset", 0 * GST_SECOND, NULL); g_signal_connect (app->textsink, "new-buffer", G_CALLBACK (have_subtitle), app); - subcaps = gst_caps_from_string ("text/x-pango-markup; text/plain"); + subcaps = gst_caps_from_string ("text/x-raw, format={ utf8, pango-markup }"); g_object_set (G_OBJECT (app->textsink), "caps", subcaps, NULL); gst_caps_unref (subcaps);