mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
change getcaps to query
This commit is contained in:
parent
ac9c7bbfef
commit
03713e5045
4 changed files with 177 additions and 22 deletions
|
@ -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;
|
||||
|
||||
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_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
|
||||
|
@ -1274,6 +1287,33 @@ gst_ass_render_event_video (GstPad * pad, GstEvent * event)
|
|||
return ret;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
@ -912,6 +925,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)
|
||||
{
|
||||
|
|
|
@ -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");
|
||||
|
@ -287,6 +287,31 @@ gst_dvd_spu_src_event (GstPad * pad, GstEvent * event)
|
|||
return res;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue