diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-26 02:09:31 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-26 02:36:07 +0200 |
commit | 51bfaa21c85201ab31776a447599349a1ed6e96b (patch) | |
tree | b7baafad803a06c5d582606f37f91a27e8342e59 /libavformat | |
parent | f5fdb12d5552a3710611f15cd72ce6c7b6fb4da0 (diff) | |
parent | a3a8572165ce636fb011b78764a2584777f81b95 (diff) | |
download | ffmpeg-51bfaa21c85201ab31776a447599349a1ed6e96b.tar.gz |
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')
-rw-r--r-- | libavformat/avformat.h | 8 | ||||
-rw-r--r-- | libavformat/mpegenc.c | 10 | ||||
-rw-r--r-- | libavformat/tta.c | 4 | ||||
-rw-r--r-- | libavformat/utils.c | 18 | ||||
-rw-r--r-- | libavformat/version.h | 6 |
5 files changed, 31 insertions, 15 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 441f85d503..425198fcda 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -540,8 +540,10 @@ typedef struct AVStream { */ AVRational time_base; int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ +#if FF_API_STREAM_COPY /* ffmpeg.c private use */ - int stream_copy; /**< If set, just copy stream. */ + attribute_deprecated int stream_copy; /**< If set, just copy stream. */ +#endif enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. #if FF_API_AVSTREAM_QUALITY @@ -772,7 +774,9 @@ typedef struct AVFormatContext { attribute_deprecated int mux_rate; #endif unsigned int packet_size; - int preload; +#if FF_API_PRELOAD + attribute_deprecated int preload; +#endif int max_delay; #if FF_API_LOOP_OUTPUT diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 817f541805..9e19a3d5e4 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -77,6 +77,7 @@ typedef struct { double vcd_padding_bitrate; //FIXME floats int64_t vcd_padding_bytes_written; + int preload; } MpegMuxContext; extern AVOutputFormat ff_mpeg1vcd_muxer; @@ -1158,9 +1159,15 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) StreamInfo *stream = st->priv_data; int64_t pts, dts; PacketDesc *pkt_desc; - const int preload= av_rescale(ctx->preload, 90000, AV_TIME_BASE); + int preload; const int is_iframe = st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->flags & AV_PKT_FLAG_KEY); +#if FF_API_PRELOAD + if (ctx->preload) + s->preload = ctx->preload; +#endif + preload = av_rescale(s->preload, 90000, AV_TIME_BASE); + pts= pkt->pts; dts= pkt->dts; @@ -1237,6 +1244,7 @@ static int mpeg_mux_end(AVFormatContext *ctx) #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { { "muxrate", NULL, OFFSET(mux_rate), AV_OPT_TYPE_INT, {0}, 0, INT_MAX, E }, + { "preload", "Initial demux-decode delay in microseconds.", OFFSET(preload), AV_OPT_TYPE_INT, {500000}, 0, INT_MAX, E}, { NULL }, }; diff --git a/libavformat/tta.c b/libavformat/tta.c index ca2d36b44f..4d0c6adeee 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -107,6 +107,10 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); + if (!st->codec->extradata) { + st->codec->extradata_size = 0; + return AVERROR(ENOMEM); + } avio_seek(s->pb, start_offset, SEEK_SET); avio_read(s->pb, st->codec->extradata, st->codec->extradata_size); 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") || diff --git a/libavformat/version.h b/libavformat/version.h index 333a3a0125..58c3a74bff 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -101,5 +101,11 @@ #ifndef FF_API_NEW_STREAM #define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 54) #endif +#ifndef FF_API_PRELOAD +#define FF_API_PRELOAD (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_STREAM_COPY +#define FF_API_STREAM_COPY (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif /* AVFORMAT_VERSION_H */ |