diff options
author | Mark Nauwelaerts <mnauw@users.sourceforge.net> | 2013-02-08 21:28:02 +0100 |
---|---|---|
committer | Mark Nauwelaerts <mnauw@users.sourceforge.net> | 2013-02-08 21:41:55 +0100 |
commit | f0645b79c58a162619f2fc2d030971cce4acd514 (patch) | |
tree | 202c6c0951710e46a8a5564a3fbdf7bd77087133 | |
parent | 2d5319c1fa4487c9e050931ce8a26e427626b763 (diff) |
avidemux: proper position reporting and push mode timestamping
... and align current_total semantics in push and pull mode,
which tracks bytes for CBR and blocks for VBR.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=691481
-rw-r--r-- | gst/avi/gstavidemux.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 95e0d3dfc..a68b70fa4 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -456,14 +456,14 @@ gst_avi_demux_handle_src_query (GstPad * pad, GstObject * parent, if (stream->strh->type == GST_RIFF_FCC_auds) { if (stream->is_vbr) { /* VBR */ - pos = gst_util_uint64_scale ((gint64) stream->current_entry * - stream->strh->scale, GST_SECOND, (guint64) stream->strh->rate); + pos = avi_stream_convert_frames_to_time_unchecked (stream, + stream->current_total); GST_DEBUG_OBJECT (avi, "VBR convert frame %u, time %" GST_TIME_FORMAT, stream->current_entry, GST_TIME_ARGS (pos)); } else if (stream->strf.auds->av_bps != 0) { /* CBR */ - pos = gst_util_uint64_scale (stream->current_total, GST_SECOND, - (guint64) stream->strf.auds->av_bps); + pos = avi_stream_convert_bytes_to_time_unchecked (stream, + stream->current_total); GST_DEBUG_OBJECT (avi, "CBR convert bytes %u, time %" GST_TIME_FORMAT, stream->current_total, GST_TIME_ARGS (pos)); @@ -5098,7 +5098,18 @@ gst_avi_demux_stream_data (GstAviDemux * avi) /* increment our positions */ stream->current_entry++; - stream->current_total += size; + /* as in pull mode, 'total' is either bytes (CBR) or frames (VBR) */ + if (stream->strh->type == GST_RIFF_FCC_auds && stream->is_vbr) { + gint blockalign = stream->strf.auds->blockalign; + if (blockalign > 0) + stream->current_total += DIV_ROUND_UP (size, blockalign); + else + stream->current_total++; + } else { + stream->current_total += size; + } + GST_LOG_OBJECT (avi, "current entry %u, total %u", + stream->current_entry, stream->current_total); /* update current position in the segment */ avi->segment.position = next_ts; |