[FFmpeg-devel] [PATCH v5 5/5] lavc/libopenh264enc: set slice_mode option to deprecated

Martin Storsjö martin at martin.st
Tue Apr 28 13:32:30 EEST 2020


On Tue, 28 Apr 2020, Linjie Fu wrote:

> "slice mode" option seems to be unnecessary since it could be
> determined by -slices/max_nal_size.
>
> default:        SM_FIXEDSLCNUM_SLICE mode with cpu-number slices.
> -slices N:      SM_FIXEDSLCNUM_SLICE mode with N slices.
> -max_nal_size:  SM_SIZELIMITED_SLICE mode with limited size slices.
>
> Add FF_API_OPENH264_SLICE_MODE macro to remove this option after
> LIBAVCODEC_VERSION_MAJOR = 59.
>
> Signed-off-by: Linjie Fu <linjie.fu at intel.com>
> ---
> libavcodec/libopenh264enc.c | 7 +++++--
> libavcodec/version.h        | 3 +++
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
> index 6487ce5..afaa1d5 100644
> --- a/libavcodec/libopenh264enc.c
> +++ b/libavcodec/libopenh264enc.c
> @@ -56,11 +56,13 @@ typedef struct SVCContext {
> 
> #define OFFSET(x) offsetof(SVCContext, x)
> #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
> +#define DEPRECATED AV_OPT_FLAG_DEPRECATED
> static const AVOption options[] = {
> +#if FF_API_OPENH264_SLICE_MODE
> #if OPENH264_VER_AT_LEAST(1, 6)
> -    { "slice_mode", "set slice mode", OFFSET(slice_mode), AV_OPT_TYPE_INT, { .i64 = SM_FIXEDSLCNUM_SLICE }, SM_SINGLE_SLICE, SM_RESERVED, VE, "slice_mode" },
> +    { "slice_mode", "set slice mode, use slices/max_nal_size", OFFSET(slice_mode), AV_OPT_TYPE_INT, { .i64 = SM_FIXEDSLCNUM_SLICE }, SM_SINGLE_SLICE, SM_RESERVED, VE|DEPRECATED, "slice_mode" },
> #else
> -    { "slice_mode", "set slice mode", OFFSET(slice_mode), AV_OPT_TYPE_INT, { .i64 = SM_AUTO_SLICE }, SM_SINGLE_SLICE, SM_RESERVED, VE, "slice_mode" },
> +    { "slice_mode", "set slice mode, use slices/max_nal_size", OFFSET(slice_mode), AV_OPT_TYPE_INT, { .i64 = SM_AUTO_SLICE }, SM_SINGLE_SLICE, SM_RESERVED, VE|DEPRECATED, "slice_mode" },
> #endif
>         { "fixed", "a fixed number of slices", 0, AV_OPT_TYPE_CONST, { .i64 = SM_FIXEDSLCNUM_SLICE }, 0, 0, VE, "slice_mode" },
> #if OPENH264_VER_AT_LEAST(1, 6)
> @@ -71,6 +73,7 @@ static const AVOption options[] = {
>         { "auto", "automatic number of slices according to number of threads", 0, AV_OPT_TYPE_CONST, { .i64 = SM_AUTO_SLICE }, 0, 0, VE, "slice_mode" },
>         { "dyn", "Dynamic slicing", 0, AV_OPT_TYPE_CONST, { .i64 = SM_DYN_SLICE }, 0, 0, VE, "slice_mode" },
> #endif
> +#endif
>     { "loopfilter", "enable loop filter", OFFSET(loopfilter), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE },
>     { "profile", "set profile restrictions", OFFSET(profile), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VE },
>     { "max_nal_size", "set maximum NAL size in bytes", OFFSET(max_nal_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 278f6be..83075e4 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -135,6 +135,9 @@
> #ifndef FF_API_UNSANITIZED_BITRATES
> #define FF_API_UNSANITIZED_BITRATES (LIBAVCODEC_VERSION_MAJOR < 59)
> #endif
> +#ifndef FF_API_OPENH264_SLICE_MODE
> +#define FF_API_OPENH264_SLICE_MODE (LIBAVCODEC_VERSION_MAJOR < 59)
> +#endif
> 
> 
> #endif /* AVCODEC_VERSION_H */
> -- 
> 2.7.4

This looks ok.

// Martin



More information about the ffmpeg-devel mailing list