mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
gst: udpate for position/duration/convert query API changes
This commit is contained in:
parent
f94ea7299a
commit
b843f8f99c
10 changed files with 50 additions and 92 deletions
|
@ -1184,10 +1184,9 @@ gst_flac_parse_generate_headers (GstFlacParse * flacparse)
|
||||||
|
|
||||||
{
|
{
|
||||||
gint64 duration;
|
gint64 duration;
|
||||||
GstFormat fmt = GST_FORMAT_TIME;
|
|
||||||
|
|
||||||
if (gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (GST_BASE_PARSE
|
if (gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (flacparse),
|
||||||
(flacparse)), &fmt, &duration) && fmt == GST_FORMAT_TIME) {
|
GST_FORMAT_TIME, &duration)) {
|
||||||
duration = GST_CLOCK_TIME_TO_FRAMES (duration, flacparse->samplerate);
|
duration = GST_CLOCK_TIME_TO_FRAMES (duration, flacparse->samplerate);
|
||||||
|
|
||||||
data[17] |= (duration >> 32) & 0xff;
|
data[17] |= (duration >> 32) & 0xff;
|
||||||
|
|
|
@ -582,7 +582,6 @@ gst_mpeg_audio_parse_handle_first_frame (GstMpegAudioParse * mp3parse,
|
||||||
gint offset_xing, offset_vbri;
|
gint offset_xing, offset_vbri;
|
||||||
guint64 avail;
|
guint64 avail;
|
||||||
gint64 upstream_total_bytes = 0;
|
gint64 upstream_total_bytes = 0;
|
||||||
GstFormat fmt = GST_FORMAT_BYTES;
|
|
||||||
guint32 read_id_xing = 0, read_id_vbri = 0;
|
guint32 read_id_xing = 0, read_id_vbri = 0;
|
||||||
guint8 *data, *origdata;
|
guint8 *data, *origdata;
|
||||||
gsize bufsize;
|
gsize bufsize;
|
||||||
|
@ -623,9 +622,8 @@ gst_mpeg_audio_parse_handle_first_frame (GstMpegAudioParse * mp3parse,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* obtain real upstream total bytes */
|
/* obtain real upstream total bytes */
|
||||||
fmt = GST_FORMAT_BYTES;
|
if (!gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (mp3parse),
|
||||||
if (!gst_pad_query_peer_duration (GST_BASE_PARSE_SINK_PAD (GST_BASE_PARSE
|
GST_FORMAT_BYTES, &upstream_total_bytes))
|
||||||
(mp3parse)), &fmt, &upstream_total_bytes))
|
|
||||||
upstream_total_bytes = 0;
|
upstream_total_bytes = 0;
|
||||||
|
|
||||||
if (read_id_xing == xing_id || read_id_xing == info_id) {
|
if (read_id_xing == xing_id || read_id_xing == info_id) {
|
||||||
|
|
|
@ -533,12 +533,12 @@ gst_au_parse_src_query (GstPad * pad, GstQuery * query)
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_DURATION:{
|
case GST_QUERY_DURATION:{
|
||||||
GstFormat bformat = GST_FORMAT_BYTES;
|
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
gint64 len, val;
|
gint64 len, val;
|
||||||
|
|
||||||
gst_query_parse_duration (query, &format, NULL);
|
gst_query_parse_duration (query, &format, NULL);
|
||||||
if (!gst_pad_query_peer_duration (auparse->sinkpad, &bformat, &len)) {
|
if (!gst_pad_query_peer_duration (auparse->sinkpad, GST_FORMAT_BYTES,
|
||||||
|
&len)) {
|
||||||
GST_DEBUG_OBJECT (auparse, "failed to query upstream length");
|
GST_DEBUG_OBJECT (auparse, "failed to query upstream length");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -546,7 +546,9 @@ gst_au_parse_src_query (GstPad * pad, GstQuery * query)
|
||||||
len -= auparse->offset;
|
len -= auparse->offset;
|
||||||
GST_OBJECT_UNLOCK (auparse);
|
GST_OBJECT_UNLOCK (auparse);
|
||||||
|
|
||||||
ret = gst_au_parse_src_convert (auparse, bformat, len, format, &val);
|
ret =
|
||||||
|
gst_au_parse_src_convert (auparse, GST_FORMAT_BYTES, len, format,
|
||||||
|
&val);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
gst_query_set_duration (query, format, val);
|
gst_query_set_duration (query, format, val);
|
||||||
|
@ -554,12 +556,12 @@ gst_au_parse_src_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_QUERY_POSITION:{
|
case GST_QUERY_POSITION:{
|
||||||
GstFormat bformat = GST_FORMAT_BYTES;
|
|
||||||
GstFormat format;
|
GstFormat format;
|
||||||
gint64 pos, val;
|
gint64 pos, val;
|
||||||
|
|
||||||
gst_query_parse_position (query, &format, NULL);
|
gst_query_parse_position (query, &format, NULL);
|
||||||
if (!gst_pad_query_peer_position (auparse->sinkpad, &bformat, &pos)) {
|
if (!gst_pad_query_peer_position (auparse->sinkpad, GST_FORMAT_BYTES,
|
||||||
|
&pos)) {
|
||||||
GST_DEBUG_OBJECT (auparse, "failed to query upstream position");
|
GST_DEBUG_OBJECT (auparse, "failed to query upstream position");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -531,7 +531,7 @@ gst_avi_demux_handle_src_query (GstPad * pad, GstQuery * query)
|
||||||
if (stream->idx_n >= 0)
|
if (stream->idx_n >= 0)
|
||||||
gst_query_set_duration (query, fmt, stream->idx_n);
|
gst_query_set_duration (query, fmt, stream->idx_n);
|
||||||
else if (gst_pad_query_convert (pad, GST_FORMAT_TIME,
|
else if (gst_pad_query_convert (pad, GST_FORMAT_TIME,
|
||||||
duration, &fmt, &dur))
|
duration, fmt, &dur))
|
||||||
gst_query_set_duration (query, fmt, dur);
|
gst_query_set_duration (query, fmt, dur);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2931,7 +2931,6 @@ gst_avi_demux_stream_scan (GstAviDemux * avi)
|
||||||
{
|
{
|
||||||
GstFlowReturn res;
|
GstFlowReturn res;
|
||||||
GstAviStream *stream;
|
GstAviStream *stream;
|
||||||
GstFormat format;
|
|
||||||
guint64 pos = 0;
|
guint64 pos = 0;
|
||||||
guint64 length;
|
guint64 length;
|
||||||
gint64 tmplength;
|
gint64 tmplength;
|
||||||
|
@ -2944,8 +2943,7 @@ gst_avi_demux_stream_scan (GstAviDemux * avi)
|
||||||
GST_DEBUG_OBJECT (avi, "Creating index");
|
GST_DEBUG_OBJECT (avi, "Creating index");
|
||||||
|
|
||||||
/* get the size of the file */
|
/* get the size of the file */
|
||||||
format = GST_FORMAT_BYTES;
|
if (!gst_pad_query_peer_duration (avi->sinkpad, GST_FORMAT_BYTES, &tmplength))
|
||||||
if (!gst_pad_query_peer_duration (avi->sinkpad, &format, &tmplength))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
length = tmplength;
|
length = tmplength;
|
||||||
|
|
||||||
|
@ -3107,10 +3105,8 @@ gst_avi_demux_check_seekability (GstAviDemux * avi)
|
||||||
|
|
||||||
/* try harder to query upstream size if we didn't get it the first time */
|
/* try harder to query upstream size if we didn't get it the first time */
|
||||||
if (seekable && stop == -1) {
|
if (seekable && stop == -1) {
|
||||||
GstFormat fmt = GST_FORMAT_BYTES;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (avi, "doing duration query to fix up unset stop");
|
GST_DEBUG_OBJECT (avi, "doing duration query to fix up unset stop");
|
||||||
gst_pad_query_peer_duration (avi->sinkpad, &fmt, &stop);
|
gst_pad_query_peer_duration (avi->sinkpad, GST_FORMAT_BYTES, &stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if upstream doesn't know the size, it's likely that it's not seekable in
|
/* if upstream doesn't know the size, it's likely that it's not seekable in
|
||||||
|
@ -3983,7 +3979,7 @@ gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment)
|
||||||
GstAviStream *stream;
|
GstAviStream *stream;
|
||||||
|
|
||||||
seek_time = segment->position;
|
seek_time = segment->position;
|
||||||
keyframe = !!(segment->flags & GST_SEEK_FLAG_KEY_UNIT);
|
keyframe = ! !(segment->flags & GST_SEEK_FLAG_KEY_UNIT);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (avi, "seek to: %" GST_TIME_FORMAT
|
GST_DEBUG_OBJECT (avi, "seek to: %" GST_TIME_FORMAT
|
||||||
" keyframe seeking:%d", GST_TIME_ARGS (seek_time), keyframe);
|
" keyframe seeking:%d", GST_TIME_ARGS (seek_time), keyframe);
|
||||||
|
@ -4070,17 +4066,16 @@ gst_avi_demux_handle_seek (GstAviDemux * avi, GstPad * pad, GstEvent * event)
|
||||||
/* we have to have a format as the segment format. Try to convert
|
/* we have to have a format as the segment format. Try to convert
|
||||||
* if not. */
|
* if not. */
|
||||||
if (format != GST_FORMAT_TIME) {
|
if (format != GST_FORMAT_TIME) {
|
||||||
GstFormat fmt = GST_FORMAT_TIME;
|
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
|
|
||||||
if (cur_type != GST_SEEK_TYPE_NONE)
|
if (cur_type != GST_SEEK_TYPE_NONE)
|
||||||
res = gst_pad_query_convert (pad, format, cur, &fmt, &cur);
|
res = gst_pad_query_convert (pad, format, cur, GST_FORMAT_TIME, &cur);
|
||||||
if (res && stop_type != GST_SEEK_TYPE_NONE)
|
if (res && stop_type != GST_SEEK_TYPE_NONE)
|
||||||
res = gst_pad_query_convert (pad, format, stop, &fmt, &stop);
|
res = gst_pad_query_convert (pad, format, stop, GST_FORMAT_TIME, &stop);
|
||||||
if (!res)
|
if (!res)
|
||||||
goto no_format;
|
goto no_format;
|
||||||
|
|
||||||
format = fmt;
|
format = GST_FORMAT_TIME;
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (avi,
|
GST_DEBUG_OBJECT (avi,
|
||||||
"seek requested: rate %g cur %" GST_TIME_FORMAT " stop %"
|
"seek requested: rate %g cur %" GST_TIME_FORMAT " stop %"
|
||||||
|
@ -4204,19 +4199,18 @@ avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad, GstEvent * event)
|
||||||
&cur_type, &cur, &stop_type, &stop);
|
&cur_type, &cur, &stop_type, &stop);
|
||||||
|
|
||||||
if (format != GST_FORMAT_TIME) {
|
if (format != GST_FORMAT_TIME) {
|
||||||
GstFormat fmt = GST_FORMAT_TIME;
|
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
|
|
||||||
if (cur_type != GST_SEEK_TYPE_NONE)
|
if (cur_type != GST_SEEK_TYPE_NONE)
|
||||||
res = gst_pad_query_convert (pad, format, cur, &fmt, &cur);
|
res = gst_pad_query_convert (pad, format, cur, GST_FORMAT_TIME, &cur);
|
||||||
if (res && stop_type != GST_SEEK_TYPE_NONE)
|
if (res && stop_type != GST_SEEK_TYPE_NONE)
|
||||||
res = gst_pad_query_convert (pad, format, stop, &fmt, &stop);
|
res = gst_pad_query_convert (pad, format, stop, GST_FORMAT_TIME, &stop);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
GST_DEBUG_OBJECT (avi, "unsupported format given, seek aborted.");
|
GST_DEBUG_OBJECT (avi, "unsupported format given, seek aborted.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
format = fmt;
|
format = GST_FORMAT_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* let gst_segment handle any tricky stuff */
|
/* let gst_segment handle any tricky stuff */
|
||||||
|
@ -4225,7 +4219,7 @@ avi_demux_handle_seek_push (GstAviDemux * avi, GstPad * pad, GstEvent * event)
|
||||||
gst_segment_do_seek (&seeksegment, rate, format, flags,
|
gst_segment_do_seek (&seeksegment, rate, format, flags,
|
||||||
cur_type, cur, stop_type, stop, &update);
|
cur_type, cur, stop_type, stop, &update);
|
||||||
|
|
||||||
keyframe = !!(flags & GST_SEEK_FLAG_KEY_UNIT);
|
keyframe = ! !(flags & GST_SEEK_FLAG_KEY_UNIT);
|
||||||
cur = seeksegment.position;
|
cur = seeksegment.position;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (avi,
|
GST_DEBUG_OBJECT (avi,
|
||||||
|
@ -4819,7 +4813,6 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
|
||||||
guint32 size = 0;
|
guint32 size = 0;
|
||||||
gint stream_nr = 0;
|
gint stream_nr = 0;
|
||||||
GstFlowReturn res = GST_FLOW_OK;
|
GstFlowReturn res = GST_FLOW_OK;
|
||||||
GstFormat format = GST_FORMAT_TIME;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (avi->have_eos)) {
|
if (G_UNLIKELY (avi->have_eos)) {
|
||||||
/* Clean adapter, we're done */
|
/* Clean adapter, we're done */
|
||||||
|
@ -4975,9 +4968,8 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
} else {
|
} else {
|
||||||
/* get time of this buffer */
|
/* get time of this buffer */
|
||||||
gst_pad_query_position (stream->pad, &format, (gint64 *) & next_ts);
|
gst_pad_query_position (stream->pad, GST_FORMAT_TIME,
|
||||||
if (G_UNLIKELY (format != GST_FORMAT_TIME))
|
(gint64 *) & next_ts);
|
||||||
goto wrong_format;
|
|
||||||
|
|
||||||
gst_avi_demux_add_assoc (avi, stream, next_ts, offset, FALSE);
|
gst_avi_demux_add_assoc (avi, stream, next_ts, offset, FALSE);
|
||||||
|
|
||||||
|
@ -4994,9 +4986,8 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
|
||||||
/* invert the picture if needed */
|
/* invert the picture if needed */
|
||||||
buf = gst_avi_demux_invert (stream, buf);
|
buf = gst_avi_demux_invert (stream, buf);
|
||||||
|
|
||||||
gst_pad_query_position (stream->pad, &format, (gint64 *) & dur_ts);
|
gst_pad_query_position (stream->pad, GST_FORMAT_TIME,
|
||||||
if (G_UNLIKELY (format != GST_FORMAT_TIME))
|
(gint64 *) & dur_ts);
|
||||||
goto wrong_format;
|
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (buf) = next_ts;
|
GST_BUFFER_TIMESTAMP (buf) = next_ts;
|
||||||
GST_BUFFER_DURATION (buf) = dur_ts - next_ts;
|
GST_BUFFER_DURATION (buf) = dur_ts - next_ts;
|
||||||
|
@ -5035,17 +5026,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
|
||||||
wrong_format:
|
|
||||||
{
|
|
||||||
GST_DEBUG_OBJECT (avi, "format %s != GST_FORMAT_TIME",
|
|
||||||
gst_format_get_name (format));
|
|
||||||
res = GST_FLOW_ERROR;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -118,16 +118,15 @@ gst_navseek_init (GstNavSeek * navseek)
|
||||||
static void
|
static void
|
||||||
gst_navseek_seek (GstNavSeek * navseek, gint64 offset)
|
gst_navseek_seek (GstNavSeek * navseek, gint64 offset)
|
||||||
{
|
{
|
||||||
GstFormat peer_format = GST_FORMAT_TIME;
|
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
GstPad *peer_pad;
|
GstPad *peer_pad;
|
||||||
gint64 peer_value;
|
gint64 peer_value;
|
||||||
|
|
||||||
/* Query for the current time then attempt to set to time + offset */
|
/* Query for the current time then attempt to set to time + offset */
|
||||||
peer_pad = gst_pad_get_peer (GST_BASE_TRANSFORM (navseek)->sinkpad);
|
peer_pad = gst_pad_get_peer (GST_BASE_TRANSFORM (navseek)->sinkpad);
|
||||||
ret = gst_pad_query_position (peer_pad, &peer_format, &peer_value);
|
ret = gst_pad_query_position (peer_pad, GST_FORMAT_TIME, &peer_value);
|
||||||
|
|
||||||
if (ret && peer_format == GST_FORMAT_TIME) {
|
if (ret) {
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
|
|
||||||
peer_value += offset;
|
peer_value += offset;
|
||||||
|
@ -147,15 +146,14 @@ gst_navseek_seek (GstNavSeek * navseek, gint64 offset)
|
||||||
static void
|
static void
|
||||||
gst_navseek_change_playback_rate (GstNavSeek * navseek, gdouble rate)
|
gst_navseek_change_playback_rate (GstNavSeek * navseek, gdouble rate)
|
||||||
{
|
{
|
||||||
GstFormat peer_format = GST_FORMAT_TIME;
|
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
GstPad *peer_pad;
|
GstPad *peer_pad;
|
||||||
gint64 current_position;
|
gint64 current_position;
|
||||||
|
|
||||||
peer_pad = gst_pad_get_peer (GST_BASE_TRANSFORM (navseek)->sinkpad);
|
peer_pad = gst_pad_get_peer (GST_BASE_TRANSFORM (navseek)->sinkpad);
|
||||||
ret = gst_pad_query_position (peer_pad, &peer_format, ¤t_position);
|
ret = gst_pad_query_position (peer_pad, GST_FORMAT_TIME, ¤t_position);
|
||||||
|
|
||||||
if (ret && peer_format == GST_FORMAT_TIME) {
|
if (ret) {
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
gint64 start;
|
gint64 start;
|
||||||
gint64 stop;
|
gint64 stop;
|
||||||
|
|
|
@ -240,8 +240,8 @@ gst_progress_report_do_query (GstProgressReport * filter, GstFormat format,
|
||||||
|
|
||||||
if (filter->do_query || !buf) {
|
if (filter->do_query || !buf) {
|
||||||
GST_LOG_OBJECT (filter, "using upstream query");
|
GST_LOG_OBJECT (filter, "using upstream query");
|
||||||
if (!gst_pad_query_peer_position (sink_pad, &format, &cur) ||
|
if (!gst_pad_query_peer_position (sink_pad, format, &cur) ||
|
||||||
!gst_pad_query_peer_duration (sink_pad, &format, &total)) {
|
!gst_pad_query_peer_duration (sink_pad, format, &total)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -119,11 +119,11 @@ gst_flv_demux_parse_and_add_index_entry (GstFlvDemux * demux, GstClockTime ts,
|
||||||
gboolean key;
|
gboolean key;
|
||||||
|
|
||||||
gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &time);
|
gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &time);
|
||||||
key = !!(GST_INDEX_ASSOC_FLAGS (entry) & GST_ASSOCIATION_FLAG_KEY_UNIT);
|
key = ! !(GST_INDEX_ASSOC_FLAGS (entry) & GST_ASSOCIATION_FLAG_KEY_UNIT);
|
||||||
GST_LOG_OBJECT (demux, "position already mapped to time %" GST_TIME_FORMAT
|
GST_LOG_OBJECT (demux, "position already mapped to time %" GST_TIME_FORMAT
|
||||||
", keyframe %d", GST_TIME_ARGS (time), key);
|
", keyframe %d", GST_TIME_ARGS (time), key);
|
||||||
/* there is not really a way to delete the existing one */
|
/* there is not really a way to delete the existing one */
|
||||||
if (time != ts || key != !!keyframe)
|
if (time != ts || key != ! !keyframe)
|
||||||
GST_DEBUG_OBJECT (demux, "metadata mismatch");
|
GST_DEBUG_OBJECT (demux, "metadata mismatch");
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@ -214,10 +214,8 @@ gst_flv_demux_check_seekability (GstFlvDemux * demux)
|
||||||
|
|
||||||
/* try harder to query upstream size if we didn't get it the first time */
|
/* try harder to query upstream size if we didn't get it the first time */
|
||||||
if (demux->upstream_seekable && stop == -1) {
|
if (demux->upstream_seekable && stop == -1) {
|
||||||
GstFormat fmt = GST_FORMAT_BYTES;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux, "doing duration query to fix up unset stop");
|
GST_DEBUG_OBJECT (demux, "doing duration query to fix up unset stop");
|
||||||
gst_pad_query_peer_duration (demux->sinkpad, &fmt, &stop);
|
gst_pad_query_peer_duration (demux->sinkpad, GST_FORMAT_BYTES, &stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if upstream doesn't know the size, it's likely that it's not seekable in
|
/* if upstream doesn't know the size, it's likely that it's not seekable in
|
||||||
|
@ -2194,15 +2192,13 @@ static GstFlowReturn
|
||||||
gst_flv_demux_create_index (GstFlvDemux * demux, gint64 pos, GstClockTime ts)
|
gst_flv_demux_create_index (GstFlvDemux * demux, gint64 pos, GstClockTime ts)
|
||||||
{
|
{
|
||||||
gint64 size;
|
gint64 size;
|
||||||
GstFormat fmt = GST_FORMAT_BYTES;
|
|
||||||
size_t tag_size;
|
size_t tag_size;
|
||||||
guint64 old_offset;
|
guint64 old_offset;
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
GstClockTime tag_time;
|
GstClockTime tag_time;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
if (G_UNLIKELY (!gst_pad_query_peer_duration (demux->sinkpad, &fmt, &size) ||
|
if (!gst_pad_query_peer_duration (demux->sinkpad, GST_FORMAT_BYTES, &size))
|
||||||
fmt != GST_FORMAT_BYTES))
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux, "building index at %" G_GINT64_FORMAT
|
GST_DEBUG_OBJECT (demux, "building index at %" G_GINT64_FORMAT
|
||||||
|
@ -2240,13 +2236,11 @@ static gint64
|
||||||
gst_flv_demux_get_metadata (GstFlvDemux * demux)
|
gst_flv_demux_get_metadata (GstFlvDemux * demux)
|
||||||
{
|
{
|
||||||
gint64 ret = 0, offset;
|
gint64 ret = 0, offset;
|
||||||
GstFormat fmt = GST_FORMAT_BYTES;
|
|
||||||
size_t tag_size, size;
|
size_t tag_size, size;
|
||||||
GstBuffer *buffer = NULL;
|
GstBuffer *buffer = NULL;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
|
||||||
if (G_UNLIKELY (!gst_pad_query_peer_duration (demux->sinkpad, &fmt, &offset)
|
if (!gst_pad_query_peer_duration (demux->sinkpad, GST_FORMAT_BYTES, &offset))
|
||||||
|| fmt != GST_FORMAT_BYTES))
|
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
ret = offset;
|
ret = offset;
|
||||||
|
@ -2497,7 +2491,7 @@ flv_demux_handle_seek_push (GstFlvDemux * demux, GstEvent * event)
|
||||||
if (format != GST_FORMAT_TIME)
|
if (format != GST_FORMAT_TIME)
|
||||||
goto wrong_format;
|
goto wrong_format;
|
||||||
|
|
||||||
flush = !!(flags & GST_SEEK_FLAG_FLUSH);
|
flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
|
||||||
/* FIXME : the keyframe flag is never used ! */
|
/* FIXME : the keyframe flag is never used ! */
|
||||||
|
|
||||||
/* Work on a copy until we are sure the seek succeeded. */
|
/* Work on a copy until we are sure the seek succeeded. */
|
||||||
|
@ -2586,7 +2580,6 @@ gst_flv_demux_handle_seek_push (GstFlvDemux * demux, GstEvent * event)
|
||||||
if (!demux->indexed) {
|
if (!demux->indexed) {
|
||||||
guint64 seek_offset = 0;
|
guint64 seek_offset = 0;
|
||||||
gboolean building_index;
|
gboolean building_index;
|
||||||
GstFormat fmt;
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (demux);
|
GST_OBJECT_LOCK (demux);
|
||||||
/* handle the seek in the chain function */
|
/* handle the seek in the chain function */
|
||||||
|
@ -2603,13 +2596,10 @@ gst_flv_demux_handle_seek_push (GstFlvDemux * demux, GstEvent * event)
|
||||||
building_index = demux->building_index;
|
building_index = demux->building_index;
|
||||||
if (!building_index) {
|
if (!building_index) {
|
||||||
demux->building_index = TRUE;
|
demux->building_index = TRUE;
|
||||||
fmt = GST_FORMAT_BYTES;
|
|
||||||
if (!demux->file_size
|
if (!demux->file_size
|
||||||
&& !gst_pad_query_peer_duration (demux->sinkpad, &fmt,
|
&& !gst_pad_query_peer_duration (demux->sinkpad, GST_FORMAT_BYTES,
|
||||||
&demux->file_size)) {
|
&demux->file_size)) {
|
||||||
GST_WARNING_OBJECT (demux,
|
GST_WARNING_OBJECT (demux, "Failed to query upstream file size");
|
||||||
"Cannot obtain file size - %" G_GINT64_FORMAT ", format %u",
|
|
||||||
demux->file_size, fmt);
|
|
||||||
GST_OBJECT_UNLOCK (demux);
|
GST_OBJECT_UNLOCK (demux);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2662,7 +2652,7 @@ gst_flv_demux_handle_seek_pull (GstFlvDemux * demux, GstEvent * event,
|
||||||
demux->seeking = seeking;
|
demux->seeking = seeking;
|
||||||
GST_OBJECT_UNLOCK (demux);
|
GST_OBJECT_UNLOCK (demux);
|
||||||
|
|
||||||
flush = !!(flags & GST_SEEK_FLAG_FLUSH);
|
flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
|
||||||
/* FIXME : the keyframe flag is never used */
|
/* FIXME : the keyframe flag is never used */
|
||||||
|
|
||||||
if (flush) {
|
if (flush) {
|
||||||
|
|
|
@ -767,17 +767,13 @@ gst_flv_mux_create_metadata (GstFlvMux * mux)
|
||||||
|
|
||||||
if (mux->duration == GST_CLOCK_TIME_NONE) {
|
if (mux->duration == GST_CLOCK_TIME_NONE) {
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
|
||||||
GstFormat fmt = GST_FORMAT_TIME;
|
|
||||||
guint64 dur;
|
guint64 dur;
|
||||||
|
|
||||||
for (l = mux->collect->data; l; l = l->next) {
|
for (l = mux->collect->data; l; l = l->next) {
|
||||||
GstCollectData *cdata = l->data;
|
GstCollectData *cdata = l->data;
|
||||||
|
|
||||||
fmt = GST_FORMAT_TIME;
|
if (gst_pad_query_peer_duration (cdata->pad, GST_FORMAT_TIME,
|
||||||
|
(gint64 *) & dur) && dur != GST_CLOCK_TIME_NONE) {
|
||||||
if (gst_pad_query_peer_duration (cdata->pad, &fmt, (gint64 *) & dur) &&
|
|
||||||
fmt == GST_FORMAT_TIME && dur != GST_CLOCK_TIME_NONE) {
|
|
||||||
if (mux->duration == GST_CLOCK_TIME_NONE)
|
if (mux->duration == GST_CLOCK_TIME_NONE)
|
||||||
mux->duration = dur;
|
mux->duration = dur;
|
||||||
else
|
else
|
||||||
|
|
|
@ -1184,7 +1184,6 @@ gst_qtdemux_convert_seek (GstPad * pad, GstFormat * format,
|
||||||
GstSeekType cur_type, gint64 * cur, GstSeekType stop_type, gint64 * stop)
|
GstSeekType cur_type, gint64 * cur, GstSeekType stop_type, gint64 * stop)
|
||||||
{
|
{
|
||||||
gboolean res;
|
gboolean res;
|
||||||
GstFormat fmt;
|
|
||||||
|
|
||||||
g_return_val_if_fail (format != NULL, FALSE);
|
g_return_val_if_fail (format != NULL, FALSE);
|
||||||
g_return_val_if_fail (cur != NULL, FALSE);
|
g_return_val_if_fail (cur != NULL, FALSE);
|
||||||
|
@ -1193,12 +1192,11 @@ gst_qtdemux_convert_seek (GstPad * pad, GstFormat * format,
|
||||||
if (*format == GST_FORMAT_TIME)
|
if (*format == GST_FORMAT_TIME)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
fmt = GST_FORMAT_TIME;
|
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
if (cur_type != GST_SEEK_TYPE_NONE)
|
if (cur_type != GST_SEEK_TYPE_NONE)
|
||||||
res = gst_pad_query_convert (pad, *format, *cur, &fmt, cur);
|
res = gst_pad_query_convert (pad, *format, *cur, GST_FORMAT_TIME, cur);
|
||||||
if (res && stop_type != GST_SEEK_TYPE_NONE)
|
if (res && stop_type != GST_SEEK_TYPE_NONE)
|
||||||
res = gst_pad_query_convert (pad, *format, *stop, &fmt, stop);
|
res = gst_pad_query_convert (pad, *format, *stop, GST_FORMAT_TIME, stop);
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
*format = GST_FORMAT_TIME;
|
*format = GST_FORMAT_TIME;
|
||||||
|
@ -7457,7 +7455,6 @@ too_many_streams:
|
||||||
static void
|
static void
|
||||||
gst_qtdemux_guess_bitrate (GstQTDemux * qtdemux)
|
gst_qtdemux_guess_bitrate (GstQTDemux * qtdemux)
|
||||||
{
|
{
|
||||||
GstFormat format = GST_FORMAT_BYTES;
|
|
||||||
QtDemuxStream *stream = NULL;
|
QtDemuxStream *stream = NULL;
|
||||||
gint64 size, duration, sys_bitrate, sum_bitrate = 0;
|
gint64 size, duration, sys_bitrate, sum_bitrate = 0;
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -7468,8 +7465,7 @@ gst_qtdemux_guess_bitrate (GstQTDemux * qtdemux)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (qtdemux, "Looking for streams with unknown bitrate");
|
GST_DEBUG_OBJECT (qtdemux, "Looking for streams with unknown bitrate");
|
||||||
|
|
||||||
if (!gst_pad_query_peer_duration (qtdemux->sinkpad, &format, &size) ||
|
if (!gst_pad_query_peer_duration (qtdemux->sinkpad, GST_FORMAT_BYTES, &size)) {
|
||||||
format != GST_FORMAT_BYTES) {
|
|
||||||
GST_DEBUG_OBJECT (qtdemux,
|
GST_DEBUG_OBJECT (qtdemux,
|
||||||
"Size in bytes of the stream not known - bailing");
|
"Size in bytes of the stream not known - bailing");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -782,11 +782,11 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event)
|
||||||
if (cur_type != GST_SEEK_TYPE_NONE)
|
if (cur_type != GST_SEEK_TYPE_NONE)
|
||||||
res =
|
res =
|
||||||
gst_pad_query_convert (wav->srcpad, format, cur,
|
gst_pad_query_convert (wav->srcpad, format, cur,
|
||||||
&wav->segment.format, &cur);
|
wav->segment.format, &cur);
|
||||||
if (res && stop_type != GST_SEEK_TYPE_NONE)
|
if (res && stop_type != GST_SEEK_TYPE_NONE)
|
||||||
res =
|
res =
|
||||||
gst_pad_query_convert (wav->srcpad, format, stop,
|
gst_pad_query_convert (wav->srcpad, format, stop,
|
||||||
&wav->segment.format, &stop);
|
wav->segment.format, &stop);
|
||||||
if (!res)
|
if (!res)
|
||||||
goto no_format;
|
goto no_format;
|
||||||
|
|
||||||
|
@ -921,7 +921,7 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event)
|
||||||
/* make sure filesize is not exceeded due to rounding errors or so,
|
/* make sure filesize is not exceeded due to rounding errors or so,
|
||||||
* same precaution as in _stream_headers */
|
* same precaution as in _stream_headers */
|
||||||
bformat = GST_FORMAT_BYTES;
|
bformat = GST_FORMAT_BYTES;
|
||||||
if (gst_pad_query_peer_duration (wav->sinkpad, &bformat, &upstream_size))
|
if (gst_pad_query_peer_duration (wav->sinkpad, bformat, &upstream_size))
|
||||||
wav->end_offset = MIN (wav->end_offset, upstream_size);
|
wav->end_offset = MIN (wav->end_offset, upstream_size);
|
||||||
|
|
||||||
/* this is the range of bytes we will use for playback */
|
/* this is the range of bytes we will use for playback */
|
||||||
|
@ -1133,7 +1133,6 @@ gst_wavparse_stream_headers (GstWavParse * wav)
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
gchar *codec_name = NULL;
|
gchar *codec_name = NULL;
|
||||||
GstEvent **event_p;
|
GstEvent **event_p;
|
||||||
GstFormat bformat;
|
|
||||||
gint64 upstream_size = 0;
|
gint64 upstream_size = 0;
|
||||||
|
|
||||||
/* search for "_fmt" chunk, which should be first */
|
/* search for "_fmt" chunk, which should be first */
|
||||||
|
@ -1278,8 +1277,7 @@ gst_wavparse_stream_headers (GstWavParse * wav)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bformat = GST_FORMAT_BYTES;
|
gst_pad_query_peer_duration (wav->sinkpad, GST_FORMAT_BYTES, &upstream_size);
|
||||||
gst_pad_query_peer_duration (wav->sinkpad, &bformat, &upstream_size);
|
|
||||||
GST_DEBUG_OBJECT (wav, "upstream size %" G_GUINT64_FORMAT, upstream_size);
|
GST_DEBUG_OBJECT (wav, "upstream size %" G_GUINT64_FORMAT, upstream_size);
|
||||||
|
|
||||||
/* loop headers until we get data */
|
/* loop headers until we get data */
|
||||||
|
|
Loading…
Reference in a new issue