diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-11-15 16:34:13 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-11-15 16:34:13 +0100 |
commit | 03713e50459ba62d5b15e753907258b3ce0689c3 (patch) | |
tree | 9dc9f0614f99fe7c39d279268151fa5cdb06ee52 | |
parent | ac9c7bbfefeaa66361e4817eec50eeb123e818d3 (diff) |
change getcaps to query
-rw-r--r-- | ext/assrender/gstassrender.c | 56 | ||||
-rw-r--r-- | gst-libs/gst/video/gstbasevideoencoder.c | 33 | ||||
-rw-r--r-- | gst/dvbsuboverlay/gstdvbsuboverlay.c | 52 | ||||
-rw-r--r-- | gst/dvdspu/gstdvdspu.c | 58 |
4 files changed, 177 insertions, 22 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; diff --git a/gst-libs/gst/video/gstbasevideoencoder.c b/gst-libs/gst/video/gstbasevideoencoder.c index af7943fbf..aff28cb73 100644 --- a/gst-libs/gst/video/gstbasevideoencoder.c +++ b/gst-libs/gst/video/gstbasevideoencoder.c @@ -121,6 +121,8 @@ static gboolean gst_base_video_encoder_src_event (GstPad * pad, GstEvent * event); static gboolean gst_base_video_encoder_sink_event (GstPad * pad, GstEvent * event); +static gboolean gst_base_video_encoder_sink_query (GstPad * pad, + GstQuery * query); static GstFlowReturn gst_base_video_encoder_chain (GstPad * pad, GstBuffer * buf); static GstStateChangeReturn gst_base_video_encoder_change_state (GstElement * @@ -130,8 +132,7 @@ static gboolean gst_base_video_encoder_src_query (GstPad * pad, #define gst_base_video_encoder_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstBaseVideoEncoder, gst_base_video_encoder, - GST_TYPE_BASE_VIDEO_CODEC, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL); - ); + GST_TYPE_BASE_VIDEO_CODEC, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL);); static void gst_base_video_encoder_class_init (GstBaseVideoEncoderClass * klass) @@ -190,8 +191,8 @@ gst_base_video_encoder_init (GstBaseVideoEncoder * base_video_encoder) GST_DEBUG_FUNCPTR (gst_base_video_encoder_chain)); gst_pad_set_event_function (pad, GST_DEBUG_FUNCPTR (gst_base_video_encoder_sink_event)); - gst_pad_set_getcaps_function (pad, - GST_DEBUG_FUNCPTR (gst_base_video_encoder_sink_getcaps)); + gst_pad_set_query_function (pad, + GST_DEBUG_FUNCPTR (gst_base_video_encoder_sink_query)); pad = GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_encoder); @@ -422,6 +423,30 @@ done: return fcaps; } +static gboolean +gst_base_video_encoder_sink_query (GstPad * pad, GstQuery * query) +{ + gboolean res = FALSE; + + switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_CAPS: + { + GstCaps *filter, *caps; + + gst_query_parse_caps (query, &filter); + caps = gst_base_video_encoder_sink_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; + } + return res; +} + static void gst_base_video_encoder_finalize (GObject * object) { diff --git a/gst/dvbsuboverlay/gstdvbsuboverlay.c b/gst/dvbsuboverlay/gstdvbsuboverlay.c index 7641f384c..a0948daf3 100644 --- a/gst/dvbsuboverlay/gstdvbsuboverlay.c +++ b/gst/dvbsuboverlay/gstdvbsuboverlay.c @@ -108,6 +108,7 @@ static gboolean gst_dvbsub_overlay_event_src (GstPad * pad, GstEvent * event); static void new_dvb_subtitles_cb (DvbSub * dvb_sub, DVBSubtitles * subs, gpointer user_data); +static gboolean gst_dvbsub_overlay_query_video (GstPad * pad, GstQuery * query); static gboolean gst_dvbsub_overlay_query_src (GstPad * pad, GstQuery * query); /* initialize the plugin's class */ @@ -185,11 +186,6 @@ gst_dvbsub_overlay_init (GstDVBSubOverlay * 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_dvbsub_overlay_getcaps)); - gst_pad_set_getcaps_function (render->video_sinkpad, - GST_DEBUG_FUNCPTR (gst_dvbsub_overlay_getcaps)); - gst_pad_set_chain_function (render->video_sinkpad, GST_DEBUG_FUNCPTR (gst_dvbsub_overlay_chain_video)); gst_pad_set_chain_function (render->text_sinkpad, @@ -202,6 +198,8 @@ gst_dvbsub_overlay_init (GstDVBSubOverlay * render) gst_pad_set_event_function (render->srcpad, GST_DEBUG_FUNCPTR (gst_dvbsub_overlay_event_src)); + gst_pad_set_query_function (render->video_sinkpad, + GST_DEBUG_FUNCPTR (gst_dvbsub_overlay_query_video)); gst_pad_set_query_function (render->srcpad, GST_DEBUG_FUNCPTR (gst_dvbsub_overlay_query_src)); @@ -331,7 +329,22 @@ gst_dvbsub_overlay_query_src (GstPad * pad, GstQuery * query) GstDVBSubOverlay *render = GST_DVBSUB_OVERLAY (gst_pad_get_parent (pad)); gboolean ret; - ret = gst_pad_peer_query (render->video_sinkpad, query); + switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_CAPS: + { + GstCaps *filter, *caps; + + gst_query_parse_caps (query, &filter); + caps = gst_dvbsub_overlay_getcaps (pad, filter); + gst_query_set_caps_result (query, caps); + gst_caps_unref (caps); + ret = TRUE; + break; + } + default: + ret = gst_pad_peer_query (render->video_sinkpad, query); + break; + } gst_object_unref (render); return ret; @@ -913,6 +926,33 @@ missing_timestamp: } static gboolean +gst_dvbsub_overlay_query_video (GstPad * pad, GstQuery * query) +{ + GstDVBSubOverlay *render = GST_DVBSUB_OVERLAY (gst_pad_get_parent (pad)); + gboolean ret; + + switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_CAPS: + { + GstCaps *filter, *caps; + + gst_query_parse_caps (query, &filter); + caps = gst_dvbsub_overlay_getcaps (pad, filter); + gst_query_set_caps_result (query, caps); + gst_caps_unref (caps); + ret = TRUE; + break; + } + default: + ret = gst_pad_query_default (pad, query); + break; + } + + gst_object_unref (render); + return ret; +} + +static gboolean gst_dvbsub_overlay_event_video (GstPad * pad, GstEvent * event) { gboolean ret = FALSE; diff --git a/gst/dvdspu/gstdvdspu.c b/gst/dvdspu/gstdvdspu.c index 8f67d63f8..f6e59f75a 100644 --- a/gst/dvdspu/gstdvdspu.c +++ b/gst/dvdspu/gstdvdspu.c @@ -91,12 +91,14 @@ static GstStateChangeReturn gst_dvd_spu_change_state (GstElement * element, GstStateChange transition); static gboolean gst_dvd_spu_src_event (GstPad * pad, GstEvent * event); +static gboolean gst_dvd_spu_src_query (GstPad * pad, GstQuery * query); static GstCaps *gst_dvd_spu_video_proxy_getcaps (GstPad * pad, GstCaps * filter); static gboolean gst_dvd_spu_video_set_caps (GstPad * pad, GstCaps * caps); static GstFlowReturn gst_dvd_spu_video_chain (GstPad * pad, GstBuffer * buf); static gboolean gst_dvd_spu_video_event (GstPad * pad, GstEvent * event); +static gboolean gst_dvd_spu_video_query (GstPad * pad, GstQuery * query); static void gst_dvd_spu_redraw_still (GstDVDSpu * dvdspu, gboolean force); static void gst_dvd_spu_check_still_updates (GstDVDSpu * dvdspu); @@ -146,15 +148,13 @@ gst_dvd_spu_init (GstDVDSpu * dvdspu) { dvdspu->videosinkpad = gst_pad_new_from_static_template (&video_sink_factory, "video"); - gst_pad_set_getcaps_function (dvdspu->videosinkpad, - gst_dvd_spu_video_proxy_getcaps); gst_pad_set_chain_function (dvdspu->videosinkpad, gst_dvd_spu_video_chain); gst_pad_set_event_function (dvdspu->videosinkpad, gst_dvd_spu_video_event); + gst_pad_set_query_function (dvdspu->videosinkpad, gst_dvd_spu_video_query); dvdspu->srcpad = gst_pad_new_from_static_template (&src_factory, "src"); gst_pad_set_event_function (dvdspu->srcpad, gst_dvd_spu_src_event); - gst_pad_set_getcaps_function (dvdspu->srcpad, - gst_dvd_spu_video_proxy_getcaps); + gst_pad_set_query_function (dvdspu->srcpad, gst_dvd_spu_src_query); dvdspu->subpic_sinkpad = gst_pad_new_from_static_template (&subpic_sink_factory, "subpicture"); @@ -288,6 +288,31 @@ gst_dvd_spu_src_event (GstPad * pad, GstEvent * event) } static gboolean +gst_dvd_spu_src_query (GstPad * pad, GstQuery * query) +{ + gboolean res = FALSE; + + switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_CAPS: + { + GstCaps *filter, *caps; + + gst_query_parse_caps (query, &filter); + caps = gst_dvd_spu_video_proxy_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; + } + + return res; +} + +static gboolean gst_dvd_spu_video_set_caps (GstPad * pad, GstCaps * caps) { GstDVDSpu *dvdspu = GST_DVD_SPU (gst_pad_get_parent (pad)); @@ -469,6 +494,31 @@ error: #endif } +static gboolean +gst_dvd_spu_video_query (GstPad * pad, GstQuery * query) +{ + gboolean res = FALSE; + + switch (GST_QUERY_TYPE (query)) { + case GST_QUERY_CAPS: + { + GstCaps *filter, *caps; + + gst_query_parse_caps (query, &filter); + caps = gst_dvd_spu_video_proxy_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; + } + + return res; +} + static GstFlowReturn gst_dvd_spu_video_chain (GstPad * pad, GstBuffer * buf) { |