From 71efbb1e73a557d50093ccaf2ecc47009b7edd95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 19 Jul 2009 22:29:19 +0100 Subject: kate: fix up for additional subtitle/x-kate media type --- ext/kate/gstkate.h | 2 +- ext/kate/gstkatedec.c | 2 +- ext/kate/gstkateenc.c | 12 ++++++++---- ext/kate/gstkateparse.c | 14 +++++++++----- ext/kate/gstkatetiger.c | 12 +++++------- ext/kate/gstkateutil.c | 2 ++ 6 files changed, 26 insertions(+), 18 deletions(-) (limited to 'ext/kate') diff --git a/ext/kate/gstkate.h b/ext/kate/gstkate.h index fbccfea1..f1968813 100644 --- a/ext/kate/gstkate.h +++ b/ext/kate/gstkate.h @@ -48,7 +48,7 @@ G_BEGIN_DECLS -#define GST_KATE_MEDIA_TYPE "subtitle/x-kate" +/* nothing here any more */ G_END_DECLS diff --git a/ext/kate/gstkatedec.c b/ext/kate/gstkatedec.c index 8becb27e..30ab8c16 100644 --- a/ext/kate/gstkatedec.c +++ b/ext/kate/gstkatedec.c @@ -103,7 +103,7 @@ enum static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_KATE_MEDIA_TYPE) + GST_STATIC_CAPS ("subtitle/x-kate") ); static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", diff --git a/ext/kate/gstkateenc.c b/ext/kate/gstkateenc.c index 8e1b2ec1..ccf01396 100644 --- a/ext/kate/gstkateenc.c +++ b/ext/kate/gstkateenc.c @@ -133,7 +133,7 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_KATE_MEDIA_TYPE) + GST_STATIC_CAPS ("subtitle/x-kate; application/x-kate") ); static void gst_kate_enc_set_property (GObject * object, guint prop_id, @@ -554,9 +554,13 @@ gst_kate_enc_send_headers (GstKateEnc * ke) } if (rflow == GST_FLOW_OK) { - caps = - gst_kate_util_set_header_on_caps (&ke->element, - gst_pad_get_caps (ke->srcpad), headers); + if (ke->category != NULL && strstr (ke->category, "subtitle")) { + caps = gst_kate_util_set_header_on_caps (&ke->element, + gst_caps_from_string ("subtitle/x-kate"), headers); + } else { + caps = gst_kate_util_set_header_on_caps (&ke->element, + gst_caps_from_string ("application/x-kate"), headers); + } if (caps) { GST_DEBUG_OBJECT (ke, "here are the caps: %" GST_PTR_FORMAT, caps); gst_pad_set_caps (ke->srcpad, caps); diff --git a/ext/kate/gstkateparse.c b/ext/kate/gstkateparse.c index b44eea91..5cf8ec48 100644 --- a/ext/kate/gstkateparse.c +++ b/ext/kate/gstkateparse.c @@ -76,17 +76,17 @@ GST_ELEMENT_DETAILS ("Kate stream parser", "Vincent Penquerc'h "); static GstStaticPadTemplate gst_kate_parse_sink_factory = -GST_STATIC_PAD_TEMPLATE ("sink", + GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_KATE_MEDIA_TYPE) + GST_STATIC_CAPS ("subtitle/x-kate; application/x-kate") ); static GstStaticPadTemplate gst_kate_parse_src_factory = -GST_STATIC_PAD_TEMPLATE ("src", + GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_KATE_MEDIA_TYPE) + GST_STATIC_CAPS ("subtitle/x-kate; application/x-kate") ); GST_BOILERPLATE (GstKateParse, gst_kate_parse, GstElement, GST_TYPE_ELEMENT); @@ -169,7 +169,8 @@ gst_kate_parse_push_headers (GstKateParse * parse) /* get the headers into the caps, passing them to kate as we go */ caps = gst_kate_util_set_header_on_caps (&parse->element, - gst_pad_get_caps (parse->srcpad), parse->streamheader); + gst_pad_get_negotiated_caps (parse->sinkpad), parse->streamheader); + if (G_UNLIKELY (!caps)) { GST_ERROR_OBJECT (parse, "Failed to set headers on caps"); return GST_FLOW_ERROR; @@ -389,6 +390,9 @@ gst_kate_parse_chain (GstPad * pad, GstBuffer * buffer) g_assert (klass->parse_packet != NULL); + if (G_UNLIKELY (GST_PAD_CAPS (pad) == NULL)) + return GST_FLOW_NOT_NEGOTIATED; + return klass->parse_packet (parse, buffer); } diff --git a/ext/kate/gstkatetiger.c b/ext/kate/gstkatetiger.c index 20df0481..433a3106 100644 --- a/ext/kate/gstkatetiger.c +++ b/ext/kate/gstkatetiger.c @@ -108,14 +108,14 @@ enum ARG_DEFAULT_BACKGROUND_RED, ARG_DEFAULT_BACKGROUND_GREEN, ARG_DEFAULT_BACKGROUND_BLUE, - ARG_DEFAULT_BACKGROUND_ALPHA, + ARG_DEFAULT_BACKGROUND_ALPHA }; static GstStaticPadTemplate kate_sink_factory = -GST_STATIC_PAD_TEMPLATE ("kate_sink", + GST_STATIC_PAD_TEMPLATE ("kate_sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS (GST_KATE_MEDIA_TYPE) + GST_STATIC_CAPS ("subtitle/x-kate; application/x-kate") ); static GstStaticPadTemplate video_sink_factory = @@ -294,10 +294,8 @@ gst_kate_tiger_init (GstKateTiger * tiger, GstKateTigerClass * gclass) GST_DEBUG_FUNCPTR (gst_kate_tiger_kate_chain)); gst_pad_set_query_function (tiger->katesinkpad, GST_DEBUG_FUNCPTR (gst_kate_tiger_kate_sink_query)); - gst_pad_use_fixed_caps (tiger->katesinkpad); - gst_pad_set_caps (tiger->katesinkpad, - gst_static_pad_template_get_caps (&kate_sink_factory)); - gst_pad_set_event_function (tiger->katesinkpad, gst_kate_tiger_kate_event); + gst_pad_set_event_function (tiger->katesinkpad, + GST_DEBUG_FUNCPTR (gst_kate_tiger_kate_event)); gst_element_add_pad (GST_ELEMENT (tiger), tiger->katesinkpad); tiger->videosinkpad = diff --git a/ext/kate/gstkateutil.c b/ext/kate/gstkateutil.c index 2928771d..f47ba575 100644 --- a/ext/kate/gstkateutil.c +++ b/ext/kate/gstkateutil.c @@ -33,6 +33,8 @@ gst_kate_util_set_header_on_caps (GstElement * element, GstCaps * caps, GstStructure *structure; GValue array = { 0 }; + GST_LOG_OBJECT (element, "caps: %" GST_PTR_FORMAT, caps); + if (G_UNLIKELY (!caps)) return NULL; if (G_UNLIKELY (!headers)) -- cgit v1.2.1