mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
add parent to query function
This commit is contained in:
parent
d338e41a85
commit
ee240c1ac0
7 changed files with 40 additions and 47 deletions
|
@ -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_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,
|
static gboolean gst_mpeg2dec_sink_convert (GstPad * pad, GstFormat src_format,
|
||||||
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
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 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
|
#if 0
|
||||||
static const GstFormat *gst_mpeg2dec_get_formats (GstPad * pad);
|
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
|
static gboolean
|
||||||
gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
|
gst_mpeg2dec_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
{
|
{
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
GstMpeg2dec *mpeg2dec;
|
GstMpeg2dec *mpeg2dec;
|
||||||
|
|
||||||
mpeg2dec = GST_MPEG2DEC (GST_PAD_PARENT (pad));
|
mpeg2dec = GST_MPEG2DEC (parent);
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_POSITION:
|
case GST_QUERY_POSITION:
|
||||||
|
@ -1485,17 +1486,12 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
GstFormat rformat;
|
GstFormat rformat;
|
||||||
gint64 total, total_bytes;
|
gint64 total, total_bytes;
|
||||||
GstPad *peer;
|
|
||||||
|
|
||||||
if ((peer = gst_pad_get_peer (mpeg2dec->sinkpad)) == NULL)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
/* save requested format */
|
/* save requested format */
|
||||||
gst_query_parse_duration (query, &format, NULL);
|
gst_query_parse_duration (query, &format, NULL);
|
||||||
|
|
||||||
/* send to peer */
|
/* send to peer */
|
||||||
if ((res = gst_pad_query (peer, query))) {
|
if ((res = gst_pad_peer_query (mpeg2dec->sinkpad, query))) {
|
||||||
gst_object_unref (peer);
|
|
||||||
goto done;
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
GST_LOG_OBJECT (mpeg2dec, "query on peer pad failed, trying bytes");
|
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 */
|
/* query peer for total length in bytes */
|
||||||
gst_query_set_duration (query, GST_FORMAT_BYTES, -1);
|
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_LOG_OBJECT (mpeg2dec, "query on peer pad failed");
|
||||||
gst_object_unref (peer);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
gst_object_unref (peer);
|
|
||||||
|
|
||||||
/* get the returned format */
|
/* get the returned format */
|
||||||
gst_query_parse_duration (query, &rformat, &total_bytes);
|
gst_query_parse_duration (query, &rformat, &total_bytes);
|
||||||
|
@ -1532,7 +1526,7 @@ gst_mpeg2dec_src_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
res = gst_pad_query_default (pad, query);
|
res = gst_pad_query_default (pad, parent, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
|
|
|
@ -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,
|
static gboolean gst_siddec_src_convert (GstPad * pad, GstFormat src_format,
|
||||||
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
||||||
static gboolean gst_siddec_src_event (GstPad * pad, GstEvent * event);
|
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,
|
static void gst_siddec_get_property (GObject * object, guint prop_id,
|
||||||
GValue * value, GParamSpec * pspec);
|
GValue * value, GParamSpec * pspec);
|
||||||
|
@ -625,12 +625,12 @@ gst_siddec_src_event (GstPad * pad, GstEvent * event)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_siddec_src_query (GstPad * pad, GstQuery * query)
|
gst_siddec_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
{
|
{
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
GstSidDec *siddec;
|
GstSidDec *siddec;
|
||||||
|
|
||||||
siddec = GST_SIDDEC (gst_pad_get_parent (pad));
|
siddec = GST_SIDDEC (parent);
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_POSITION:
|
case GST_QUERY_POSITION:
|
||||||
|
@ -649,10 +649,9 @@ gst_siddec_src_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
res = gst_pad_query_default (pad, query);
|
res = gst_pad_query_default (pad, parent, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gst_object_unref (siddec);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 gboolean gst_x264_enc_sink_set_caps (GstPad * pad, GstCaps * caps);
|
||||||
static GstCaps *gst_x264_enc_sink_get_caps (GstPad * pad, GstCaps * filter);
|
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_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 gboolean gst_x264_enc_src_event (GstPad * pad, GstEvent * event);
|
||||||
static GstFlowReturn gst_x264_enc_chain (GstPad * pad, GstBuffer * buf);
|
static GstFlowReturn gst_x264_enc_chain (GstPad * pad, GstBuffer * buf);
|
||||||
static void gst_x264_enc_flush_frames (GstX264Enc * encoder, gboolean send);
|
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
|
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;
|
gboolean ret = FALSE;
|
||||||
GstX264Enc *encoder;
|
|
||||||
|
|
||||||
encoder = GST_X264_ENC (gst_pad_get_parent (pad));
|
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_CAPS:
|
case GST_QUERY_CAPS:
|
||||||
|
@ -1837,10 +1835,9 @@ gst_x264_enc_sink_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ret = gst_pad_query_default (pad, query);
|
ret = gst_pad_query_default (pad, parent, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gst_object_unref (encoder);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,8 @@ static gboolean gst_asf_demux_element_send_event (GstElement * element,
|
||||||
GstEvent * event);
|
GstEvent * event);
|
||||||
static gboolean gst_asf_demux_send_event_unlocked (GstASFDemux * demux,
|
static gboolean gst_asf_demux_send_event_unlocked (GstASFDemux * demux,
|
||||||
GstEvent * event);
|
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 GstFlowReturn gst_asf_demux_chain (GstPad * pad, GstBuffer * buf);
|
||||||
static gboolean gst_asf_demux_sink_event (GstPad * pad, GstEvent * event);
|
static gboolean gst_asf_demux_sink_event (GstPad * pad, GstEvent * event);
|
||||||
static GstFlowReturn gst_asf_demux_process_object (GstASFDemux * demux,
|
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
|
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;
|
GstASFDemux *demux;
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
|
|
||||||
demux = GST_ASF_DEMUX (gst_pad_get_parent (pad));
|
demux = GST_ASF_DEMUX (parent);
|
||||||
|
|
||||||
GST_DEBUG ("handling %s query",
|
GST_DEBUG ("handling %s query",
|
||||||
gst_query_type_get_name (GST_QUERY_TYPE (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;
|
gboolean seekable;
|
||||||
|
|
||||||
/* try downstream first in TIME */
|
/* 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_query_parse_seeking (query, &fmt, &seekable, NULL, NULL);
|
||||||
GST_LOG_OBJECT (demux, "upstream %s seekable %d",
|
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 ... */
|
* but we might end up in a live (rtsp) one ... */
|
||||||
|
|
||||||
/* first forward */
|
/* first forward */
|
||||||
res = gst_pad_query_default (pad, query);
|
res = gst_pad_query_default (pad, parent, query);
|
||||||
if (!res)
|
if (!res)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3995,11 +3997,10 @@ gst_asf_demux_handle_src_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
res = gst_pad_query_default (pad, query);
|
res = gst_pad_query_default (pad, parent, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref (demux);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 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_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_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 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 (GstPad * sinkpad);
|
||||||
static gboolean gst_real_audio_demux_sink_activate_push (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
|
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;
|
GstRealAudioDemux *demux;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
demux = GST_REAL_AUDIO_DEMUX (gst_pad_get_parent (pad));
|
demux = GST_REAL_AUDIO_DEMUX (parent);
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_DURATION:{
|
case GST_QUERY_DURATION:{
|
||||||
|
@ -893,11 +895,10 @@ gst_real_audio_demux_src_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ret = gst_pad_query_default (pad, query);
|
ret = gst_pad_query_default (pad, parent, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref (demux);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,8 @@ static void gst_rdt_manager_set_property (GObject * object,
|
||||||
static void gst_rdt_manager_get_property (GObject * object,
|
static void gst_rdt_manager_get_property (GObject * object,
|
||||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
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,
|
static gboolean gst_rdt_manager_src_activate_push (GstPad * pad,
|
||||||
gboolean active);
|
gboolean active);
|
||||||
|
|
||||||
|
@ -524,12 +525,12 @@ gst_rdt_manager_finalize (GObject * object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rdt_manager_query_src (GstPad * pad, GstQuery * query)
|
gst_rdt_manager_query_src (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
{
|
{
|
||||||
GstRDTManager *rdtmanager;
|
GstRDTManager *rdtmanager;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
rdtmanager = GST_RDT_MANAGER (GST_PAD_PARENT (pad));
|
rdtmanager = GST_RDT_MANAGER (parent);
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_LATENCY:
|
case GST_QUERY_LATENCY:
|
||||||
|
@ -547,7 +548,7 @@ gst_rdt_manager_query_src (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
res = gst_pad_query_default (pad, query);
|
res = gst_pad_query_default (pad, parent, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -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_sink_event (GstPad * pad, GstEvent * event);
|
||||||
static gboolean gst_rmdemux_src_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 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,
|
static gboolean gst_rmdemux_perform_seek (GstRMDemux * rmdemux,
|
||||||
GstEvent * event);
|
GstEvent * event);
|
||||||
|
|
||||||
|
@ -608,12 +609,12 @@ error:
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rmdemux_src_query (GstPad * pad, GstQuery * query)
|
gst_rmdemux_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
{
|
{
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
GstRMDemux *rmdemux;
|
GstRMDemux *rmdemux;
|
||||||
|
|
||||||
rmdemux = GST_RMDEMUX (gst_pad_get_parent (pad));
|
rmdemux = GST_RMDEMUX (parent);
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_POSITION:
|
case GST_QUERY_POSITION:
|
||||||
|
@ -651,11 +652,10 @@ gst_rmdemux_src_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
res = gst_pad_query_default (pad, query);
|
res = gst_pad_query_default (pad, parent, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref (rmdemux);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue