diff mbox series

[FFmpeg-devel,2/2] avcodec/mediacodecenc: pass colorspace info to encoder

Message ID tencent_B9ADA54A731F284753E2936235D7691D0E05@qq.com
State Accepted
Commit f543f12817a2c11e942dc3f3eca78287417e13fa
Headers show
Series [FFmpeg-devel,1/2] avcodec/mediacodecdec: refactor color space utils | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili March 10, 2023, 8:48 p.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
---
 libavcodec/mediacodecenc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/mediacodecenc.c b/libavcodec/mediacodecenc.c
index a92a8dc5a9..2ab56597fe 100644
--- a/libavcodec/mediacodecenc.c
+++ b/libavcodec/mediacodecenc.c
@@ -243,6 +243,16 @@  static av_cold int mediacodec_init(AVCodecContext *avctx)
         }
     }
 
+    ret = ff_AMediaFormatColorRange_from_AVColorRange(avctx->color_range);
+    if (ret != COLOR_RANGE_UNSPECIFIED)
+        ff_AMediaFormat_setInt32(format, "color-range", ret);
+    ret = ff_AMediaFormatColorStandard_from_AVColorSpace(avctx->colorspace);
+    if (ret != COLOR_STANDARD_UNSPECIFIED)
+        ff_AMediaFormat_setInt32(format, "color-standard", ret);
+    ret = ff_AMediaFormatColorTransfer_from_AVColorTransfer(avctx->color_trc);
+    if (ret != COLOR_TRANSFER_UNSPECIFIED)
+        ff_AMediaFormat_setInt32(format, "color-transfer", ret);
+
     if (avctx->bit_rate)
         ff_AMediaFormat_setInt32(format, "bitrate", avctx->bit_rate);
     if (s->bitrate_mode >= 0)