diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2006-11-13 11:30:26 +0000 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2006-11-13 11:30:26 +0000 |
commit | 9cc6be9d27373eaaf04233d06fc01a244627f5d4 (patch) | |
tree | 6801629a6e804d92c9fb379ed816d123d3930320 /libavcodec/mpegvideo.c | |
parent | 213309782db6cd221a8d6785a5c96bb13e829ef3 (diff) |
add low delay forcing option for mpeg1/2 encoding
Originally committed as revision 7008 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r-- | libavcodec/mpegvideo.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index d286b12ce1..fda536c068 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1104,6 +1104,17 @@ int MPV_encode_init(AVCodecContext *avctx) return -1; } + if(s->flags & CODEC_FLAG_LOW_DELAY){ + if (s->codec_id != CODEC_ID_MPEG2VIDEO && s->codec_id != CODEC_ID_MPEG1VIDEO){ + av_log(avctx, AV_LOG_ERROR, "low delay forcing is only available for mpeg1/2\n"); + return -1; + } + if (s->max_b_frames != 0){ + av_log(avctx, AV_LOG_ERROR, "b frames cannot be used with low delay\n"); + return -1; + } + } + if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO && (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){ @@ -1169,12 +1180,12 @@ int MPV_encode_init(AVCodecContext *avctx) switch(avctx->codec->id) { case CODEC_ID_MPEG1VIDEO: s->out_format = FMT_MPEG1; - s->low_delay= 0; //s->max_b_frames ? 0 : 1; + s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; - s->low_delay= 0; //s->max_b_frames ? 0 : 1; + s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); s->rtp_mode= 1; break; |