diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-02-27 12:23:19 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-02-29 07:11:02 +0100 |
commit | a249f0cc23457bc73a249e1b1ca22adcfe5b0894 (patch) | |
tree | 86ee5bc4444e24cdd5befcd7e854b032b32c28b6 /libavcodec | |
parent | ed019b8e5bfefe59e307ce01f2860777e037b94b (diff) | |
download | ffmpeg-a249f0cc23457bc73a249e1b1ca22adcfe5b0894.tar.gz |
mpegvideo_enc: add strict_gop flag to mpv_flags.
Deprecate CODEC_FLAG2_STRICT_GOP.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/avcodec.h | 2 | ||||
-rw-r--r-- | libavcodec/mpegvideo.h | 2 | ||||
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 4 | ||||
-rw-r--r-- | libavcodec/options.c | 4 |
4 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 0623c1cb01..fdbb1ab6c3 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -567,10 +567,10 @@ typedef struct RcOverride{ #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation #define CODEC_FLAG_CLOSED_GOP 0x80000000 #define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. -#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size. #define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. #if FF_API_MPV_GLOBAL_OPTS +#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size. #define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping #endif #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 7e157fdfff..b780331a9c 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -700,12 +700,14 @@ typedef struct MpegEncContext { /* mpegvideo_enc common options */ #define FF_MPV_FLAG_SKIP_RD 0x0001 +#define FF_MPV_FLAG_STRICT_GOP 0x0002 #define FF_MPV_OFFSET(x) offsetof(MpegEncContext, x) #define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) #define FF_MPV_COMMON_OPTS \ { "mpv_flags", "Flags common for all mpegvideo-based encoders.", FF_MPV_OFFSET(mpv_flags), AV_OPT_TYPE_FLAGS, { 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, "mpv_flags" },\ { "skip_rd", "RD optimal MB level residual skipping", 0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_SKIP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ +{ "strict_gop", "Strictly enforce gop size", 0, AV_OPT_TYPE_CONST, { FF_MPV_FLAG_STRICT_GOP }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" }, extern const AVOption ff_mpv_generic_options[]; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 8e502ed62c..d21ced7d59 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -614,6 +614,8 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) #if FF_API_MPV_GLOBAL_OPTS if (avctx->flags2 & CODEC_FLAG2_SKIP_RD) s->mpv_flags |= FF_MPV_FLAG_SKIP_RD; + if (avctx->flags2 & CODEC_FLAG2_STRICT_GOP) + s->mpv_flags |= FF_MPV_FLAG_STRICT_GOP; #endif switch (avctx->codec->id) { @@ -1300,7 +1302,7 @@ static int select_input_picture(MpegEncContext *s) } if (s->picture_in_gop_number + b_frames >= s->gop_size) { - if ((s->flags2 & CODEC_FLAG2_STRICT_GOP) && + if ((s->mpv_flags & FF_MPV_FLAG_STRICT_GOP) && s->gop_size > s->picture_in_gop_number) { b_frames = s->gop_size - s->picture_in_gop_number - 1; } else { diff --git a/libavcodec/options.c b/libavcodec/options.c index fb48030ebc..8374f9d487 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -102,7 +102,9 @@ static const AVOption options[]={ {"ilme", "interlaced motion estimation", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, "flags"}, {"cgop", "closed gop", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_CLOSED_GOP }, INT_MIN, INT_MAX, V|E, "flags"}, {"fast", "allow non spec compliant speedup tricks", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_FAST }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"sgop", "strictly enforce gop size", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_STRICT_GOP }, INT_MIN, INT_MAX, V|E, "flags2"}, +#if FF_API_MPV_GLOBAL_OPTS +{"sgop", "Deprecated, use mpegvideo private options instead", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_STRICT_GOP }, INT_MIN, INT_MAX, V|E, "flags2"}, +#endif {"noout", "skip bitstream encoding", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_NO_OUTPUT }, INT_MIN, INT_MAX, V|E, "flags2"}, {"local_header", "place global headers at every keyframe instead of in extradata", 0, AV_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_LOCAL_HEADER }, INT_MIN, INT_MAX, V|E, "flags2"}, {"sub_id", NULL, OFFSET(sub_id), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, |