[FFmpeg-devel] [PATCH] avcodec/nvenc: Add options for level and tier

Clément Bœsch u at pkh.me
Sat Apr 4 11:15:43 CEST 2015


On Fri, Apr 03, 2015 at 06:23:05PM +0200, Timo Rothenpieler wrote:
> ---
>  libavcodec/nvenc.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 110 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index f77a982..d4e0a39 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -129,6 +129,12 @@ typedef struct NvencDynLoadFunctions
>  #endif
>  } NvencDynLoadFunctions;
>  
> +typedef struct NvencValuePair
> +{
> +    const char *str;
> +    uint32_t num;
> +} NvencValuePair;
> +
>  typedef struct NvencContext
>  {
>      AVClass *avclass;
> @@ -152,11 +158,76 @@ typedef struct NvencContext
>  
>      char *preset;
>      char *profile;
> +    char *level;
> +    char *tier;
>      int cbr;
>      int twopass;
>      int gpu;
>  } NvencContext;
>  
> +static const NvencValuePair nvenc_h264_level_pairs[] = {
> +    { "auto", NV_ENC_LEVEL_AUTOSELECT },
> +    { "1",    NV_ENC_LEVEL_H264_1     },
> +    { "1.0",  NV_ENC_LEVEL_H264_1     },
> +    { "1b",   NV_ENC_LEVEL_H264_1b    },
> +    { "1.0b", NV_ENC_LEVEL_H264_1b    },
> +    { "1.1",  NV_ENC_LEVEL_H264_11    },
> +    { "1.2",  NV_ENC_LEVEL_H264_12    },
> +    { "1.3",  NV_ENC_LEVEL_H264_13    },
> +    { "2",    NV_ENC_LEVEL_H264_2     },
> +    { "2.0",  NV_ENC_LEVEL_H264_2     },
> +    { "2.1",  NV_ENC_LEVEL_H264_21    },
> +    { "2.2",  NV_ENC_LEVEL_H264_22    },
> +    { "3",    NV_ENC_LEVEL_H264_3     },
> +    { "3.0",  NV_ENC_LEVEL_H264_3     },
> +    { "3.1",  NV_ENC_LEVEL_H264_31    },
> +    { "3.2",  NV_ENC_LEVEL_H264_32    },
> +    { "4",    NV_ENC_LEVEL_H264_4     },
> +    { "4.0",  NV_ENC_LEVEL_H264_4     },
> +    { "4.1",  NV_ENC_LEVEL_H264_41    },
> +    { "4.2",  NV_ENC_LEVEL_H264_42    },
> +    { "5",    NV_ENC_LEVEL_H264_5     },
> +    { "5.0",  NV_ENC_LEVEL_H264_5     },
> +    { "5.1",  NV_ENC_LEVEL_H264_51    },
> +    { NULL }
> +};
> +

You can use AV_OPT_CONST instead of this.

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150404/51c5df84/attachment.asc>


More information about the ffmpeg-devel mailing list