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;
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",
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:
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;
}
* ]|
* 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
#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);
);
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())
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)
#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"
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;
#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"
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
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);
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 }")
);
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");
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,
/* 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);
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;
/* 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);
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)
"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;
"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;
"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;
"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;
"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;
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",
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);
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);
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);