summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-07-15 17:38:28 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-07-19 23:41:03 +0200
commit885fc058655efee94203314984ce99b301fdebb1 (patch)
treede941d14c05ae4bcf54d3284afaa60088d3072dd /libavformat
parentcd089003936030c506fb7a28e9a26e028b1aece0 (diff)
lavf: count skipped samples for initial timestamps.
If skip_samples is set and timestamps are synthesized using durations, make them start at -skip_samples (rescaled) instead of 0, so that the timestamp of the first undiscarded sample is 0.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d6035d9f24..cfa9e82f3f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -942,6 +942,10 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st,
AVPacketList *pktl= s->parse_queue ? s->parse_queue : s->packet_buffer;
int64_t cur_dts= RELATIVE_TS_BASE;
+ if (st->skip_samples && st->codec->sample_rate && st->time_base.num)
+ cur_dts -= av_rescale_q(st->skip_samples,
+ (AVRational){ 1, st->codec->sample_rate },
+ st->time_base);
if(st->first_dts != AV_NOPTS_VALUE){
cur_dts= st->first_dts;
for(; pktl; pktl= get_next_pkt(s, st, pktl)){