X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fmpegenc.c;h=01ee004f450c126483c87670a433733d188c4989;hb=b0aaf304a778f0a49d42c032aa83efa62c3291c4;hp=817f541805e447e36e03191b54bd95ca4b538662;hpb=d8cae42d72092501be880348ae0c223d2ea220a2;p=ffmpeg diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 817f541805e..01ee004f450 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -25,6 +25,7 @@ #include "libavutil/opt.h" #include "libavcodec/put_bits.h" #include "avformat.h" +#include "internal.h" #include "mpeg.h" #define MAX_PAYLOAD_SIZE 4096 @@ -77,6 +78,7 @@ typedef struct { double vcd_padding_bitrate; //FIXME floats int64_t vcd_padding_bytes_written; + int preload; } MpegMuxContext; extern AVOutputFormat ff_mpeg1vcd_muxer; @@ -335,7 +337,7 @@ static int mpeg_mux_init(AVFormatContext *ctx) goto fail; st->priv_data = stream; - av_set_pts_info(st, 64, 1, 90000); + avpriv_set_pts_info(st, 64, 1, 90000); switch(st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: @@ -1158,9 +1160,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 +1245,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 }, };