Commit 61903122 authored by Wim Taymans's avatar Wim Taymans

add parent to query function

parent 445d4d85
......@@ -90,7 +90,8 @@ static void gst_cmml_dec_get_property (GObject * dec, guint property_id,
GValue * value, GParamSpec * pspec);
static void gst_cmml_dec_set_property (GObject * dec, guint property_id,
const GValue * value, GParamSpec * pspec);
static gboolean gst_cmml_dec_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_cmml_dec_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_cmml_dec_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_cmml_dec_convert (GstPad * pad, GstFormat src_fmt,
gint64 src_val, GstFormat * dest_fmt, gint64 * dest_val);
......@@ -253,7 +254,7 @@ gst_cmml_dec_change_state (GstElement * element, GstStateChange transition)
}
static gboolean
gst_cmml_dec_sink_query (GstPad * pad, GstQuery * query)
gst_cmml_dec_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = FALSE;
......
......@@ -95,7 +95,8 @@ static void gst_jpeg_dec_get_property (GObject * object, guint prop_id,
static GstFlowReturn gst_jpeg_dec_chain (GstPad * pad, GstBuffer * buffer);
static GstCaps *gst_jpeg_dec_getcaps (GstPad * pad, GstCaps * filter);
static gboolean gst_jpeg_dec_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_jpeg_dec_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_jpeg_dec_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_jpeg_dec_src_event (GstPad * pad, GstEvent * event);
static GstStateChangeReturn gst_jpeg_dec_change_state (GstElement * element,
......@@ -1777,7 +1778,7 @@ gst_jpeg_dec_sink_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_jpeg_dec_sink_query (GstPad * pad, GstQuery * query)
gst_jpeg_dec_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = FALSE;
......@@ -1794,7 +1795,7 @@ gst_jpeg_dec_sink_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
......
......@@ -72,7 +72,8 @@ static void gst_jpegenc_finalize (GObject * object);
static GstFlowReturn gst_jpegenc_chain (GstPad * pad, GstBuffer * buf);
static gboolean gst_jpegenc_sink_event (GstPad * pad, GstEvent * event);
static GstCaps *gst_jpegenc_getcaps (GstPad * pad, GstCaps * filter);
static gboolean gst_jpegenc_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_jpegenc_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static void gst_jpegenc_resync (GstJpegEnc * jpegenc);
static void gst_jpegenc_set_property (GObject * object, guint prop_id,
......@@ -342,10 +343,9 @@ done:
}
static gboolean
gst_jpegenc_sink_query (GstPad * pad, GstQuery * query)
gst_jpegenc_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res;
GstJpegEnc *enc = GST_JPEGENC (gst_pad_get_parent (pad));
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CAPS:
......@@ -360,12 +360,9 @@ gst_jpegenc_sink_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
gst_object_unref (enc);
return res;
}
......
......@@ -115,12 +115,11 @@ static gboolean gst_pulse_audio_sink_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_pulse_audio_sink_sink_event (GstPad * pad,
GstEvent * event);
static gboolean gst_pulse_audio_sink_sink_query (GstPad * pad,
GstQuery * query);
GstObject * parent, GstQuery * query);
static gboolean gst_pulse_audio_sink_sink_acceptcaps (GstPulseAudioSink * pbin,
GstPad * pad, GstCaps * caps);
static GstStateChangeReturn
gst_pulse_audio_sink_change_state (GstElement * element,
GstStateChange transition);
static GstStateChangeReturn gst_pulse_audio_sink_change_state (GstElement *
element, GstStateChange transition);
static gboolean gst_pulse_audio_sink_set_caps (GstPulseAudioSink * pbin,
GstCaps * caps);
......@@ -847,9 +846,10 @@ out:
}
static gboolean
gst_pulse_audio_sink_sink_query (GstPad * pad, GstQuery * query)
gst_pulse_audio_sink_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
GstPulseAudioSink *pbin = GST_PULSE_AUDIO_SINK (gst_pad_get_parent (pad));
GstPulseAudioSink *pbin = GST_PULSE_AUDIO_SINK (parent);
gboolean ret = FALSE;
switch (GST_QUERY_TYPE (query)) {
......@@ -864,12 +864,9 @@ gst_pulse_audio_sink_sink_query (GstPad * pad, GstQuery * query)
break;
}
default:
ret = gst_pad_query_default (pad, query);
ret = gst_pad_query_default (pad, parent, query);
break;
}
gst_object_unref (pbin);
return ret;
}
......
......@@ -72,7 +72,7 @@ static gboolean gst_audio_fx_base_fir_filter_setup (GstAudioFilter * base,
const GstAudioInfo * info);
static gboolean gst_audio_fx_base_fir_filter_query (GstPad * pad,
GstQuery * query);
GstObject * parent, GstQuery * query);
/*
* The code below calculates the linear convolution:
......@@ -942,10 +942,10 @@ gst_audio_fx_base_fir_filter_stop (GstBaseTransform * base)
}
static gboolean
gst_audio_fx_base_fir_filter_query (GstPad * pad, GstQuery * query)
gst_audio_fx_base_fir_filter_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
GstAudioFXBaseFIRFilter *self =
GST_AUDIO_FX_BASE_FIR_FILTER (gst_pad_get_parent (pad));
GstAudioFXBaseFIRFilter *self = GST_AUDIO_FX_BASE_FIR_FILTER (parent);
gboolean res = TRUE;
switch (GST_QUERY_TYPE (query)) {
......@@ -954,49 +954,45 @@ gst_audio_fx_base_fir_filter_query (GstPad * pad, GstQuery * query)
GstClockTime min, max;
gboolean live;
guint64 latency;
GstPad *peer;
gint rate = GST_AUDIO_FILTER_RATE (self);
if (rate == 0) {
res = FALSE;
} else if ((peer = gst_pad_get_peer (GST_BASE_TRANSFORM (self)->sinkpad))) {
if ((res = gst_pad_query (peer, query))) {
gst_query_parse_latency (query, &live, &min, &max);
} else if ((res =
gst_pad_peer_query (GST_BASE_TRANSFORM (self)->sinkpad, query))) {
gst_query_parse_latency (query, &live, &min, &max);
GST_DEBUG_OBJECT (self, "Peer latency: min %"
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
GST_DEBUG_OBJECT (self, "Peer latency: min %"
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
if (self->fft && !self->low_latency)
latency = self->block_length - self->kernel_length + 1;
else
latency = self->latency;
if (self->fft && !self->low_latency)
latency = self->block_length - self->kernel_length + 1;
else
latency = self->latency;
/* add our own latency */
latency = gst_util_uint64_scale_round (latency, GST_SECOND, rate);
/* add our own latency */
latency = gst_util_uint64_scale_round (latency, GST_SECOND, rate);
GST_DEBUG_OBJECT (self, "Our latency: %"
GST_TIME_FORMAT, GST_TIME_ARGS (latency));
GST_DEBUG_OBJECT (self, "Our latency: %"
GST_TIME_FORMAT, GST_TIME_ARGS (latency));
min += latency;
if (max != GST_CLOCK_TIME_NONE)
max += latency;
min += latency;
if (max != GST_CLOCK_TIME_NONE)
max += latency;
GST_DEBUG_OBJECT (self, "Calculated total latency : min %"
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
GST_DEBUG_OBJECT (self, "Calculated total latency : min %"
GST_TIME_FORMAT " max %" GST_TIME_FORMAT,
GST_TIME_ARGS (min), GST_TIME_ARGS (max));
gst_query_set_latency (query, live, min, max);
}
gst_object_unref (peer);
gst_query_set_latency (query, live, min, max);
}
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
gst_object_unref (self);
return res;
}
......
......@@ -80,7 +80,8 @@ static GstFlowReturn gst_au_parse_chain (GstPad * pad, GstBuffer * buf);
static GstStateChangeReturn gst_au_parse_change_state (GstElement * element,
GstStateChange transition);
static void gst_au_parse_reset (GstAuParse * auparse);
static gboolean gst_au_parse_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_au_parse_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_au_parse_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_au_parse_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_au_parse_src_convert (GstAuParse * auparse,
......@@ -541,12 +542,12 @@ gst_au_parse_src_convert (GstAuParse * auparse, GstFormat src_format,
}
static gboolean
gst_au_parse_src_query (GstPad * pad, GstQuery * query)
gst_au_parse_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstAuParse *auparse;
gboolean ret = FALSE;
auparse = GST_AU_PARSE (gst_pad_get_parent (pad));
auparse = GST_AU_PARSE (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_DURATION:{
......@@ -606,11 +607,10 @@ gst_au_parse_src_query (GstPad * pad, GstQuery * query)
break;
}
default:
ret = gst_pad_query_default (pad, query);
ret = gst_pad_query_default (pad, parent, query);
break;
}
gst_object_unref (auparse);
return ret;
}
......
......@@ -87,7 +87,8 @@ static gboolean gst_avi_demux_push_event (GstAviDemux * avi, GstEvent * event);
#if 0
static const GstFormat *gst_avi_demux_get_src_formats (GstPad * pad);
#endif
static gboolean gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_avi_demux_handle_src_query (GstPad * pad,
GstObject * parent, GstQuery * query);
static gboolean gst_avi_demux_src_convert (GstPad * pad, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
......@@ -417,15 +418,16 @@ done:
}
static gboolean
gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query)
gst_avi_demux_handle_src_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
gboolean res = TRUE;
GstAviDemux *avi = GST_AVI_DEMUX (gst_pad_get_parent (pad));
GstAviDemux *avi = GST_AVI_DEMUX (parent);
GstAviStream *stream = gst_pad_get_element_private (pad);
if (!stream->strh || !stream->strf.data)
return gst_pad_query_default (pad, query);
return gst_pad_query_default (pad, parent, query);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:{
......@@ -552,15 +554,14 @@ gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query)
&dest_val)))
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
else
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
gst_object_unref (avi);
return res;
}
......
......@@ -102,7 +102,8 @@ gst_push_file_src_class_init (GstPushFileSrcClass * g_class)
}
static gboolean
gst_push_file_src_ghostpad_query (GstPad * pad, GstQuery * query)
gst_push_file_src_ghostpad_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
gboolean res;
......@@ -112,7 +113,7 @@ gst_push_file_src_ghostpad_query (GstPad * pad, GstQuery * query)
res = TRUE;
break;
default:
res = gst_proxy_pad_query_default (pad, query);
res = gst_proxy_pad_query_default (pad, parent, query);
break;
}
return res;
......
......@@ -93,7 +93,8 @@ static gboolean flv_demux_handle_seek_push (GstFlvDemux * demux,
static gboolean gst_flv_demux_handle_seek_pull (GstFlvDemux * demux,
GstEvent * event, gboolean seeking);
static gboolean gst_flv_demux_query (GstPad * pad, GstQuery * query);
static gboolean gst_flv_demux_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_flv_demux_src_event (GstPad * pad, GstEvent * event);
......@@ -2966,12 +2967,12 @@ gst_flv_demux_src_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_flv_demux_query (GstPad * pad, GstQuery * query)
gst_flv_demux_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = TRUE;
GstFlvDemux *demux;
demux = GST_FLV_DEMUX (gst_pad_get_parent (pad));
demux = GST_FLV_DEMUX (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_DURATION:
......@@ -3056,23 +3057,11 @@ gst_flv_demux_query (GstPad * pad, GstQuery * query)
}
case GST_QUERY_LATENCY:
default:
{
GstPad *peer;
if ((peer = gst_pad_get_peer (demux->sinkpad))) {
/* query latency on peer pad */
res = gst_pad_query (peer, query);
gst_object_unref (peer);
} else {
/* no peer, we don't know */
res = FALSE;
}
res = gst_pad_peer_query (demux->sinkpad, query);
break;
}
}
beach:
gst_object_unref (demux);
return res;
}
......
......@@ -98,7 +98,8 @@ static GstFlowReturn gst_goom_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_goom_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_goom_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_goom_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_goom_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
#define gst_goom_parent_class parent_class
G_DEFINE_TYPE (GstGoom, gst_goom, GST_TYPE_ELEMENT);
......@@ -400,12 +401,12 @@ gst_goom_sink_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_goom_src_query (GstPad * pad, GstQuery * query)
gst_goom_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = FALSE;
GstGoom *goom;
goom = GST_GOOM (GST_PAD_PARENT (pad));
goom = GST_GOOM (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_LATENCY:
......@@ -450,7 +451,7 @@ gst_goom_src_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
......
......@@ -695,10 +695,11 @@ gst_qtdemux_get_duration (GstQTDemux * qtdemux, gint64 * duration)
}
static gboolean
gst_qtdemux_handle_src_query (GstPad * pad, GstQuery * query)
gst_qtdemux_handle_src_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
gboolean res = FALSE;
GstQTDemux *qtdemux = GST_QTDEMUX (gst_pad_get_parent (pad));
GstQTDemux *qtdemux = GST_QTDEMUX (parent);
GST_LOG_OBJECT (pad, "%s query", GST_QUERY_TYPE_NAME (query));
......@@ -771,12 +772,10 @@ gst_qtdemux_handle_src_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
gst_object_unref (qtdemux);
return res;
}
......
......@@ -208,7 +208,7 @@ gst_alaw_dec_getcaps (GstPad * pad, GstCaps * filter)
}
static gboolean
gst_alaw_dec_query (GstPad * pad, GstQuery * query)
gst_alaw_dec_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res;
......@@ -226,7 +226,7 @@ gst_alaw_dec_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
......
......@@ -360,7 +360,7 @@ gst_alaw_enc_getcaps (GstPad * pad, GstCaps * filter)
}
static gboolean
gst_alaw_enc_query (GstPad * pad, GstQuery * query)
gst_alaw_enc_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res;
......@@ -378,7 +378,7 @@ gst_alaw_enc_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
......
......@@ -147,7 +147,7 @@ mulawdec_getcaps (GstPad * pad, GstCaps * filter)
}
static gboolean
gst_mulawdec_query (GstPad * pad, GstQuery * query)
gst_mulawdec_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res;
......@@ -165,7 +165,7 @@ gst_mulawdec_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
......
......@@ -114,7 +114,7 @@ mulawenc_getcaps (GstPad * pad, GstCaps * filter)
}
static gboolean
gst_mulawenc_query (GstPad * pad, GstQuery * query)
gst_mulawenc_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res;
......@@ -132,7 +132,7 @@ gst_mulawenc_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;
......
......@@ -253,7 +253,7 @@ static GstFlowReturn gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad,
GstBuffer * buffer);
static gboolean gst_rtp_jitter_buffer_sink_query (GstPad * pad,
GstQuery * query);
GstObject * parent, GstQuery * query);
/* srcpad overrides */
static gboolean gst_rtp_jitter_buffer_src_event (GstPad * pad,
......@@ -262,7 +262,7 @@ static gboolean
gst_rtp_jitter_buffer_src_activate_push (GstPad * pad, gboolean active);
static void gst_rtp_jitter_buffer_loop (GstRtpJitterBuffer * jitterbuffer);
static gboolean gst_rtp_jitter_buffer_src_query (GstPad * pad,
GstQuery * query);
GstObject * parent, GstQuery * query);
static void
gst_rtp_jitter_buffer_clear_pt_map (GstRtpJitterBuffer * jitterbuffer);
......@@ -2087,15 +2087,11 @@ ignore_buffer:
}
static gboolean
gst_rtp_jitter_buffer_sink_query (GstPad * pad, GstQuery * query)
gst_rtp_jitter_buffer_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
GstRtpJitterBuffer *jitterbuffer;
gboolean res = FALSE;
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
if (G_UNLIKELY (jitterbuffer == NULL))
return FALSE;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CAPS:
{
......@@ -2109,25 +2105,22 @@ gst_rtp_jitter_buffer_sink_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
gst_object_unref (jitterbuffer);
return res;
}
static gboolean
gst_rtp_jitter_buffer_src_query (GstPad * pad, GstQuery * query)
gst_rtp_jitter_buffer_src_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
GstRtpJitterBuffer *jitterbuffer;
GstRtpJitterBufferPrivate *priv;
gboolean res = FALSE;
jitterbuffer = GST_RTP_JITTER_BUFFER (gst_pad_get_parent (pad));
if (G_UNLIKELY (jitterbuffer == NULL))
return FALSE;
jitterbuffer = GST_RTP_JITTER_BUFFER (parent);
priv = jitterbuffer->priv;
switch (GST_QUERY_TYPE (query)) {
......@@ -2174,7 +2167,7 @@ gst_rtp_jitter_buffer_src_query (GstPad * pad, GstQuery * query)
gst_query_parse_position (query, &fmt, NULL);
if (fmt != GST_FORMAT_TIME) {
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
......@@ -2192,7 +2185,7 @@ gst_rtp_jitter_buffer_src_query (GstPad * pad, GstQuery * query)
gst_query_set_position (query, GST_FORMAT_TIME, start + last_out);
res = TRUE;
} else {
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
}
break;
}
......@@ -2208,12 +2201,10 @@ gst_rtp_jitter_buffer_src_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
gst_object_unref (jitterbuffer);
return res;
}
......
......@@ -1598,12 +1598,13 @@ gst_rtp_session_chain_recv_rtcp (GstPad * pad, GstBuffer * buffer)
}
static gboolean
gst_rtp_session_query_send_rtcp_src (GstPad * pad, GstQuery * query)
gst_rtp_session_query_send_rtcp_src (GstPad * pad, GstObject * parent,
GstQuery * query)
{
GstRtpSession *rtpsession;
gboolean ret = FALSE;