mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
text/plain + text/x-pango-markup -> text/x-raw
This commit is contained in:
parent
a99a1042b9
commit
7c2e7b1a4f
13 changed files with 64 additions and 47 deletions
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 <gsttextoverlay.h>
|
||||
|
||||
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);
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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\n<i>Italic</i>"}
|
||||
};
|
||||
|
||||
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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue