summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-26 02:09:31 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-26 02:36:07 +0200
commit51bfaa21c85201ab31776a447599349a1ed6e96b (patch)
treeb7baafad803a06c5d582606f37f91a27e8342e59 /libavformat/utils.c
parentf5fdb12d5552a3710611f15cd72ce6c7b6fb4da0 (diff)
parenta3a8572165ce636fb011b78764a2584777f81b95 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits) g722dec: check output buffer size before decoding g722dec: cosmetics: reindent/linewrap g722dec: remove the use of lowres for half-rate decoding. tta: check for extradata allocation failure in tta demuxer tta: check for allocation failure of decode_buffer tta: use correct frame_length calculation. tta: add support for decoding 24-bit sample format cosmetics: indentation tta: remove pointless braces tta: check output buffer size after adjusting frame length for last frame tta: fix reading of format in TTA header. tta: remove useless commented-out lines tta: check remaining bitstream size while reading unary value lavf: deprecate AVStream.stream_copy avconc: split choose_codec() to choose_decoder/choose_encoder. lavf: simplify by using FFMAX/FFMIN. mpegenc: add preload private option. cosmetics: simplify latm_decode_init latm: avoid unnecessary reinit of the aac decoder aacdec: initialize sbr context only in new channel elements ... Conflicts: avconv.c libavcodec/resample.c libavcodec/tta.c libavformat/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index db27024904..1c6a4684a1 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1932,29 +1932,24 @@ static void update_stream_timings(AVFormatContext *ic)
if (start_time1 < start_time_text)
start_time_text = start_time1;
} else
- if (start_time1 < start_time)
- start_time = start_time1;
+ start_time = FFMIN(start_time, start_time1);
if (st->duration != AV_NOPTS_VALUE) {
end_time1 = start_time1
+ av_rescale_q(st->duration, st->time_base, AV_TIME_BASE_Q);
- if (end_time1 > end_time)
- end_time = end_time1;
+ end_time = FFMAX(end_time, end_time1);
}
}
if (st->duration != AV_NOPTS_VALUE) {
duration1 = av_rescale_q(st->duration, st->time_base, AV_TIME_BASE_Q);
- if (duration1 > duration)
- duration = duration1;
+ duration = FFMAX(duration, duration1);
}
}
if (start_time == INT64_MAX || (start_time > start_time_text && start_time - start_time_text < AV_TIME_BASE))
start_time = start_time_text;
if (start_time != INT64_MAX) {
ic->start_time = start_time;
- if (end_time != INT64_MIN) {
- if (end_time - start_time > duration)
- duration = end_time - start_time;
- }
+ if (end_time != INT64_MIN)
+ duration = FFMAX(duration, end_time - start_time);
}
if (duration != INT64_MIN && ic->duration == AV_NOPTS_VALUE) {
ic->duration = duration;
@@ -2108,8 +2103,7 @@ static void estimate_timings(AVFormatContext *ic, int64_t old_offset)
file_size = 0;
} else {
file_size = avio_size(ic->pb);
- if (file_size < 0)
- file_size = 0;
+ file_size = FFMAX(0, file_size);
}
if ((!strcmp(ic->iformat->name, "mpeg") ||