summaryrefslogtreecommitdiff
path: root/ext/assrender
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2011-11-15 16:34:13 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2011-11-15 16:34:13 +0100
commit03713e50459ba62d5b15e753907258b3ce0689c3 (patch)
tree9dc9f0614f99fe7c39d279268151fa5cdb06ee52 /ext/assrender
parentac9c7bbfefeaa66361e4817eec50eeb123e818d3 (diff)
change getcaps to query
Diffstat (limited to 'ext/assrender')
-rw-r--r--ext/assrender/gstassrender.c56
1 files changed, 48 insertions, 8 deletions
diff --git a/ext/assrender/gstassrender.c b/ext/assrender/gstassrender.c
index 9a4a77595..a5bc22b59 100644
--- a/ext/assrender/gstassrender.c
+++ b/ext/assrender/gstassrender.c
@@ -104,6 +104,7 @@ static gboolean gst_ass_render_event_video (GstPad * pad, GstEvent * event);
static gboolean gst_ass_render_event_text (GstPad * pad, GstEvent * event);
static gboolean gst_ass_render_event_src (GstPad * pad, GstEvent * event);
+static gboolean gst_ass_render_query_video (GstPad * pad, GstQuery * query);
static gboolean gst_ass_render_query_src (GstPad * pad, GstQuery * query);
/* initialize the plugin's class */
@@ -176,11 +177,6 @@ gst_ass_render_init (GstAssRender * render)
render->text_sinkpad =
gst_pad_new_from_static_template (&text_sink_factory, "text_sink");
- gst_pad_set_getcaps_function (render->srcpad,
- GST_DEBUG_FUNCPTR (gst_ass_render_getcaps));
- gst_pad_set_getcaps_function (render->video_sinkpad,
- GST_DEBUG_FUNCPTR (gst_ass_render_getcaps));
-
gst_pad_set_chain_function (render->video_sinkpad,
GST_DEBUG_FUNCPTR (gst_ass_render_chain_video));
gst_pad_set_chain_function (render->text_sinkpad,
@@ -195,6 +191,8 @@ gst_ass_render_init (GstAssRender * render)
gst_pad_set_query_function (render->srcpad,
GST_DEBUG_FUNCPTR (gst_ass_render_query_src));
+ gst_pad_set_query_function (render->video_sinkpad,
+ GST_DEBUG_FUNCPTR (gst_ass_render_query_video));
gst_element_add_pad (GST_ELEMENT (render), render->srcpad);
gst_element_add_pad (GST_ELEMENT (render), render->video_sinkpad);
@@ -355,12 +353,27 @@ static gboolean
gst_ass_render_query_src (GstPad * pad, GstQuery * query)
{
GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad));
- gboolean ret;
+ gboolean res = FALSE;
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_CAPS:
+ {
+ GstCaps *filter, *caps;
- ret = gst_pad_peer_query (render->video_sinkpad, query);
+ gst_query_parse_caps (query, &filter);
+ caps = gst_ass_render_getcaps (pad, filter);
+ gst_query_set_caps_result (query, caps);
+ gst_caps_unref (caps);
+ res = TRUE;
+ break;
+ }
+ default:
+ res = gst_pad_query_default (pad, query);
+ break;
+ }
gst_object_unref (render);
- return ret;
+ return res;
}
static gboolean
@@ -1275,6 +1288,33 @@ gst_ass_render_event_video (GstPad * pad, GstEvent * event)
}
static gboolean
+gst_ass_render_query_video (GstPad * pad, GstQuery * query)
+{
+ GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad));
+ gboolean res = FALSE;
+
+ switch (GST_QUERY_TYPE (query)) {
+ case GST_QUERY_CAPS:
+ {
+ GstCaps *filter, *caps;
+
+ gst_query_parse_caps (query, &filter);
+ caps = gst_ass_render_getcaps (pad, filter);
+ gst_query_set_caps_result (query, caps);
+ gst_caps_unref (caps);
+ res = TRUE;
+ break;
+ }
+ default:
+ res = gst_pad_query_default (pad, query);
+ break;
+ }
+
+ gst_object_unref (render);
+ return res;
+}
+
+static gboolean
gst_ass_render_event_text (GstPad * pad, GstEvent * event)
{
gint i;