From 1dd26f0a4a901274481a12689b86c9599be97284 Mon Sep 17 00:00:00 2001 From: gnattu Date: Sat, 12 Oct 2024 16:40:46 +0800 Subject: [PATCH] lavc/videotoolboxenc: always set pixel buffer info --- ...et-videotoolboxenc-pixel-buffer-info.patch | 31 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 32 insertions(+) create mode 100644 debian/patches/0076-alway-set-videotoolboxenc-pixel-buffer-info.patch diff --git a/debian/patches/0076-alway-set-videotoolboxenc-pixel-buffer-info.patch b/debian/patches/0076-alway-set-videotoolboxenc-pixel-buffer-info.patch new file mode 100644 index 00000000000..df99d8c8bc4 --- /dev/null +++ b/debian/patches/0076-alway-set-videotoolboxenc-pixel-buffer-info.patch @@ -0,0 +1,31 @@ +Index: FFmpeg/libavcodec/videotoolboxenc.c +=================================================================== +--- FFmpeg.orig/libavcodec/videotoolboxenc.c ++++ FFmpeg/libavcodec/videotoolboxenc.c +@@ -1034,9 +1034,10 @@ static int create_cv_pixel_buffer_info(A + CFNumberRef width_num = NULL; + CFNumberRef height_num = NULL; + CFMutableDictionaryRef pixel_buffer_info = NULL; ++ enum AVPixelFormat pix_fmt = avctx->pix_fmt == AV_PIX_FMT_VIDEOTOOLBOX ? avctx->sw_pix_fmt : avctx->pix_fmt; + int cv_color_format; + int status = get_cv_pixel_format(avctx, +- avctx->pix_fmt, ++ pix_fmt, + avctx->color_range, + &cv_color_format, + NULL); +@@ -1687,11 +1688,9 @@ static int vtenc_configure_encoder(AVCod + kCFBooleanTrue); + } + +- if (avctx->pix_fmt != AV_PIX_FMT_VIDEOTOOLBOX) { +- status = create_cv_pixel_buffer_info(avctx, &pixel_buffer_info); +- if (status) +- goto init_cleanup; +- } ++ status = create_cv_pixel_buffer_info(avctx, &pixel_buffer_info); ++ if (status) ++ goto init_cleanup; + + vtctx->dts_delta = vtctx->has_b_frames ? -1 : 0; + diff --git a/debian/patches/series b/debian/patches/series index 28c2cdfaebd..89de7fae221 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -73,3 +73,4 @@ 0073-add-12bit-decoding-on-videotoolbox.patch 0074-fix-the-sub2video-perf-regressions.patch 0075-allow-vpl-qsv-to-init-with-the-legacy-msdk-path.patch +0076-alway-set-videotoolboxenc-pixel-buffer-info.patch