diff mbox series

[FFmpeg-devel,12/12] fftools/ffmpeg_opt: set default hwaccel_output_format for mediacodec

Message ID tencent_B3E356079CCCE13A5BFC34D7801834E33E09@qq.com
State New
Headers show
Series Add MediaCodec encoder and NDK MediaCodec support | 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 Oct. 24, 2022, 3:16 a.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

---
 fftools/ffmpeg_opt.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 9245e02813..9c15858c05 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -785,6 +785,10 @@  static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
                     "with old commandlines. This behaviour is DEPRECATED and will be removed "
                     "in the future. Please explicitly set \"-hwaccel_output_format qsv\".\n");
                 ist->hwaccel_output_format = AV_PIX_FMT_QSV;
+            } else if (!hwaccel_output_format && hwaccel && !strcmp(hwaccel, "mediacodec")) {
+                // There is no real AVHWFrameContext implementation. Set
+                // hwaccel_output_format to avoid av_hwframe_transfer_data error.
+                ist->hwaccel_output_format = AV_PIX_FMT_MEDIACODEC;
             } else if (hwaccel_output_format) {
                 ist->hwaccel_output_format = av_get_pix_fmt(hwaccel_output_format);
                 if (ist->hwaccel_output_format == AV_PIX_FMT_NONE) {