From d421beadb7fee82caf0d2bb6072f411e280dec70 Mon Sep 17 00:00:00 2001 From: Raboneko <119771935+raboneko@users.noreply.github.com> Date: Wed, 3 Sep 2025 11:20:30 -0700 Subject: [PATCH] fix(ffmpeg): Track LCEVCdec, update patches, drop libnpp for now (#5993) (#6290) * Rebase on F42 * Empty commit I hate GitHub * This URL is unreachable with the source fetching cURL params currently * GCC14 real this time? * Okay * Gonna have to figure something else out * Death * I guess maybe * ? * Try removing Wall again I guess * Oops * IDK * Update configure.patch * Update ffmpeg.spec * Update ffmpeg.spec * Update ffmpeg.spec * Update ffmpeg.spec * Update ffmpeg.spec * Update ffmpeg.spec * chore: Also track LCEVCdec * chore: Change some patches * Update ffmpeg.spec * Update ffmpeg.spec * chore: Disable libnpp because it's just BROKEN * chore(update.rhai): Comment out libnpp tracking for now * chore: Delete ffmpeg-nvcc.patch --------- (cherry picked from commit 6fb5fa85ebf30d4924ec0f35e459632422aceebd) Signed-off-by: Gilver Co-authored-by: Gilver Co-authored-by: madomado --- VERSION_libnpp.txt | 1 + anda/multimedia/ffmpeg/VERSION_LCEVCdec.txt | 1 + .../multimedia/ffmpeg/ffmpeg-LCEVCdec-4.patch | 40 +++ anda/multimedia/ffmpeg/ffmpeg-chromium.patch | 1 + anda/multimedia/ffmpeg/ffmpeg-nvcc.patch | 12 - anda/multimedia/ffmpeg/ffmpeg.spec | 25 +- anda/multimedia/ffmpeg/update.rhai | 2 + ffmpeg-LCEVCdec-4.patch | 40 +++ ffmpeg-decklink-14.4.patch | 327 ++++++++++++++++++ 9 files changed, 420 insertions(+), 29 deletions(-) create mode 100644 VERSION_libnpp.txt create mode 100644 anda/multimedia/ffmpeg/VERSION_LCEVCdec.txt create mode 100644 anda/multimedia/ffmpeg/ffmpeg-LCEVCdec-4.patch delete mode 100644 anda/multimedia/ffmpeg/ffmpeg-nvcc.patch create mode 100644 ffmpeg-LCEVCdec-4.patch create mode 100644 ffmpeg-decklink-14.4.patch diff --git a/VERSION_libnpp.txt b/VERSION_libnpp.txt new file mode 100644 index 0000000000..6d15e4097d --- /dev/null +++ b/VERSION_libnpp.txt @@ -0,0 +1 @@ +13.0.0.50 diff --git a/anda/multimedia/ffmpeg/VERSION_LCEVCdec.txt b/anda/multimedia/ffmpeg/VERSION_LCEVCdec.txt new file mode 100644 index 0000000000..1454f6ed4b --- /dev/null +++ b/anda/multimedia/ffmpeg/VERSION_LCEVCdec.txt @@ -0,0 +1 @@ +4.0.1 diff --git a/anda/multimedia/ffmpeg/ffmpeg-LCEVCdec-4.patch b/anda/multimedia/ffmpeg/ffmpeg-LCEVCdec-4.patch new file mode 100644 index 0000000000..ff266b17b2 --- /dev/null +++ b/anda/multimedia/ffmpeg/ffmpeg-LCEVCdec-4.patch @@ -0,0 +1,40 @@ +--- a/libavcodec/lcevcdec.c ++++ b/libavcodec/lcevcdec.c +@@ -139,7 +139,7 @@ static int lcevc_send_frame(void *logctx + if (!sd) + return 1; + +- res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, in->pts, 0, sd->data, sd->size); ++ res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, (uint64_t) in->pts, sd->data, sd->size); + if (res != LCEVC_Success) + return AVERROR_EXTERNAL; + +@@ -147,7 +147,7 @@ static int lcevc_send_frame(void *logctx + if (ret < 0) + return ret; + +- res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, 0, picture, -1, NULL); ++ res = LCEVC_SendDecoderBase(lcevc->decoder, (uint64_t) in->pts, picture, -1, NULL); + if (res != LCEVC_Success) + return AVERROR_EXTERNAL; + +--- a/libavfilter/vf_lcevc.c ++++ b/libavfilter/vf_lcevc.c +@@ -139,7 +139,7 @@ static int send_frame(AVFilterLink *inlink, AVFrame *in) + return ret; + + if (sd) { +- res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, in->pts, 0, sd->data, sd->size); ++ res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, (uint64_t) in->pts, sd->data, sd->size); + if (res == LCEVC_Again) + return AVERROR(EAGAIN); + else if (res != LCEVC_Success) { +@@ -148,7 +148,7 @@ static int send_frame(AVFilterLink *inlink, AVFrame *in) + } + } + +- res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, 0, picture, -1, in); ++ res = LCEVC_SendDecoderBase(lcevc->decoder, (uint64_t) in->pts, picture, -1, in); + if (res != LCEVC_Success) { + av_log(ctx, AV_LOG_ERROR, "LCEVC_SendDecoderBase failed\n"); + LCEVC_FreePicture(lcevc->decoder, picture); diff --git a/anda/multimedia/ffmpeg/ffmpeg-chromium.patch b/anda/multimedia/ffmpeg/ffmpeg-chromium.patch index cf9b9c8d6f..2d9d364c30 100644 --- a/anda/multimedia/ffmpeg/ffmpeg-chromium.patch +++ b/anda/multimedia/ffmpeg/ffmpeg-chromium.patch @@ -28,3 +28,4 @@ diff -Naur ffmpeg-7.1.1.old/libavformat/utils.c ffmpeg-7.1.1/libavformat/utils.c + /* an arbitrarily chosen "sane" max packet size -- 50M */ #define SANE_CHUNK_SIZE (50000000) + diff --git a/anda/multimedia/ffmpeg/ffmpeg-nvcc.patch b/anda/multimedia/ffmpeg/ffmpeg-nvcc.patch deleted file mode 100644 index 88ae668455..0000000000 --- a/anda/multimedia/ffmpeg/ffmpeg-nvcc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Naur ffmpeg-7.1.1.old/configure ffmpeg-7.1.1/configure ---- ffmpeg-7.1.1.old/configure 2025-03-24 11:04:46.377074634 +0100 -+++ ffmpeg-7.1.1/configure 2025-03-24 11:04:54.615698726 +0100 -@@ -6742,7 +6742,7 @@ - nvccflags=$nvccflags_default - fi - --nvccflags="$nvccflags -std=c++11" -+nvccflags="$nvccflags -std=c++14" - - if enabled x86_64 || enabled ppc64 || enabled aarch64; then - nvccflags="$nvccflags -m64" diff --git a/anda/multimedia/ffmpeg/ffmpeg.spec b/anda/multimedia/ffmpeg/ffmpeg.spec index da82c8b17a..c2b317a10f 100644 --- a/anda/multimedia/ffmpeg/ffmpeg.spec +++ b/anda/multimedia/ffmpeg/ffmpeg.spec @@ -11,9 +11,9 @@ Summary: A complete solution to record, convert and stream audio and video Name: ffmpeg -Version: 8.0 -Release: 1%?dist -License: LGPL-3.0-or-later +Version: 7.1.1 +Release: 5%{?dist} +License: LGPLv3+ URL: http://%{name}.org/ Epoch: 1 @@ -26,8 +26,8 @@ Patch2: %{name}-HandBrake.patch # https://bugzilla.redhat.com/show_bug.cgi?id=2240127 # Reference: https://crbug.com/1306560 Patch3: %{name}-chromium.patch -# Fix build with recent NVCC: -Patch4: %{name}-nvcc.patch +# Support LCEVCdec 4.0+: +Patch5: https://aur.archlinux.org/cgit/aur.git/plain/080-ffmpeg-lcevcdec4.0.0-fix.patch?h=ffmpeg-full#/%{name}-LCEVCdec-4.patch BuildRequires: AMF-devel >= 1.4.28 BuildRequires: bzip2-devel @@ -70,6 +70,7 @@ BuildRequires: pkgconfig(dav1d) >= 0.5.0 BuildRequires: pkgconfig(davs2) >= 1.6.0 BuildRequires: pkgconfig(dvdnav) >= 6.1.1 BuildRequires: pkgconfig(fdk-aac) +BuildRequires: pkgconfig(ffnvcodec) >= 12.0.16.0 BuildRequires: pkgconfig(fontconfig) BuildRequires: pkgconfig(freetype2) BuildRequires: pkgconfig(fribidi) @@ -150,10 +151,6 @@ BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(zvbi-0.2) >= 0.2.28 %ifarch x86_64 aarch64 -# Nvidia CUVID support and Performance Primitives based code -BuildRequires: cuda-cudart-devel -BuildRequires: cuda-nvcc -BuildRequires: libnpp-devel BuildRequires: pkgconfig(ffnvcodec) >= 12.0.16.0 %endif @@ -400,12 +397,6 @@ This subpackage contains the headers for FFmpeg libswscale. #sed -i -e 's|#!/bin/sh|#!/bin/sh -x|g' configure %build -# Work around a new GCC15 change until FFmpeg updates for it -%if 0%{?fedora} >= 42 -%if "%{version}" <= "7.1.1" -export CFLAGS="%{optflags} -Wno-incompatible-pointer-types" -%endif -%endif %set_build_flags ./configure \ @@ -422,6 +413,7 @@ export CFLAGS="%{optflags} -Wno-incompatible-pointer-types" --enable-alsa \ --enable-bzlib \ --enable-chromaprint \ + --disable-cuda-nvcc \ --enable-frei0r \ --enable-gcrypt \ --enable-gmp \ @@ -465,6 +457,7 @@ export CFLAGS="%{optflags} -Wno-incompatible-pointer-types" --enable-libmodplug \ --enable-libmp3lame \ --enable-libmysofa \ + --disable-libnpp \ --enable-libopencore-amrnb \ --enable-libopencore-amrwb \ --disable-libopencv \ @@ -545,10 +538,8 @@ export CFLAGS="%{optflags} -Wno-incompatible-pointer-types" --prefix=%{_prefix} \ --shlibdir=%{_libdir} \ %ifarch x86_64 aarch64 - --enable-cuda-nvcc \ --enable-cuvid \ --enable-ffnvcodec \ - --enable-libnpp \ --enable-nvdec \ --enable-nvenc \ --extra-cflags="-I%{_includedir}/cuda" \ diff --git a/anda/multimedia/ffmpeg/update.rhai b/anda/multimedia/ffmpeg/update.rhai index c7c838cb2d..5999c26a90 100644 --- a/anda/multimedia/ffmpeg/update.rhai +++ b/anda/multimedia/ffmpeg/update.rhai @@ -6,6 +6,8 @@ rpm.version(find(`ffmpeg-([\d.]+?)\.tar\.xz`, get("https://ffmpeg open_file("anda/multimedia/ffmpeg/VERSION_x265.txt", "w").write(bump::madoguchi("x265", labels.branch)); open_file("anda/multimedia/ffmpeg/VERSION_tesseract.txt", "w").write(bump::bodhi("tesseract", bump::as_bodhi_ver(labels.branch))); open_file("anda/multimedia/ffmpeg/VERSION_vvenc.txt", "w").write(bump::madoguchi("vvenc-libs", labels.branch)); +// open_file("anda/multimedia/ffmpeg/VERSION_libnpp.txt", "w").write(bump::madoguchi("libnpp", labels.branch)); +open_file("anda/multimedia/ffmpeg/VERSION_LCEVCdec.txt", "w").write(bump::madoguchi("LCEVCdec", labels.branch)); let dir = sub(`/[^/]+$`, "", __script_path); if sh("[[ `git status " + dir + " --porcelain` ]] && exit 1 || exit 0", #{}).ctx.rc == 1 { diff --git a/ffmpeg-LCEVCdec-4.patch b/ffmpeg-LCEVCdec-4.patch new file mode 100644 index 0000000000..ff266b17b2 --- /dev/null +++ b/ffmpeg-LCEVCdec-4.patch @@ -0,0 +1,40 @@ +--- a/libavcodec/lcevcdec.c ++++ b/libavcodec/lcevcdec.c +@@ -139,7 +139,7 @@ static int lcevc_send_frame(void *logctx + if (!sd) + return 1; + +- res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, in->pts, 0, sd->data, sd->size); ++ res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, (uint64_t) in->pts, sd->data, sd->size); + if (res != LCEVC_Success) + return AVERROR_EXTERNAL; + +@@ -147,7 +147,7 @@ static int lcevc_send_frame(void *logctx + if (ret < 0) + return ret; + +- res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, 0, picture, -1, NULL); ++ res = LCEVC_SendDecoderBase(lcevc->decoder, (uint64_t) in->pts, picture, -1, NULL); + if (res != LCEVC_Success) + return AVERROR_EXTERNAL; + +--- a/libavfilter/vf_lcevc.c ++++ b/libavfilter/vf_lcevc.c +@@ -139,7 +139,7 @@ static int send_frame(AVFilterLink *inlink, AVFrame *in) + return ret; + + if (sd) { +- res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, in->pts, 0, sd->data, sd->size); ++ res = LCEVC_SendDecoderEnhancementData(lcevc->decoder, (uint64_t) in->pts, sd->data, sd->size); + if (res == LCEVC_Again) + return AVERROR(EAGAIN); + else if (res != LCEVC_Success) { +@@ -148,7 +148,7 @@ static int send_frame(AVFilterLink *inlink, AVFrame *in) + } + } + +- res = LCEVC_SendDecoderBase(lcevc->decoder, in->pts, 0, picture, -1, in); ++ res = LCEVC_SendDecoderBase(lcevc->decoder, (uint64_t) in->pts, picture, -1, in); + if (res != LCEVC_Success) { + av_log(ctx, AV_LOG_ERROR, "LCEVC_SendDecoderBase failed\n"); + LCEVC_FreePicture(lcevc->decoder, picture); diff --git a/ffmpeg-decklink-14.4.patch b/ffmpeg-decklink-14.4.patch new file mode 100644 index 0000000000..d6606a4a72 --- /dev/null +++ b/ffmpeg-decklink-14.4.patch @@ -0,0 +1,327 @@ +From 7cdcac1a8ca650aeebda36afc695dfbe02a55ebb Mon Sep 17 00:00:00 2001 +From: pabloko +Date: Wed, 25 Dec 2024 04:00:35 +0100 +Subject: [PATCH 1/2] SDK 14.4 + +--- + libavdevice/decklink_common.cpp | 8 ++++---- + libavdevice/decklink_common.h | 4 ++-- + libavdevice/decklink_dec.cpp | 34 ++++++++++++++++++++------------- + libavdevice/decklink_enc.cpp | 22 ++++++++++++++------- + 4 files changed, 42 insertions(+), 26 deletions(-) + +diff --git a/libavdevice/decklink_common.cpp b/libavdevice/decklink_common.cpp +index 47de7ef6b0f7c..34cd17a129f6a 100644 +--- a/libavdevice/decklink_common.cpp ++++ b/libavdevice/decklink_common.cpp +@@ -512,8 +512,8 @@ int ff_decklink_list_devices(AVFormatContext *avctx, + return AVERROR(EIO); + + while (ret == 0 && iter->Next(&dl) == S_OK) { +- IDeckLinkOutput *output_config; +- IDeckLinkInput *input_config; ++ IDeckLinkOutput_v14_2_1 *output_config; ++ IDeckLinkInput_v14_2_1 *input_config; + const char *display_name = NULL; + const char *unique_name = NULL; + AVDeviceInfo *new_device = NULL; +@@ -527,14 +527,14 @@ int ff_decklink_list_devices(AVFormatContext *avctx, + goto next; + + if (show_outputs) { +- if (dl->QueryInterface(IID_IDeckLinkOutput, (void **)&output_config) == S_OK) { ++ if (dl->QueryInterface(IID_IDeckLinkOutput_v14_2_1, (void **)&output_config) == S_OK) { + output_config->Release(); + add = 1; + } + } + + if (show_inputs) { +- if (dl->QueryInterface(IID_IDeckLinkInput, (void **)&input_config) == S_OK) { ++ if (dl->QueryInterface(IID_IDeckLinkInput_v14_2_1, (void **)&input_config) == S_OK) { + input_config->Release(); + add = 1; + } +diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h +index 6b32dc2d09cba..4f836aee66cd3 100644 +--- a/libavdevice/decklink_common.h ++++ b/libavdevice/decklink_common.h +@@ -93,8 +93,8 @@ typedef struct DecklinkPacketQueue { + struct decklink_ctx { + /* DeckLink SDK interfaces */ + IDeckLink *dl; +- IDeckLinkOutput *dlo; +- IDeckLinkInput *dli; ++ IDeckLinkOutput_v14_2_1 *dlo; ++ IDeckLinkInput_v14_2_1 *dli; + IDeckLinkConfiguration *cfg; + IDeckLinkProfileAttributes *attr; + decklink_output_callback *output_callback; +diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp +index 418701e4e0c7a..a2a3ac95b8514 100644 +--- a/libavdevice/decklink_dec.cpp ++++ b/libavdevice/decklink_dec.cpp +@@ -105,13 +105,13 @@ static VANCLineNumber vanc_line_numbers[] = { + {bmdModeUnknown, 0, -1, -1, -1} + }; + +-class decklink_allocator : public IDeckLinkMemoryAllocator ++class decklink_allocator : public IDeckLinkMemoryAllocator_v14_2_1 + { + public: + decklink_allocator(): _refs(1) { } + virtual ~decklink_allocator() { } + +- // IDeckLinkMemoryAllocator methods ++ // IDeckLinkMemoryAllocator_v14_2_1 methods + virtual HRESULT STDMETHODCALLTYPE AllocateBuffer(unsigned int bufferSize, void* *allocatedBuffer) + { + void *buf = av_malloc(bufferSize + AV_INPUT_BUFFER_PADDING_SIZE); +@@ -129,7 +129,11 @@ class decklink_allocator : public IDeckLinkMemoryAllocator + virtual HRESULT STDMETHODCALLTYPE Decommit() { return S_OK; } + + // IUnknown methods +- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; } ++ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) ++ { ++ if (iid == IID_IDeckLinkMemoryAllocator_v14_2_1) { *ppv = (IDeckLinkMemoryAllocator_v14_2_1*)this; AddRef(); return S_OK; } ++ return E_NOINTERFACE; ++ } + virtual ULONG STDMETHODCALLTYPE AddRef(void) { return ++_refs; } + virtual ULONG STDMETHODCALLTYPE Release(void) + { +@@ -472,7 +476,7 @@ static uint8_t *get_metadata(AVFormatContext *avctx, uint16_t *buf, size_t width + } + + +-static void handle_klv(AVFormatContext *avctx, decklink_ctx *ctx, IDeckLinkVideoInputFrame *videoFrame, int64_t pts) ++static void handle_klv(AVFormatContext *avctx, decklink_ctx *ctx, IDeckLinkVideoInputFrame_v14_2_1 *videoFrame, int64_t pts) + { + const uint8_t KLV_DID = 0x44; + const uint8_t KLV_IN_VANC_SDID = 0x04; +@@ -574,17 +578,21 @@ static void handle_klv(AVFormatContext *avctx, decklink_ctx *ctx, IDeckLinkVideo + } + } + +-class decklink_input_callback : public IDeckLinkInputCallback ++class decklink_input_callback : public IDeckLinkInputCallback_v14_2_1 + { + public: + explicit decklink_input_callback(AVFormatContext *_avctx); + ~decklink_input_callback(); + +- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; } ++ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) ++ { ++ if (iid == IID_IDeckLinkInputCallback_v14_2_1) { *ppv = (IDeckLinkInputCallback_v14_2_1*)this; AddRef(); return S_OK; } ++ return E_NOINTERFACE; ++ } + virtual ULONG STDMETHODCALLTYPE AddRef(void); + virtual ULONG STDMETHODCALLTYPE Release(void); + virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags); +- virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*); ++ virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame_v14_2_1*, IDeckLinkAudioInputPacket*); + + private: + std::atomic _refs; +@@ -593,7 +601,7 @@ class decklink_input_callback : public IDeckLinkInputCallback + int no_video; + int64_t initial_video_pts; + int64_t initial_audio_pts; +- IDeckLinkVideoInputFrame* last_video_frame; ++ IDeckLinkVideoInputFrame_v14_2_1* last_video_frame; + }; + + decklink_input_callback::decklink_input_callback(AVFormatContext *_avctx) : _refs(1) +@@ -625,7 +633,7 @@ ULONG decklink_input_callback::Release(void) + return ret; + } + +-static int64_t get_pkt_pts(IDeckLinkVideoInputFrame *videoFrame, ++static int64_t get_pkt_pts(IDeckLinkVideoInputFrame_v14_2_1 *videoFrame, + IDeckLinkAudioInputPacket *audioFrame, + int64_t wallclock, + int64_t abs_wallclock, +@@ -679,7 +687,7 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame *videoFrame, + return pts; + } + +-static int get_bmd_timecode(AVFormatContext *avctx, AVTimecode *tc, AVRational frame_rate, BMDTimecodeFormat tc_format, IDeckLinkVideoInputFrame *videoFrame) ++static int get_bmd_timecode(AVFormatContext *avctx, AVTimecode *tc, AVRational frame_rate, BMDTimecodeFormat tc_format, IDeckLinkVideoInputFrame_v14_2_1 *videoFrame) + { + IDeckLinkTimecode *timecode; + int ret = AVERROR(ENOENT); +@@ -701,7 +709,7 @@ static int get_bmd_timecode(AVFormatContext *avctx, AVTimecode *tc, AVRational f + return ret; + } + +-static int get_frame_timecode(AVFormatContext *avctx, decklink_ctx *ctx, AVTimecode *tc, IDeckLinkVideoInputFrame *videoFrame) ++static int get_frame_timecode(AVFormatContext *avctx, decklink_ctx *ctx, AVTimecode *tc, IDeckLinkVideoInputFrame_v14_2_1 *videoFrame) + { + AVRational frame_rate = ctx->video_st->r_frame_rate; + int ret; +@@ -726,7 +734,7 @@ static int get_frame_timecode(AVFormatContext *avctx, decklink_ctx *ctx, AVTimec + } + + HRESULT decklink_input_callback::VideoInputFrameArrived( +- IDeckLinkVideoInputFrame *videoFrame, IDeckLinkAudioInputPacket *audioFrame) ++ IDeckLinkVideoInputFrame_v14_2_1 *videoFrame, IDeckLinkAudioInputPacket *audioFrame) + { + void *frameBytes; + void *audioFrameBytes; +@@ -1141,7 +1149,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) + goto error; + + /* Get input device. */ +- if (ctx->dl->QueryInterface(IID_IDeckLinkInput, (void **) &ctx->dli) != S_OK) { ++ if (ctx->dl->QueryInterface(IID_IDeckLinkInput_v14_2_1, (void **) &ctx->dli) != S_OK) { + av_log(avctx, AV_LOG_ERROR, "Could not open input device from '%s'\n", + avctx->url); + ret = AVERROR(EIO); +diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp +index cb8f91730eeb3..28da8b24f5010 100644 +--- a/libavdevice/decklink_enc.cpp ++++ b/libavdevice/decklink_enc.cpp +@@ -48,7 +48,7 @@ extern "C" { + #endif + + /* DeckLink callback class declaration */ +-class decklink_frame : public IDeckLinkVideoFrame ++class decklink_frame : public IDeckLinkVideoFrame_v14_2_1 + { + public: + decklink_frame(struct decklink_ctx *ctx, AVFrame *avframe, AVCodecID codec_id, int height, int width) : +@@ -111,7 +111,11 @@ class decklink_frame : public IDeckLinkVideoFrame + _ancillary->AddRef(); + return S_OK; + } +- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; } ++ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) ++ { ++ if (iid == IID_IDeckLinkVideoFrame_v14_2_1) { *ppv = (IDeckLinkVideoFrame_v14_2_1*)this; AddRef(); return S_OK; } ++ return E_NOINTERFACE; ++ } + virtual ULONG STDMETHODCALLTYPE AddRef(void) { return ++_refs; } + virtual ULONG STDMETHODCALLTYPE Release(void) + { +@@ -138,10 +142,10 @@ class decklink_frame : public IDeckLinkVideoFrame + std::atomic _refs; + }; + +-class decklink_output_callback : public IDeckLinkVideoOutputCallback ++class decklink_output_callback : public IDeckLinkVideoOutputCallback_v14_2_1 + { + public: +- virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted(IDeckLinkVideoFrame *_frame, BMDOutputFrameCompletionResult result) ++ virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted(IDeckLinkVideoFrame_v14_2_1 *_frame, BMDOutputFrameCompletionResult result) + { + decklink_frame *frame = static_cast(_frame); + struct decklink_ctx *ctx = frame->_ctx; +@@ -159,7 +163,11 @@ class decklink_output_callback : public IDeckLinkVideoOutputCallback + return S_OK; + } + virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped(void) { return S_OK; } +- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; } ++ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) ++ { ++ if (iid == IID_IDeckLinkVideoOutputCallback_v14_2_1) { *ppv = (IDeckLinkVideoOutputCallback_v14_2_1*)this; AddRef(); return S_OK; } ++ return E_NOINTERFACE; ++ } + virtual ULONG STDMETHODCALLTYPE AddRef(void) { return 1; } + virtual ULONG STDMETHODCALLTYPE Release(void) { return 1; } + }; +@@ -739,7 +747,7 @@ static int decklink_write_video_packet(AVFormatContext *avctx, AVPacket *pkt) + ctx->first_pts = pkt->pts; + + /* Schedule frame for playback. */ +- hr = ctx->dlo->ScheduleVideoFrame((class IDeckLinkVideoFrame *) frame, ++ hr = ctx->dlo->ScheduleVideoFrame((class IDeckLinkVideoFrame_v14_2_1 *) frame, + pkt->pts * ctx->bmd_tb_num, + ctx->bmd_tb_num, ctx->bmd_tb_den); + /* Pass ownership to DeckLink, or release on failure */ +@@ -874,7 +882,7 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx) + return ret; + + /* Get output device. */ +- if (ctx->dl->QueryInterface(IID_IDeckLinkOutput, (void **) &ctx->dlo) != S_OK) { ++ if (ctx->dl->QueryInterface(IID_IDeckLinkOutput_v14_2_1, (void **) &ctx->dlo) != S_OK) { + av_log(avctx, AV_LOG_ERROR, "Could not open output device from '%s'\n", + avctx->url); + ret = AVERROR(EIO); + +From 9b4249693423c47df7b4b876d4777e2feb972fb5 Mon Sep 17 00:00:00 2001 +From: pabloko +Date: Wed, 8 Jan 2025 00:59:07 +0100 +Subject: [PATCH 2/2] format + +--- + libavdevice/decklink_dec.cpp | 14 +++++++++++--- + libavdevice/decklink_enc.cpp | 16 +++++++++++++--- + 2 files changed, 24 insertions(+), 6 deletions(-) + +diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp +index a2a3ac95b8514..28b523c8fd433 100644 +--- a/libavdevice/decklink_dec.cpp ++++ b/libavdevice/decklink_dec.cpp +@@ -131,7 +131,11 @@ class decklink_allocator : public IDeckLinkMemoryAllocator_v14_2_1 + // IUnknown methods + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) + { +- if (iid == IID_IDeckLinkMemoryAllocator_v14_2_1) { *ppv = (IDeckLinkMemoryAllocator_v14_2_1*)this; AddRef(); return S_OK; } ++ if (iid == IID_IDeckLinkMemoryAllocator_v14_2_1) { ++ *ppv = (IDeckLinkMemoryAllocator_v14_2_1*)this; ++ AddRef(); ++ return S_OK; ++ } + return E_NOINTERFACE; + } + virtual ULONG STDMETHODCALLTYPE AddRef(void) { return ++_refs; } +@@ -585,8 +589,12 @@ class decklink_input_callback : public IDeckLinkInputCallback_v14_2_1 + ~decklink_input_callback(); + + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) +- { +- if (iid == IID_IDeckLinkInputCallback_v14_2_1) { *ppv = (IDeckLinkInputCallback_v14_2_1*)this; AddRef(); return S_OK; } ++ { ++ if (iid == IID_IDeckLinkInputCallback_v14_2_1) { ++ *ppv = (IDeckLinkInputCallback_v14_2_1*)this; ++ AddRef(); ++ return S_OK; ++ } + return E_NOINTERFACE; + } + virtual ULONG STDMETHODCALLTYPE AddRef(void); +diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp +index 28da8b24f5010..5bed55dc4fae6 100644 +--- a/libavdevice/decklink_enc.cpp ++++ b/libavdevice/decklink_enc.cpp +@@ -113,7 +113,12 @@ class decklink_frame : public IDeckLinkVideoFrame_v14_2_1 + } + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) + { +- if (iid == IID_IDeckLinkVideoFrame_v14_2_1) { *ppv = (IDeckLinkVideoFrame_v14_2_1*)this; AddRef(); return S_OK; } ++ if (iid == IID_IDeckLinkVideoFrame_v14_2_1) ++ { ++ *ppv = (IDeckLinkVideoFrame_v14_2_1*)this; ++ AddRef(); ++ return S_OK; ++ } + return E_NOINTERFACE; + } + virtual ULONG STDMETHODCALLTYPE AddRef(void) { return ++_refs; } +@@ -164,8 +169,13 @@ class decklink_output_callback : public IDeckLinkVideoOutputCallback_v14_2_1 + } + virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped(void) { return S_OK; } + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) +- { +- if (iid == IID_IDeckLinkVideoOutputCallback_v14_2_1) { *ppv = (IDeckLinkVideoOutputCallback_v14_2_1*)this; AddRef(); return S_OK; } ++ { ++ if (iid == IID_IDeckLinkVideoOutputCallback_v14_2_1) ++ { ++ *ppv = (IDeckLinkVideoOutputCallback_v14_2_1*)this; ++ AddRef(); ++ return S_OK; ++ } + return E_NOINTERFACE; + } + virtual ULONG STDMETHODCALLTYPE AddRef(void) { return 1; }