diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-08-27 08:34:05 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-08-31 13:21:05 +0200 |
commit | 2c5e1efc093084f1cb4e55b8c06c267801828965 (patch) | |
tree | b3d0e0ed3ed9c9d7f678057fa7be11c6a2eee9e7 /libavcodec | |
parent | 297d9cb3dc6850b83ba4e95789143833cecdfd87 (diff) | |
download | ffmpeg-2c5e1efc093084f1cb4e55b8c06c267801828965.tar.gz |
mpeg12enc: add drop_frame_timecode private option.
Deprecate CODEC_FLAG2_DROP_FRAME_TIMECODE
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 2 | ||||
-rw-r--r-- | libavcodec/mpeg12enc.c | 12 | ||||
-rw-r--r-- | libavcodec/mpegvideo.h | 1 | ||||
-rw-r--r-- | libavcodec/options.c | 2 |
4 files changed, 14 insertions, 3 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 408438e62f..5791911a2f 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -620,7 +620,9 @@ typedef struct RcOverride{ #define CODEC_FLAG2_INTRA_VLC 0x00000800 ///< Use MPEG-2 intra VLC table. #endif #define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC). +#if FF_API_MPEGVIDEO_GLOBAL_OPTS #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format. +#endif #define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. #define CODEC_FLAG2_NON_LINEAR_QUANT 0x00010000 ///< Use MPEG-2 nonlinear quantizer. diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index eca57d0df7..dd433215f3 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -142,6 +142,11 @@ static av_cold int encode_init(AVCodecContext *avctx) if(MPV_encode_init(avctx) < 0) return -1; +#if FF_API_MPEGVIDEO_GLOBAL_OPTS + if (avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) + s->drop_frame_timecode = 1; +#endif + if(find_frame_rate_index(s) < 0){ if(s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "MPEG1/2 does not support %d/%d fps\n", avctx->time_base.den, avctx->time_base.num); @@ -174,7 +179,7 @@ static av_cold int encode_init(AVCodecContext *avctx) } } - if((avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) && s->frame_rate_index != 4){ + if (s->drop_frame_timecode && s->frame_rate_index != 4) { av_log(avctx, AV_LOG_ERROR, "Drop frame time code only allowed with 1001/30000 fps\n"); return -1; } @@ -285,14 +290,14 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) } put_header(s, GOP_START_CODE); - put_bits(&s->pb, 1, !!(s->avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE)); /* drop frame flag */ + put_bits(&s->pb, 1, s->drop_frame_timecode); /* drop frame flag */ /* time code : we must convert from the real frame rate to a fake mpeg frame rate in case of low frame rate */ fps = (framerate.num + framerate.den/2)/ framerate.den; time_code = s->current_picture_ptr->f.coded_picture_number + s->avctx->timecode_frame_start; s->gop_picture_number = s->current_picture_ptr->f.coded_picture_number; - if (s->avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE) { + if (s->drop_frame_timecode) { /* only works for NTSC 29.97 */ int d = time_code / 17982; int m = time_code % 17982; @@ -931,6 +936,7 @@ static void mpeg1_encode_block(MpegEncContext *s, #define VE AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM static const AVOption options[] = { { "intra_vlc", "Use MPEG-2 intra VLC table.", OFFSET(intra_vlc_format), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE }, + { "drop_frame_timecode", "Timecode is in drop frame format.", OFFSET(drop_frame_timecode), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE}, { NULL }, }; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 0790b075f0..34069c69bb 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -644,6 +644,7 @@ typedef struct MpegEncContext { int interlaced_dct; int first_slice; int first_field; ///< is 1 for the first field of a field picture 0 otherwise + int drop_frame_timecode; ///< timecode is in drop frame format. /* RTP specific */ int rtp_mode; diff --git a/libavcodec/options.c b/libavcodec/options.c index 19a4133a78..5231cb4c53 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -421,7 +421,9 @@ static const AVOption options[]={ {"max_partition_order", "deprecated, use flac-specific options", OFFSET(max_partition_order), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, #endif {"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT64, {.dbl = 0 }, 0, INT64_MAX, V|E}, +#if FF_API_MPEGVIDEO_GLOBAL_OPTS {"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_DROP_FRAME_TIMECODE }, INT_MIN, INT_MAX, V|E, "flags2"}, +#endif {"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_NON_LINEAR_QUANT }, INT_MIN, INT_MAX, V|E, "flags2"}, #if FF_API_REQUEST_CHANNELS {"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, A|D}, |