upates for new ACCEPT_CAPS query

This commit is contained in:
Wim Taymans 2011-11-09 17:37:31 +01:00
parent d77c8cafee
commit f2ab0b8f19
2 changed files with 30 additions and 35 deletions

View file

@ -170,24 +170,6 @@ gst_stream_synchronizer_getcaps (GstPad * pad, GstCaps * filter)
return ret;
}
static gboolean
gst_stream_synchronizer_acceptcaps (GstPad * pad, GstCaps * caps)
{
GstPad *opad;
gboolean ret = FALSE;
opad = gst_stream_get_other_pad_from_pad (pad);
if (opad) {
ret = gst_pad_peer_accept_caps (opad, caps);
gst_object_unref (opad);
}
GST_LOG_OBJECT (pad, "Caps%s accepted: %" GST_PTR_FORMAT, (ret ? "" : " not"),
caps);
return ret;
}
/* srcpad functions */
static gboolean
gst_stream_synchronizer_src_event (GstPad * pad, GstEvent * event)
@ -687,8 +669,6 @@ gst_stream_synchronizer_request_new_pad (GstElement * element,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_query));
gst_pad_set_getcaps_function (stream->sinkpad,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_getcaps));
gst_pad_set_acceptcaps_function (stream->sinkpad,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_acceptcaps));
gst_pad_set_event_function (stream->sinkpad,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_sink_event));
gst_pad_set_chain_function (stream->sinkpad,
@ -704,8 +684,6 @@ gst_stream_synchronizer_request_new_pad (GstElement * element,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_query));
gst_pad_set_getcaps_function (stream->srcpad,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_getcaps));
gst_pad_set_acceptcaps_function (stream->srcpad,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_acceptcaps));
gst_pad_set_event_function (stream->srcpad,
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_src_event));

View file

@ -1872,17 +1872,6 @@ gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad, GstCaps * filter)
return ret;
}
static gboolean
gst_subtitle_overlay_subtitle_sink_acceptcaps (GstPad * pad, GstCaps * caps)
{
GstCaps *othercaps = gst_subtitle_overlay_subtitle_sink_getcaps (pad, NULL);
gboolean ret = gst_caps_is_subset (caps, othercaps);
gst_caps_unref (othercaps);
return ret;
}
static gboolean
gst_subtitle_overlay_subtitle_sink_setcaps (GstSubtitleOverlay * self,
GstCaps * caps)
@ -2052,6 +2041,34 @@ out:
return ret;
}
static gboolean
gst_subtitle_overlay_subtitle_sink_query (GstPad * pad, GstQuery * query)
{
GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
gboolean ret;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_ACCEPT_CAPS:
{
GstCaps *caps, *othercaps;
gst_query_parse_accept_caps (query, &caps);
othercaps = gst_subtitle_overlay_subtitle_sink_getcaps (pad, NULL);
ret = gst_caps_is_subset (caps, othercaps);
gst_caps_unref (othercaps);
gst_query_set_accept_caps_result (query, ret);
ret = TRUE;
break;
}
default:
ret = gst_pad_query_default (pad, query);
break;
}
gst_object_unref (self);
return ret;
}
static void
gst_subtitle_overlay_init (GstSubtitleOverlay * self)
{
@ -2101,12 +2118,12 @@ gst_subtitle_overlay_init (GstSubtitleOverlay * self)
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_unlink));
gst_pad_set_event_function (self->subtitle_sinkpad,
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_event));
gst_pad_set_query_function (self->subtitle_sinkpad,
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_query));
gst_pad_set_chain_function (self->subtitle_sinkpad,
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_chain));
gst_pad_set_getcaps_function (self->subtitle_sinkpad,
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_getcaps));
gst_pad_set_acceptcaps_function (self->subtitle_sinkpad,
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_subtitle_sink_acceptcaps));
proxypad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD