From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1F2BB49B9D for ; Wed, 3 Apr 2024 15:43:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 493CB68CE36; Wed, 3 Apr 2024 18:43:40 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AA3AE68CE36 for ; Wed, 3 Apr 2024 18:43:33 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1712159013; bh=EtLIoShw5LrbqC2ir/+8zb4HM0lyOrhoxavuBMN1nkw=; h=From:To:Cc:Subject:Date:From; b=uY/3Bg7s+cCK7gG8rPxVgmlK/g4AXrXICC3kPX9NjjZMhosS0fFGwMDIJ0UOhUxq/ c/ENzCvdzuBTN0Wj5/Kpyk6TJ6Kfa4GeIMYDYMSgKao0cxcwCywTwOIv+gFKWapNGo GSObDKFHYMjcw+SzY5cjj3RpiZkpWYI57gxgds1w= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 742C04105D; Wed, 3 Apr 2024 17:43:33 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Wed, 3 Apr 2024 17:43:21 +0200 Message-ID: <20240403154330.71585-1-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/10] avcodec: add dolbyvision option X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Niklas Haas Tri-state yes/no/auto option. Allows users to set `dolbyvision` to `no` to suppress coding dolby vision even when supported by the target codec. --- doc/APIchanges | 3 +++ doc/codecs.texi | 12 ++++++++++++ libavcodec/avcodec.h | 11 +++++++++++ libavcodec/options_table.h | 2 ++ libavcodec/version.h | 2 +- 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 7eda1321cb0..a4484ceb670 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-03-23 - f17e18d2922 - lavc 61.6.100 - avcodec.h + Add AVCodecContext.dolbyvision option. + 2024-04-xx - xxxxxxxxxx - lavu 59.12.100 - dovi_meta.h Add AVDOVIMetadata.ext_block_{offset,size}, AVDOVIMetadata.num_ext_blocks, AVDOVIDmData and AVDOVIDmLevel{1..6,8..11,254..255}, av_dovi_get_ext() diff --git a/doc/codecs.texi b/doc/codecs.texi index 6bdeb664e72..7203adc0489 100644 --- a/doc/codecs.texi +++ b/doc/codecs.texi @@ -1018,6 +1018,18 @@ Note: The required alignment depends on if @code{AV_CODEC_FLAG_UNALIGNED} is set CPU. @code{AV_CODEC_FLAG_UNALIGNED} cannot be changed from the command line. Also hardware decoders will not apply left/top Cropping. +@item dolbyvision @var{integer} (@emph{encoding,video}) +Whether to encode Dolby Vision metadata when transcoding. +Possible values: +@table @samp +@item auto +Enable when coded frames contain Dolby Vision side data (default) +@item yes/on +Enable always, error out when frames do not contain metadata +@item no/off +Disable always, strip any tagged metadata +@end table + @end table diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 83dc487251c..f54f758608d 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2075,6 +2075,17 @@ typedef struct AVCodecContext { */ AVFrameSideData **decoded_side_data; int nb_decoded_side_data; + + /** + * Video encoding only. Whether to mark the coded stream as Dolby Vision. + * If set to FF_DOLBYVISION_AUTO, this will be enabled only if + * decoded_side_data contains a valid RPU. + * + * If enabled, sending frames without AV_FRAME_DATA_DOVI_METADATA is + * considered an error. + */ + int dolbyvision; +#define FF_DOLBYVISION_AUTO -1 } AVCodecContext; /** diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 7a2ef3474e7..d92269d2ff7 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -407,6 +407,8 @@ static const AVOption avcodec_options[] = { {"mastering_display_metadata", .default_val.i64 = AV_PKT_DATA_MASTERING_DISPLAY_METADATA, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, {"content_light_level", .default_val.i64 = AV_PKT_DATA_CONTENT_LIGHT_LEVEL, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, {"icc_profile", .default_val.i64 = AV_PKT_DATA_ICC_PROFILE, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, +{"dolbyvision", "flag stream as Dolby Vision", OFFSET(dolbyvision), AV_OPT_TYPE_INT, {.i64 = FF_DOLBYVISION_AUTO }, -1, 1, V|E, .unit = "dolbyvision" }, +{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DOLBYVISION_AUTO }, .flags = V|E, .unit = "dolbyvision" }, {NULL}, }; diff --git a/libavcodec/version.h b/libavcodec/version.h index 7aa95fc3f1c..da54f878874 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 5 +#define LIBAVCODEC_VERSION_MINOR 6 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.44.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".