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 /gst | |
parent | ac9c7bbfefeaa66361e4817eec50eeb123e818d3 (diff) |
change getcaps to query
Diffstat (limited to 'gst')
-rw-r--r-- | gst/dvbsuboverlay/gstdvbsuboverlay.c | 52 | ||||
-rw-r--r-- | gst/dvdspu/gstdvdspu.c | 58 |
2 files changed, 100 insertions, 10 deletions
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) { |