diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-10-09 15:04:38 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-10-25 16:27:48 +0200 |
commit | f172132f825cec4e446a5bdde4ffa9065ba9061f (patch) | |
tree | 96839afb55479392166d12cc205dc825eb49ec34 /libavformat | |
parent | 28287045ca3ee34e4ea980628ec8314fd2d819ae (diff) | |
download | ffmpeg-f172132f825cec4e446a5bdde4ffa9065ba9061f.tar.gz |
mpegenc: add preload private option.
Deprecate AVFormatContext.preload.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avformat.h | 4 | ||||
-rw-r--r-- | libavformat/mpegenc.c | 10 | ||||
-rw-r--r-- | libavformat/version.h | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 65f66d84d3..74c7140e35 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -743,7 +743,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 5e8954c902..f824d6cb05 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/version.h b/libavformat/version.h index 9de30ea55b..3a6a4f611e 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -98,5 +98,8 @@ #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 #endif /* AVFORMAT_VERSION_H */ |