Deprecate CODEC_FLAG2_STRICT_GOP.tags/n0.11
@@ -567,10 +567,10 @@ typedef struct RcOverride{ | |||||
#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation | #define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation | ||||
#define CODEC_FLAG_CLOSED_GOP 0x80000000 | #define CODEC_FLAG_CLOSED_GOP 0x80000000 | ||||
#define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. | #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_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. | ||||
#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. | #define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. | ||||
#if FF_API_MPV_GLOBAL_OPTS | #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 | #define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping | ||||
#endif | #endif | ||||
#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. | #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. | ||||
@@ -700,12 +700,14 @@ typedef struct MpegEncContext { | |||||
/* mpegvideo_enc common options */ | /* mpegvideo_enc common options */ | ||||
#define FF_MPV_FLAG_SKIP_RD 0x0001 | #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_OFFSET(x) offsetof(MpegEncContext, x) | ||||
#define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) | #define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) | ||||
#define FF_MPV_COMMON_OPTS \ | #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" },\ | { "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" },\ | { "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[]; | extern const AVOption ff_mpv_generic_options[]; | ||||
@@ -614,6 +614,8 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) | |||||
#if FF_API_MPV_GLOBAL_OPTS | #if FF_API_MPV_GLOBAL_OPTS | ||||
if (avctx->flags2 & CODEC_FLAG2_SKIP_RD) | if (avctx->flags2 & CODEC_FLAG2_SKIP_RD) | ||||
s->mpv_flags |= FF_MPV_FLAG_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 | #endif | ||||
switch (avctx->codec->id) { | 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->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) { | s->gop_size > s->picture_in_gop_number) { | ||||
b_frames = s->gop_size - s->picture_in_gop_number - 1; | b_frames = s->gop_size - s->picture_in_gop_number - 1; | ||||
} else { | } else { | ||||
@@ -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"}, | {"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"}, | {"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"}, | {"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"}, | {"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"}, | {"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}, | {"sub_id", NULL, OFFSET(sub_id), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX}, | ||||