[FFmpeg-devel] [PATCH 2/3] lavc: clarify meaning of avctx.level option

Stefano Sabatini stefasab at gmail.com
Sat Aug 26 04:10:29 EEST 2023


---
 doc/codecs.texi            | 5 ++++-
 libavcodec/avcodec.h       | 4 +++-
 libavcodec/options_table.h | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/doc/codecs.texi b/doc/codecs.texi
index f903dad754..0aa848f62f 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -697,10 +697,13 @@ profiles are documented in the relevant encoder documentation.
 
 @item level @var{integer} (@emph{encoding,audio,video})
 
+Set the encoder level. This level depends on the specific codec, and
+might correspond to the profile level. It is set by default to
+ at samp{unknown}.
+
 Possible values:
 @table @samp
 @item unknown
-
 @end table
 
 @item lowres @var{integer} (@emph{decoding,audio,video})
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 649411ac79..50d2086c13 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1722,7 +1722,9 @@ typedef struct AVCodecContext {
 
     /**
      * level
-     * - encoding: Set by user.
+     * - encoding: Set by user, corresponds to a specific level defined by the
+     *   codec, usually corresponding to the profile level, if not specified it
+     *   set to FF_LEVEL_UNKNOWN
      * - decoding: Set by libavcodec.
      */
      int level;
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index bb4b894b06..5f0d674dbe 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -226,7 +226,7 @@ static const AVOption avcodec_options[] = {
 {"profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E|CC, "avctx.profile"},
 {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "avctx.profile"},
 {"main10",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, V|E, "avctx.profile"},
-{"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E|CC, "avctx.level"},
+{"level", "encoding level, usually corresponding to the profile level, codec-specific", OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E|CC, "avctx.level"},
 {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "avctx.level"},
 {"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|A|D},
 {"cmp", "full-pel ME compare function", OFFSET(me_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
-- 
2.34.1



More information about the ffmpeg-devel mailing list