Commit 2202511e authored by Wim Taymans's avatar Wim Taymans

add parent to query function

parent 94ac7e85
......@@ -133,7 +133,8 @@ static GstFlowReturn gst_visual_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_visual_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_visual_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_visual_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_visual_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_visual_sink_setcaps (GstPad * pad, GstCaps * caps);
static GstCaps *gst_visual_getcaps (GstPad * pad, GstCaps * filter);
......@@ -593,12 +594,12 @@ gst_visual_src_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_visual_src_query (GstPad * pad, GstQuery * query)
gst_visual_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res;
GstVisual *visual;
visual = GST_VISUAL (GST_PAD_PARENT (pad));
visual = GST_VISUAL (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_LATENCY:
......@@ -651,7 +652,7 @@ gst_visual_src_query (GstPad * pad, GstQuery * query)
res = TRUE;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
......@@ -896,8 +897,8 @@ gst_visual_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
visual->actor =
visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->info->
plugname);
visual_actor_new (GST_VISUAL_GET_CLASS (visual)->plugin->
info->plugname);
visual->video = visual_video_new ();
visual->audio = visual_audio_new ();
/* can't have a play without actors */
......
......@@ -131,7 +131,8 @@ static gboolean gst_ogg_demux_receive_event (GstElement * element,
static void gst_ogg_pad_dispose (GObject * object);
static void gst_ogg_pad_finalize (GObject * object);
static gboolean gst_ogg_pad_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_ogg_pad_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_ogg_pad_event (GstPad * pad, GstEvent * event);
static GstOggPad *gst_ogg_chain_get_stream (GstOggChain * chain,
guint32 serialno);
......@@ -239,12 +240,12 @@ gst_ogg_pad_finalize (GObject * object)
}
static gboolean
gst_ogg_pad_src_query (GstPad * pad, GstQuery * query)
gst_ogg_pad_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = TRUE;
GstOggDemux *ogg;
ogg = GST_OGG_DEMUX (gst_pad_get_parent (pad));
ogg = GST_OGG_DEMUX (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_DURATION:
......@@ -336,11 +337,10 @@ gst_ogg_pad_src_query (GstPad * pad, GstQuery * query)
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
done:
gst_object_unref (ogg);
return res;
......
......@@ -152,7 +152,8 @@ static void gst_ogm_audio_parse_init (GstOgmParse * ogm);
static void gst_ogm_text_parse_init (GstOgmParse * ogm);
static gboolean gst_ogm_parse_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_ogm_parse_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_ogm_parse_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_ogm_parse_sink_convert (GstPad * pad, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
......@@ -454,9 +455,9 @@ gst_ogm_parse_sink_convert (GstPad * pad,
}
static gboolean
gst_ogm_parse_sink_query (GstPad * pad, GstQuery * query)
gst_ogm_parse_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstOgmParse *ogm = GST_OGM_PARSE (gst_pad_get_parent (pad));
GstOgmParse *ogm = GST_OGM_PARSE (parent);
GstFormat format;
gboolean res = FALSE;
......@@ -491,11 +492,10 @@ gst_ogm_parse_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 (ogm);
return res;
}
......
......@@ -315,12 +315,12 @@ static gboolean gst_base_text_overlay_setcaps_txt (GstBaseTextOverlay * overlay,
static gboolean gst_base_text_overlay_src_event (GstPad * pad,
GstEvent * event);
static gboolean gst_base_text_overlay_src_query (GstPad * pad,
GstQuery * query);
GstObject * parent, GstQuery * query);
static gboolean gst_base_text_overlay_video_event (GstPad * pad,
GstEvent * event);
static gboolean gst_base_text_overlay_video_query (GstPad * pad,
GstQuery * query);
GstObject * parent, GstQuery * query);
static GstFlowReturn gst_base_text_overlay_video_chain (GstPad * pad,
GstBuffer * buffer);
......@@ -993,14 +993,13 @@ gst_base_text_overlay_get_property (GObject * object, guint prop_id,
}
static gboolean
gst_base_text_overlay_src_query (GstPad * pad, GstQuery * query)
gst_base_text_overlay_src_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
gboolean ret = FALSE;
GstBaseTextOverlay *overlay = NULL;
overlay = GST_BASE_TEXT_OVERLAY (gst_pad_get_parent (pad));
if (G_UNLIKELY (!overlay))
return FALSE;
overlay = GST_BASE_TEXT_OVERLAY (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CAPS:
......@@ -1019,8 +1018,6 @@ gst_base_text_overlay_src_query (GstPad * pad, GstQuery * query)
break;
}
gst_object_unref (overlay);
return ret;
}
......@@ -2326,15 +2323,10 @@ gst_base_text_overlay_video_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_base_text_overlay_video_query (GstPad * pad, GstQuery * query)
gst_base_text_overlay_video_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
gboolean ret = FALSE;
GstBaseTextOverlay *overlay = NULL;
overlay = GST_BASE_TEXT_OVERLAY (gst_pad_get_parent (pad));
if (G_UNLIKELY (!overlay)) {
return FALSE;
}
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CAPS:
......@@ -2349,12 +2341,10 @@ gst_base_text_overlay_video_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 (overlay);
return ret;
}
......
......@@ -97,10 +97,10 @@ static GstFlowReturn theora_dec_chain (GstPad * pad, GstBuffer * buffer);
static GstStateChangeReturn theora_dec_change_state (GstElement * element,
GstStateChange transition);
static gboolean theora_dec_src_event (GstPad * pad, GstEvent * event);
static gboolean theora_dec_src_query (GstPad * pad, GstQuery * query);
static gboolean theora_dec_src_convert (GstPad * pad,
GstFormat src_format, gint64 src_value,
GstFormat * dest_format, gint64 * dest_value);
static gboolean theora_dec_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean theora_dec_src_convert (GstPad * pad, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
#if 0
static const GstFormat *theora_get_formats (GstPad * pad);
......@@ -432,13 +432,12 @@ no_header:
#endif
static gboolean
theora_dec_src_query (GstPad * pad, GstQuery * query)
theora_dec_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstTheoraDec *dec;
gboolean res = FALSE;
dec = GST_THEORA_DEC (gst_pad_get_parent (pad));
dec = GST_THEORA_DEC (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
......@@ -492,11 +491,10 @@ theora_dec_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:
gst_object_unref (dec);
return res;
......
......@@ -253,7 +253,8 @@ static gboolean theora_enc_src_event (GstPad * pad, GstEvent * event);
static GstFlowReturn theora_enc_chain (GstPad * pad, GstBuffer * buffer);
static GstStateChangeReturn theora_enc_change_state (GstElement * element,
GstStateChange transition);
static gboolean theora_enc_sink_query (GstPad * pad, GstQuery * query);
static gboolean theora_enc_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean theora_enc_sink_setcaps (GstTheoraEnc * enc, GstCaps * caps);
static void theora_enc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
......@@ -656,7 +657,7 @@ theora_enc_sink_getcaps (GstPad * pad, GstCaps * filter)
}
static gboolean
theora_enc_sink_query (GstPad * pad, GstQuery * query)
theora_enc_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gboolean res = FALSE;
......@@ -673,7 +674,7 @@ theora_enc_sink_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
......
......@@ -98,7 +98,8 @@ static GstFlowReturn theora_parse_chain (GstPad * pad, GstBuffer * buffer);
static GstStateChangeReturn theora_parse_change_state (GstElement * element,
GstStateChange transition);
static gboolean theora_parse_sink_event (GstPad * pad, GstEvent * event);
static gboolean theora_parse_src_query (GstPad * pad, GstQuery * query);
static gboolean theora_parse_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static void
gst_theora_parse_class_init (GstTheoraParseClass * klass)
......@@ -801,13 +802,12 @@ no_header:
}
static gboolean
theora_parse_src_query (GstPad * pad, GstQuery * query)
theora_parse_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstTheoraParse *parse;
gboolean res = FALSE;
parse = GST_THEORA_PARSE (gst_pad_get_parent (pad));
parse = GST_THEORA_PARSE (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
......@@ -872,11 +872,10 @@ theora_parse_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:
gst_object_unref (parse);
return res;
......
......@@ -79,10 +79,10 @@ static GstFlowReturn vorbis_parse_chain (GstPad * pad, GstBuffer * buffer);
static GstStateChangeReturn vorbis_parse_change_state (GstElement * element,
GstStateChange transition);
static gboolean vorbis_parse_sink_event (GstPad * pad, GstEvent * event);
static gboolean vorbis_parse_src_query (GstPad * pad, GstQuery * query);
static gboolean vorbis_parse_convert (GstPad * pad,
GstFormat src_format, gint64 src_value,
GstFormat * dest_format, gint64 * dest_value);
static gboolean vorbis_parse_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean vorbis_parse_convert (GstPad * pad, GstFormat src_format,
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
static GstFlowReturn vorbis_parse_parse_packet (GstVorbisParse * parse,
GstBuffer * buf);
......@@ -545,13 +545,13 @@ vorbis_parse_convert (GstPad * pad,
}
static gboolean
vorbis_parse_src_query (GstPad * pad, GstQuery * query)
vorbis_parse_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
gint64 granulepos;
GstVorbisParse *parse;
gboolean res = FALSE;
parse = GST_VORBIS_PARSE (GST_PAD_PARENT (pad));
parse = GST_VORBIS_PARSE (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:
......@@ -590,7 +590,7 @@ vorbis_parse_src_query (GstPad * pad, GstQuery * query)
parse->sinkpad);
goto error;
}
if (!(res = gst_pad_query (GST_PAD_PEER (parse->sinkpad), query)))
if (!(res = gst_pad_peer_query (parse->sinkpad, query)))
goto error;
break;
}
......@@ -608,7 +608,7 @@ vorbis_parse_src_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;
......
......@@ -282,8 +282,10 @@ static gboolean gst_audio_decoder_sink_setcaps (GstAudioDecoder * dec,
GstCaps * caps);
gboolean gst_audio_decoder_src_setcaps (GstAudioDecoder * dec, GstCaps * caps);
static GstFlowReturn gst_audio_decoder_chain (GstPad * pad, GstBuffer * buf);
static gboolean gst_audio_decoder_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_audio_decoder_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_audio_decoder_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_audio_decoder_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static void gst_audio_decoder_reset (GstAudioDecoder * dec, gboolean full);
static GstElementClass *parent_class = NULL;
......@@ -1730,12 +1732,13 @@ exit:
}
static gboolean
gst_audio_decoder_sink_query (GstPad * pad, GstQuery * query)
gst_audio_decoder_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
gboolean res = TRUE;
gboolean res = FALSE;
GstAudioDecoder *dec;
dec = GST_AUDIO_DECODER (gst_pad_get_parent (pad));
dec = GST_AUDIO_DECODER (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_FORMATS:
......@@ -1758,12 +1761,11 @@ gst_audio_decoder_sink_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
error:
gst_object_unref (dec);
return res;
}
......@@ -1772,17 +1774,12 @@ error:
* segment stuff etc at all
* Supposedly that's backward compatibility ... */
static gboolean
gst_audio_decoder_src_query (GstPad * pad, GstQuery * query)
gst_audio_decoder_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstAudioDecoder *dec;
GstPad *peerpad;
gboolean res = FALSE;
dec = GST_AUDIO_DECODER (GST_PAD_PARENT (pad));
if (G_UNLIKELY (dec == NULL))
return FALSE;
peerpad = gst_pad_get_peer (GST_PAD (dec->sinkpad));
dec = GST_AUDIO_DECODER (parent);
GST_LOG_OBJECT (dec, "handling query: %" GST_PTR_FORMAT, query);
......@@ -1792,7 +1789,7 @@ gst_audio_decoder_src_query (GstPad * pad, GstQuery * query)
GstFormat format;
/* upstream in any case */
if ((res = gst_pad_query_default (pad, query)))
if ((res = gst_pad_query_default (pad, parent, query)))
break;
gst_query_parse_duration (query, &format, NULL);
......@@ -1886,11 +1883,10 @@ gst_audio_decoder_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 (peerpad);
return res;
}
......
......@@ -303,8 +303,10 @@ static gboolean gst_audio_encoder_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_audio_encoder_sink_setcaps (GstAudioEncoder * enc,
GstCaps * caps);
static GstFlowReturn gst_audio_encoder_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_audio_encoder_src_query (GstPad * pad, GstQuery * query);
static gboolean gst_audio_encoder_sink_query (GstPad * pad, GstQuery * query);
static gboolean gst_audio_encoder_src_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static gboolean gst_audio_encoder_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static void
gst_audio_encoder_class_init (GstAudioEncoderClass * klass)
......@@ -1361,12 +1363,13 @@ gst_audio_encoder_sink_event (GstPad * pad, GstEvent * event)
}
static gboolean
gst_audio_encoder_sink_query (GstPad * pad, GstQuery * query)
gst_audio_encoder_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
gboolean res = FALSE;
GstAudioEncoder *enc;
enc = GST_AUDIO_ENCODER (gst_pad_get_parent (pad));
enc = GST_AUDIO_ENCODER (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_FORMATS:
......@@ -1406,13 +1409,11 @@ gst_audio_encoder_sink_query (GstPad * pad, GstQuery * query)
break;
}
default:
res = gst_pad_query_default (pad, query);
res = gst_pad_query_default (pad, parent, query);
break;
}
error:
gst_object_unref (enc);
return res;
}
......@@ -1494,17 +1495,12 @@ exit:
* segment stuff etc at all
* Supposedly that's backward compatibility ... */
static gboolean
gst_audio_encoder_src_query (GstPad * pad, GstQuery * query)
gst_audio_encoder_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstAudioEncoder *enc;
GstPad *peerpad;
gboolean res = FALSE;
enc = GST_AUDIO_ENCODER (GST_PAD_PARENT (pad));
if (G_UNLIKELY (enc == NULL))
return FALSE;
peerpad = gst_pad_get_peer (GST_PAD (enc->sinkpad));
enc = GST_AUDIO_ENCODER (parent);
GST_LOG_OBJECT (enc, "handling query: %" GST_PTR_FORMAT, query);
......@@ -1519,17 +1515,14 @@ gst_audio_encoder_src_query (GstPad * pad, GstQuery * query)
break;
}
if (!peerpad) {
GST_LOG_OBJECT (enc, "no peer");
break;
}
gst_query_parse_position (query, &req_fmt, NULL);
fmt = GST_FORMAT_TIME;
if (!(res = gst_pad_query_position (peerpad, fmt, &pos)))
if (!(res = gst_pad_peer_query_position (enc->sinkpad, fmt, &pos)))
break;
if ((res = gst_pad_query_convert (peerpad, fmt, pos, req_fmt, &val))) {
if ((res =
gst_pad_peer_query_convert (enc->sinkpad, fmt, pos, req_fmt,
&val))) {
gst_query_set_position (query, req_fmt, val);
}
break;
......@@ -1544,17 +1537,14 @@ gst_audio_encoder_src_query (GstPad * pad, GstQuery * query)
break;
}
if (!peerpad) {
GST_LOG_OBJECT (enc, "no peer");
break;
}
gst_query_parse_duration (query, &req_fmt, NULL);
fmt = GST_FORMAT_TIME;
if (!(res = gst_pad_query_duration (peerpad, fmt, &dur)))
if (!(res = gst_pad_peer_query_duration (enc->sinkpad, fmt, &dur)))
break;
if ((res = gst_pad_query_convert (peerpad, fmt, dur, req_fmt, &val))) {
if ((res =
gst_pad_peer_query_convert (enc->sinkpad, fmt, dur, req_fmt,
&val))) {
gst_query_set_duration (query, req_fmt, val);
}
break;
......@@ -1602,11 +1592,10 @@ gst_audio_encoder_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 (peerpad);
return res;
}
......
......@@ -105,7 +105,8 @@ static gboolean gst_rtp_base_payload_sink_event (GstPad * pad,
GstEvent * event);
static gboolean gst_rtp_base_payload_query_default (GstRTPBasePayload *
rtpbasepayload, GstPad * pad, GstQuery * query);
static gboolean gst_rtp_base_payload_query (GstPad * pad, GstQuery * query);
static gboolean gst_rtp_base_payload_query (GstPad * pad, GstObject * parent,
GstQuery * query);
static GstFlowReturn gst_rtp_base_payload_chain (GstPad * pad,
GstBuffer * buffer);
......@@ -439,31 +440,26 @@ gst_rtp_base_payload_query_default (GstRTPBasePayload * rtpbasepayload,
break;
}
default:
res = gst_pad_query_default (pad, query);
res =
gst_pad_query_default (pad, GST_OBJECT_CAST (rtpbasepayload), query);
break;
}
return res;
}
static gboolean
gst_rtp_base_payload_query (GstPad * pad, GstQuery * query)
gst_rtp_base_payload_query (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstRTPBasePayload *rtpbasepayload;
GstRTPBasePayloadClass *rtpbasepayload_class;
gboolean res = FALSE;
rtpbasepayload = GST_RTP_BASE_PAYLOAD (gst_pad_get_parent (pad));
if (G_UNLIKELY (rtpbasepayload == NULL)) {
return FALSE;
}
rtpbasepayload = GST_RTP_BASE_PAYLOAD (parent);
rtpbasepayload_class = GST_RTP_BASE_PAYLOAD_GET_CLASS (rtpbasepayload);
if (rtpbasepayload_class->query)
res = rtpbasepayload_class->query (rtpbasepayload, pad, query);
gst_object_unref (rtpbasepayload);
return res;
}
......@@ -862,8 +858,8 @@ gst_rtp_base_payload_prepare_push (GstRTPBasePayload * payload,
(is_list) ? -1 : gst_buffer_get_size (GST_BUFFER (obj)),
payload->seqnum, data.rtptime, GST_TIME_ARGS (data.timestamp));
if (g_atomic_int_compare_and_exchange (&payload->
priv->notified_first_timestamp, 1, 0)) {
if (g_atomic_int_compare_and_exchange (&payload->priv->
notified_first_timestamp, 1, 0)) {
g_object_notify (G_OBJECT (payload), "timestamp");
g_object_notify (G_OBJECT (payload), "seqnum");
}
......
......@@ -151,7 +151,8 @@ static gboolean gst_tag_demux_srcpad_event (GstPad * pad, GstEvent * event);
static gboolean gst_tag_demux_sink_activate (GstPad * sinkpad);