add parent to query function

This commit is contained in:
Wim Taymans 2011-11-16 17:28:56 +01:00
parent d338e41a85
commit ee240c1ac0
7 changed files with 40 additions and 47 deletions

View file

@ -86,7 +86,8 @@ static GstIndex *gst_mpeg2dec_get_index (GstElement * element);
static gboolean gst_mpeg2dec_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_mpeg2dec_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_mpeg2dec_sink_convert (GstPad * pad, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
@ -102,7 +103,7 @@ static GstFlowReturn gst_mpeg2dec_chain (GstPad * pad, GstBuffer * buf);
static void clear_buffers (GstMpeg2dec * mpeg2dec);
//static gboolean gst_mpeg2dec_sink_query (GstPad * pad, GstQuery * query);
//static gboolean gst_mpeg2dec_sink_query (GstPad * pad, GstObject * parent, GstQuery * query);
#if 0
static const GstFormat *gst_mpeg2dec_get_formats (GstPad * pad);
@ -1443,12 +1444,12 @@ gst_mpeg2dec_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
}
static gboolean
gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
gst_mpeg2dec_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = TRUE;
GstMpeg2dec *mpeg2dec;
mpeg2dec = GST_MPEG2DEC (GST_PAD_PARENT (pad));
mpeg2dec = GST_MPEG2DEC (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
@ -1485,17 +1486,12 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
GstFormat format;
GstFormat rformat;
gint64 total, total_bytes;
GstPad *peer;
if ((peer = gst_pad_get_peer (mpeg2dec->sinkpad)) == NULL)
goto error;
/* save requested format */
gst_query_parse_duration (query, &format, NULL);
/* send to peer */
if ((res = gst_pad_query (peer, query))) {
gst_object_unref (peer);
if ((res = gst_pad_peer_query (mpeg2dec->sinkpad, query))) {
goto done;
} else {
GST_LOG_OBJECT (mpeg2dec, "query on peer pad failed, trying bytes");
@ -1504,12 +1500,10 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
/* query peer for total length in bytes */
gst_query_set_duration (query, GST_FORMAT_BYTES, -1);
if (!(res = gst_pad_query (peer, query))) {
if (!(res = gst_pad_peer_query (mpeg2dec->sinkpad, query))) {
GST_LOG_OBJECT (mpeg2dec, "query on peer pad failed");
gst_object_unref (peer);
goto error;
}
gst_object_unref (peer);
/* get the returned format */
gst_query_parse_duration (query, &rformat, &total_bytes);
@ -1532,7 +1526,7 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
done:

View file

@ -133,7 +133,7 @@ static gboolean gst_siddec_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_siddec_src_convert (GstPad * pad, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
static gboolean gst_siddec_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_siddec_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_siddec_src_query (GstPad * pad, GstObject * parent, GstQuery * query);
static void gst_siddec_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
@ -625,12 +625,12 @@ gst_siddec_src_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_siddec_src_query (GstPad * pad, GstQuery * query)
gst_siddec_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = TRUE;
GstSidDec *siddec;
siddec = GST_SIDDEC (gst_pad_get_parent (pad));
siddec = GST_SIDDEC (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
@ -649,10 +649,9 @@ gst_siddec_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 (siddec);
return res;
}

View file

@ -486,7 +486,8 @@ static void gst_x264_enc_close_encoder (GstX264Enc * encoder);
static gboolean gst_x264_enc_sink_set_caps (GstPad * pad, GstCaps * caps);
static GstCaps *gst_x264_enc_sink_get_caps (GstPad * pad, GstCaps * filter);
static gboolean gst_x264_enc_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_x264_enc_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_x264_enc_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_x264_enc_src_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_x264_enc_chain (GstPad * pad, GstBuffer * buf);
static void gst_x264_enc_flush_frames (GstX264Enc * encoder, gboolean send);
@ -1817,12 +1818,9 @@ gst_x264_enc_sink_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_x264_enc_sink_query (GstPad * pad, GstQuery * query)
gst_x264_enc_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean ret = FALSE;
GstX264Enc *encoder;
encoder = GST_X264_ENC (gst_pad_get_parent (pad));
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CAPS:
@ -1837,10 +1835,9 @@ gst_x264_enc_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 (encoder);
return ret;
}

View file

@ -83,7 +83,8 @@ static gboolean gst_asf_demux_element_send_event (GstElement * element,
GstEvent * event);
static gboolean gst_asf_demux_send_event_unlocked (GstASFDemux * demux,
GstEvent * event);
static gboolean gst_asf_demux_handle_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_asf_demux_handle_src_query (GstPad * pad,
GstObject * parent, GstQuery * query);
static GstFlowReturn gst_asf_demux_chain (GstPad * pad, GstBuffer * buf);
static gboolean gst_asf_demux_sink_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_asf_demux_process_object (GstASFDemux * demux,
@ -3849,12 +3850,13 @@ gst_asf_demux_send_event_unlocked (GstASFDemux * demux, GstEvent * event)
}
static gboolean
gst_asf_demux_handle_src_query (GstPad * pad, GstQuery * query)
gst_asf_demux_handle_src_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
GstASFDemux *demux;
gboolean res = FALSE;
demux = GST_ASF_DEMUX (gst_pad_get_parent (pad));
demux = GST_ASF_DEMUX (parent);
GST_DEBUG ("handling %s query",
gst_query_type_get_name (GST_QUERY_TYPE (query)));
@ -3937,7 +3939,7 @@ gst_asf_demux_handle_src_query (GstPad * pad, GstQuery * query)
gboolean seekable;
/* try downstream first in TIME */
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
gst_query_parse_seeking (query, &fmt, &seekable, NULL, NULL);
GST_LOG_OBJECT (demux, "upstream %s seekable %d",
@ -3974,7 +3976,7 @@ gst_asf_demux_handle_src_query (GstPad * pad, GstQuery * query)
* but we might end up in a live (rtsp) one ... */
/* first forward */
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
if (!res)
break;
@ -3995,11 +3997,10 @@ gst_asf_demux_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 (demux);
return res;
}

View file

@ -69,7 +69,8 @@ static GstStateChangeReturn gst_real_audio_demux_change_state (GstElement * e,
static GstFlowReturn gst_real_audio_demux_chain (GstPad * pad, GstBuffer * buf);
static gboolean gst_real_audio_demux_sink_event (GstPad * pad, GstEvent * ev);
static gboolean gst_real_audio_demux_src_event (GstPad * pad, GstEvent * ev);
static gboolean gst_real_audio_demux_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_real_audio_demux_src_query (GstPad * pad,
GstObject * parent, GstQuery * query);
static void gst_real_audio_demux_loop (GstRealAudioDemux * demux);
static gboolean gst_real_audio_demux_sink_activate (GstPad * sinkpad);
static gboolean gst_real_audio_demux_sink_activate_push (GstPad * sinkpad,
@ -859,12 +860,13 @@ gst_real_audio_demux_src_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_real_audio_demux_src_query (GstPad * pad, GstQuery * query)
gst_real_audio_demux_src_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
GstRealAudioDemux *demux;
gboolean ret = FALSE;
demux = GST_REAL_AUDIO_DEMUX (gst_pad_get_parent (pad));
demux = GST_REAL_AUDIO_DEMUX (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_DURATION:{
@ -893,11 +895,10 @@ gst_real_audio_demux_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 (demux);
return ret;
}

View file

@ -120,7 +120,8 @@ static void gst_rdt_manager_set_property (GObject * object,
static void gst_rdt_manager_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static gboolean gst_rdt_manager_query_src (GstPad * pad, GstQuery * query);
static gboolean gst_rdt_manager_query_src (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_rdt_manager_src_activate_push (GstPad * pad,
gboolean active);
@ -524,12 +525,12 @@ gst_rdt_manager_finalize (GObject * object)
}
static gboolean
gst_rdt_manager_query_src (GstPad * pad, GstQuery * query)
gst_rdt_manager_query_src (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstRDTManager *rdtmanager;
gboolean res;
rdtmanager = GST_RDT_MANAGER (GST_PAD_PARENT (pad));
rdtmanager = GST_RDT_MANAGER (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_LATENCY:
@ -547,7 +548,7 @@ gst_rdt_manager_query_src (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
return res;

View file

@ -144,7 +144,8 @@ static gboolean gst_rmdemux_sink_activate_pull (GstPad * sinkpad,
static gboolean gst_rmdemux_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_rmdemux_src_event (GstPad * pad, GstEvent * event);
static void gst_rmdemux_send_event (GstRMDemux * rmdemux, GstEvent * event);
static gboolean gst_rmdemux_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_rmdemux_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_rmdemux_perform_seek (GstRMDemux * rmdemux,
GstEvent * event);
@ -608,12 +609,12 @@ error:
static gboolean
gst_rmdemux_src_query (GstPad * pad, GstQuery * query)
gst_rmdemux_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = FALSE;
GstRMDemux *rmdemux;
rmdemux = GST_RMDEMUX (gst_pad_get_parent (pad));
rmdemux = GST_RMDEMUX (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
@ -651,11 +652,10 @@ gst_rmdemux_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 (rmdemux);
return res;
}