mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
add parent to query function
This commit is contained in:
parent
3c993f1c4a
commit
6d92ecac75
9 changed files with 106 additions and 115 deletions
|
@ -104,8 +104,10 @@ static gboolean gst_ass_render_event_video (GstPad * pad, GstEvent * event);
|
|||
static gboolean gst_ass_render_event_text (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_ass_render_event_src (GstPad * pad, GstEvent * event);
|
||||
|
||||
static gboolean gst_ass_render_query_video (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_ass_render_query_src (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_ass_render_query_video (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query);
|
||||
static gboolean gst_ass_render_query_src (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query);
|
||||
|
||||
/* initialize the plugin's class */
|
||||
static void
|
||||
|
@ -350,9 +352,8 @@ gst_ass_render_change_state (GstElement * element, GstStateChange transition)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_ass_render_query_src (GstPad * pad, GstQuery * query)
|
||||
gst_ass_render_query_src (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||
{
|
||||
GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad));
|
||||
gboolean res = FALSE;
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
|
@ -368,11 +369,10 @@ gst_ass_render_query_src (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 (render);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1288,9 +1288,8 @@ gst_ass_render_event_video (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_ass_render_query_video (GstPad * pad, GstQuery * query)
|
||||
gst_ass_render_query_video (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||
{
|
||||
GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad));
|
||||
gboolean res = FALSE;
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
|
@ -1306,11 +1305,10 @@ gst_ass_render_query_video (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 (render);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,11 +146,11 @@ static gboolean gst_base_video_decoder_src_event (GstPad * pad,
|
|||
static GstFlowReturn gst_base_video_decoder_chain (GstPad * pad,
|
||||
GstBuffer * buf);
|
||||
static gboolean gst_base_video_decoder_sink_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
GstObject * parent, GstQuery * query);
|
||||
static GstStateChangeReturn gst_base_video_decoder_change_state (GstElement *
|
||||
element, GstStateChange transition);
|
||||
static gboolean gst_base_video_decoder_src_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
GstObject * parent, GstQuery * query);
|
||||
static void gst_base_video_decoder_reset (GstBaseVideoDecoder *
|
||||
base_video_decoder, gboolean full);
|
||||
|
||||
|
@ -308,8 +308,8 @@ gst_base_video_decoder_setcaps (GstBaseVideoDecoder * base_video_decoder,
|
|||
}
|
||||
|
||||
if (ret) {
|
||||
gst_buffer_replace (&GST_BASE_VIDEO_CODEC (base_video_decoder)->
|
||||
state.codec_data, NULL);
|
||||
gst_buffer_replace (&GST_BASE_VIDEO_CODEC (base_video_decoder)->state.
|
||||
codec_data, NULL);
|
||||
gst_caps_replace (&GST_BASE_VIDEO_CODEC (base_video_decoder)->state.caps,
|
||||
NULL);
|
||||
GST_BASE_VIDEO_CODEC (base_video_decoder)->state = state;
|
||||
|
@ -695,12 +695,13 @@ convert_error:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_video_decoder_src_query (GstPad * pad, GstQuery * query)
|
||||
gst_base_video_decoder_src_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query)
|
||||
{
|
||||
GstBaseVideoDecoder *dec;
|
||||
gboolean res = TRUE;
|
||||
|
||||
dec = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad));
|
||||
dec = GST_BASE_VIDEO_DECODER (parent);
|
||||
|
||||
GST_LOG_OBJECT (dec, "handling query: %" GST_PTR_FORMAT, query);
|
||||
|
||||
|
@ -745,7 +746,7 @@ gst_base_video_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);
|
||||
|
@ -783,24 +784,26 @@ gst_base_video_decoder_src_query (GstPad * pad, GstQuery * query)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
res = gst_pad_query_default (pad, query);
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
}
|
||||
gst_object_unref (dec);
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
error:
|
||||
GST_ERROR_OBJECT (dec, "query failed");
|
||||
gst_object_unref (dec);
|
||||
return res;
|
||||
{
|
||||
GST_ERROR_OBJECT (dec, "query failed");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_video_decoder_sink_query (GstPad * pad, GstQuery * query)
|
||||
gst_base_video_decoder_sink_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query)
|
||||
{
|
||||
GstBaseVideoDecoder *base_video_decoder;
|
||||
gboolean res = FALSE;
|
||||
|
||||
base_video_decoder = GST_BASE_VIDEO_DECODER (gst_pad_get_parent (pad));
|
||||
base_video_decoder = GST_BASE_VIDEO_DECODER (parent);
|
||||
|
||||
GST_LOG_OBJECT (base_video_decoder, "handling query: %" GST_PTR_FORMAT,
|
||||
query);
|
||||
|
@ -821,16 +824,18 @@ gst_base_video_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;
|
||||
}
|
||||
done:
|
||||
gst_object_unref (base_video_decoder);
|
||||
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
error:
|
||||
GST_DEBUG_OBJECT (base_video_decoder, "query failed");
|
||||
goto done;
|
||||
{
|
||||
GST_DEBUG_OBJECT (base_video_decoder, "query failed");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct _Timestamp Timestamp;
|
||||
|
|
|
@ -122,17 +122,18 @@ static gboolean gst_base_video_encoder_src_event (GstPad * pad,
|
|||
static gboolean gst_base_video_encoder_sink_event (GstPad * pad,
|
||||
GstEvent * event);
|
||||
static gboolean gst_base_video_encoder_sink_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
GstObject * parent, GstQuery * query);
|
||||
static GstFlowReturn gst_base_video_encoder_chain (GstPad * pad,
|
||||
GstBuffer * buf);
|
||||
static GstStateChangeReturn gst_base_video_encoder_change_state (GstElement *
|
||||
element, GstStateChange transition);
|
||||
static gboolean gst_base_video_encoder_src_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
GstObject * parent, GstQuery * query);
|
||||
|
||||
#define gst_base_video_encoder_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstBaseVideoEncoder, gst_base_video_encoder,
|
||||
GST_TYPE_BASE_VIDEO_CODEC, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL););
|
||||
GST_TYPE_BASE_VIDEO_CODEC, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL);
|
||||
);
|
||||
|
||||
static void
|
||||
gst_base_video_encoder_class_init (GstBaseVideoEncoderClass * klass)
|
||||
|
@ -424,7 +425,8 @@ done:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_video_encoder_sink_query (GstPad * pad, GstQuery * query)
|
||||
gst_base_video_encoder_sink_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
|
||||
|
@ -441,7 +443,7 @@ gst_base_video_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;
|
||||
}
|
||||
return res;
|
||||
|
@ -637,14 +639,13 @@ gst_base_video_encoder_src_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_video_encoder_src_query (GstPad * pad, GstQuery * query)
|
||||
gst_base_video_encoder_src_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query)
|
||||
{
|
||||
GstBaseVideoEncoder *enc;
|
||||
gboolean res;
|
||||
GstPad *peerpad;
|
||||
|
||||
enc = GST_BASE_VIDEO_ENCODER (gst_pad_get_parent (pad));
|
||||
peerpad = gst_pad_get_peer (GST_BASE_VIDEO_CODEC_SINK_PAD (enc));
|
||||
enc = GST_BASE_VIDEO_ENCODER (parent);
|
||||
|
||||
GST_LOG_OBJECT (enc, "handling query: %" GST_PTR_FORMAT, query);
|
||||
|
||||
|
@ -668,7 +669,7 @@ gst_base_video_encoder_src_query (GstPad * pad, GstQuery * query)
|
|||
gboolean live;
|
||||
GstClockTime min_latency, max_latency;
|
||||
|
||||
res = gst_pad_query (peerpad, query);
|
||||
res = gst_pad_peer_query (GST_BASE_VIDEO_CODEC_SINK_PAD (enc), query);
|
||||
if (res) {
|
||||
gst_query_parse_latency (query, &live, &min_latency, &max_latency);
|
||||
GST_DEBUG_OBJECT (enc, "Peer latency: live %d, min %"
|
||||
|
@ -687,17 +688,16 @@ gst_base_video_encoder_src_query (GstPad * pad, GstQuery * query)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
res = gst_pad_query_default (pad, query);
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
}
|
||||
gst_object_unref (peerpad);
|
||||
gst_object_unref (enc);
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
error:
|
||||
GST_DEBUG_OBJECT (enc, "query failed");
|
||||
gst_object_unref (peerpad);
|
||||
gst_object_unref (enc);
|
||||
return res;
|
||||
{
|
||||
GST_DEBUG_OBJECT (enc, "query failed");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -77,9 +77,9 @@ static gboolean gst_base_audio_visualizer_sink_event (GstPad * pad,
|
|||
GstEvent * event);
|
||||
|
||||
static gboolean gst_base_audio_visualizer_src_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
GstObject * parent, GstQuery * query);
|
||||
static gboolean gst_base_audio_visualizer_sink_query (GstPad * pad,
|
||||
GstQuery * query);
|
||||
GstObject * parent, GstQuery * query);
|
||||
|
||||
static GstStateChangeReturn gst_base_audio_visualizer_change_state (GstElement *
|
||||
element, GstStateChange transition);
|
||||
|
@ -1026,12 +1026,13 @@ gst_base_audio_visualizer_sink_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_audio_visualizer_src_query (GstPad * pad, GstQuery * query)
|
||||
gst_base_audio_visualizer_src_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
GstBaseAudioVisualizer *scope;
|
||||
|
||||
scope = GST_BASE_AUDIO_VISUALIZER (gst_pad_get_parent (pad));
|
||||
scope = GST_BASE_AUDIO_VISUALIZER (parent);
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_LATENCY:
|
||||
|
@ -1076,35 +1077,24 @@ gst_base_audio_visualizer_src_query (GstPad * pad, GstQuery * query)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
res = gst_pad_peer_query (scope->sinkpad, query);
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
break;
|
||||
}
|
||||
|
||||
gst_object_unref (scope);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_base_audio_visualizer_sink_query (GstPad * pad, GstQuery * query)
|
||||
gst_base_audio_visualizer_sink_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
GstBaseAudioVisualizer *scope;
|
||||
|
||||
scope = GST_BASE_AUDIO_VISUALIZER (gst_pad_get_parent (pad));
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_ALLOCATION:
|
||||
/* we convert audio to video, don't pass allocation queries for audio
|
||||
* through */
|
||||
break;
|
||||
default:
|
||||
res = gst_pad_peer_query (scope->srcpad, query);
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
break;
|
||||
}
|
||||
|
||||
gst_object_unref (scope);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,8 +108,10 @@ static gboolean gst_dvbsub_overlay_event_src (GstPad * pad, GstEvent * event);
|
|||
static void new_dvb_subtitles_cb (DvbSub * dvb_sub, DVBSubtitles * subs,
|
||||
gpointer user_data);
|
||||
|
||||
static gboolean gst_dvbsub_overlay_query_video (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_dvbsub_overlay_query_src (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_dvbsub_overlay_query_video (GstPad * pad,
|
||||
GstObject * parent, GstQuery * query);
|
||||
static gboolean gst_dvbsub_overlay_query_src (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query);
|
||||
|
||||
/* initialize the plugin's class */
|
||||
static void
|
||||
|
@ -324,9 +326,10 @@ gst_dvbsub_overlay_change_state (GstElement * element,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_dvbsub_overlay_query_src (GstPad * pad, GstQuery * query)
|
||||
gst_dvbsub_overlay_query_src (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query)
|
||||
{
|
||||
GstDVBSubOverlay *render = GST_DVBSUB_OVERLAY (gst_pad_get_parent (pad));
|
||||
GstDVBSubOverlay *render = GST_DVBSUB_OVERLAY (parent);
|
||||
gboolean ret;
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
|
@ -346,7 +349,6 @@ gst_dvbsub_overlay_query_src (GstPad * pad, GstQuery * query)
|
|||
break;
|
||||
}
|
||||
|
||||
gst_object_unref (render);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -926,9 +928,9 @@ missing_timestamp:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_dvbsub_overlay_query_video (GstPad * pad, GstQuery * query)
|
||||
gst_dvbsub_overlay_query_video (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query)
|
||||
{
|
||||
GstDVBSubOverlay *render = GST_DVBSUB_OVERLAY (gst_pad_get_parent (pad));
|
||||
gboolean ret;
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
|
@ -944,11 +946,10 @@ gst_dvbsub_overlay_query_video (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 (render);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,14 +91,16 @@ static GstStateChangeReturn gst_dvd_spu_change_state (GstElement * element,
|
|||
GstStateChange transition);
|
||||
|
||||
static gboolean gst_dvd_spu_src_event (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_dvd_spu_src_query (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_dvd_spu_src_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query);
|
||||
|
||||
static GstCaps *gst_dvd_spu_video_proxy_getcaps (GstPad * pad,
|
||||
GstCaps * filter);
|
||||
static gboolean gst_dvd_spu_video_set_caps (GstPad * pad, GstCaps * caps);
|
||||
static GstFlowReturn gst_dvd_spu_video_chain (GstPad * pad, GstBuffer * buf);
|
||||
static gboolean gst_dvd_spu_video_event (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_dvd_spu_video_query (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_dvd_spu_video_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query);
|
||||
static void gst_dvd_spu_redraw_still (GstDVDSpu * dvdspu, gboolean force);
|
||||
|
||||
static void gst_dvd_spu_check_still_updates (GstDVDSpu * dvdspu);
|
||||
|
@ -288,7 +290,7 @@ gst_dvd_spu_src_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_dvd_spu_src_query (GstPad * pad, GstQuery * query)
|
||||
gst_dvd_spu_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
|
||||
|
@ -305,7 +307,7 @@ gst_dvd_spu_src_query (GstPad * pad, GstQuery * query)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
res = gst_pad_query_default (pad, query);
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -495,7 +497,7 @@ error:
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_dvd_spu_video_query (GstPad * pad, GstQuery * query)
|
||||
gst_dvd_spu_video_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
|
||||
|
@ -512,7 +514,7 @@ gst_dvd_spu_video_query (GstPad * pad, GstQuery * query)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
res = gst_pad_query_default (pad, query);
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -115,7 +115,8 @@ static void mpegts_parse_pad_removed (GstElement * element, GstPad * pad);
|
|||
static GstPad *mpegts_parse_request_new_pad (GstElement * element,
|
||||
GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
|
||||
static void mpegts_parse_release_pad (GstElement * element, GstPad * pad);
|
||||
static gboolean mpegts_parse_src_pad_query (GstPad * pad, GstQuery * query);
|
||||
static gboolean mpegts_parse_src_pad_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query);
|
||||
static gboolean push_event (MpegTSBase * base, GstEvent * event);
|
||||
|
||||
#define mpegts_parse_parent_class parent_class
|
||||
|
@ -674,9 +675,9 @@ mpegts_parse_program_stopped (MpegTSBase * base, MpegTSBaseProgram * program)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
mpegts_parse_src_pad_query (GstPad * pad, GstQuery * query)
|
||||
mpegts_parse_src_pad_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||
{
|
||||
MpegTSParse2 *parse = GST_MPEGTS_PARSE (gst_pad_get_parent (pad));
|
||||
MpegTSParse2 *parse = GST_MPEGTS_PARSE (parent);
|
||||
gboolean res;
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
|
@ -699,9 +700,8 @@ mpegts_parse_src_pad_query (GstPad * pad, GstQuery * query)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
res = gst_pad_query_default (pad, query);
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
}
|
||||
gst_object_unref (parse);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,8 @@ enum
|
|||
};
|
||||
|
||||
/* Pad functions */
|
||||
static gboolean gst_ts_demux_srcpad_query (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_ts_demux_srcpad_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query);
|
||||
|
||||
|
||||
/* mpegtsbase methods */
|
||||
|
@ -368,14 +369,14 @@ gst_ts_demux_get_property (GObject * object, guint prop_id,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_ts_demux_srcpad_query (GstPad * pad, GstQuery * query)
|
||||
gst_ts_demux_srcpad_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||
{
|
||||
gboolean res = TRUE;
|
||||
GstFormat format;
|
||||
GstTSDemux *demux;
|
||||
MpegTSBase *base;
|
||||
|
||||
demux = GST_TS_DEMUX (gst_pad_get_parent (pad));
|
||||
demux = GST_TS_DEMUX (parent);
|
||||
base = GST_MPEGTS_BASE (demux);
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
|
@ -412,10 +413,9 @@ gst_ts_demux_srcpad_query (GstPad * pad, GstQuery * query)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
res = gst_pad_query_default (pad, query);
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
}
|
||||
|
||||
gst_object_unref (demux);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
|
|
@ -59,7 +59,8 @@ static GstFlowReturn gst_y4m_dec_chain (GstPad * pad, GstBuffer * buffer);
|
|||
static gboolean gst_y4m_dec_sink_event (GstPad * pad, GstEvent * event);
|
||||
|
||||
static gboolean gst_y4m_dec_src_event (GstPad * pad, GstEvent * event);
|
||||
static gboolean gst_y4m_dec_src_query (GstPad * pad, GstQuery * query);
|
||||
static gboolean gst_y4m_dec_src_query (GstPad * pad, GstObject * parent,
|
||||
GstQuery * query);
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_y4m_dec_change_state (GstElement * element, GstStateChange transition);
|
||||
|
@ -647,16 +648,16 @@ gst_y4m_dec_src_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_y4m_dec_src_query (GstPad * pad, GstQuery * query)
|
||||
gst_y4m_dec_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||
{
|
||||
GstY4mDec *y4mdec = GST_Y4M_DEC (gst_pad_get_parent (pad));
|
||||
GstY4mDec *y4mdec = GST_Y4M_DEC (parent);
|
||||
gboolean res = FALSE;
|
||||
|
||||
switch (GST_QUERY_TYPE (query)) {
|
||||
case GST_QUERY_DURATION:
|
||||
{
|
||||
GstFormat format;
|
||||
GstPad *peer;
|
||||
GstQuery *peer_query;
|
||||
|
||||
GST_DEBUG ("duration query");
|
||||
|
||||
|
@ -669,39 +670,33 @@ gst_y4m_dec_src_query (GstPad * pad, GstQuery * query)
|
|||
break;
|
||||
}
|
||||
|
||||
peer = gst_pad_get_peer (y4mdec->sinkpad);
|
||||
if (peer) {
|
||||
GstQuery *peer_query = gst_query_new_duration (GST_FORMAT_BYTES);
|
||||
peer_query = gst_query_new_duration (GST_FORMAT_BYTES);
|
||||
|
||||
res = gst_pad_query (peer, peer_query);
|
||||
if (res) {
|
||||
gint64 duration;
|
||||
int n_frames;
|
||||
res = gst_pad_peer_query (y4mdec->sinkpad, peer_query);
|
||||
if (res) {
|
||||
gint64 duration;
|
||||
int n_frames;
|
||||
|
||||
gst_query_parse_duration (peer_query, &format, &duration);
|
||||
gst_query_parse_duration (peer_query, &format, &duration);
|
||||
|
||||
n_frames = gst_y4m_dec_bytes_to_frames (y4mdec, duration);
|
||||
GST_DEBUG ("duration in frames %d", n_frames);
|
||||
n_frames = gst_y4m_dec_bytes_to_frames (y4mdec, duration);
|
||||
GST_DEBUG ("duration in frames %d", n_frames);
|
||||
|
||||
duration = gst_y4m_dec_frames_to_timestamp (y4mdec, n_frames);
|
||||
GST_DEBUG ("duration in time %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (duration));
|
||||
duration = gst_y4m_dec_frames_to_timestamp (y4mdec, n_frames);
|
||||
GST_DEBUG ("duration in time %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (duration));
|
||||
|
||||
gst_query_set_duration (query, GST_FORMAT_TIME, duration);
|
||||
res = TRUE;
|
||||
}
|
||||
|
||||
gst_query_unref (peer_query);
|
||||
gst_object_unref (peer);
|
||||
gst_query_set_duration (query, GST_FORMAT_TIME, duration);
|
||||
res = TRUE;
|
||||
}
|
||||
gst_query_unref (peer_query);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = gst_pad_query_default (pad, query);
|
||||
res = gst_pad_query_default (pad, parent, query);
|
||||
break;
|
||||
}
|
||||
|
||||
gst_object_unref (y4mdec);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue