Skip to content

Commit

Permalink
contrib: update FFmpeg to version 7.0.1
Browse files Browse the repository at this point in the history
Backport a patch to fix build on gcc 14.1.
  • Loading branch information
galad87 committed May 30, 2024
1 parent b428abb commit faa2f3c
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 3 deletions.
96 changes: 96 additions & 0 deletions contrib/ffmpeg/A19-fix-qsv-on-gcc-14.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
From 45d31614bcc54c5ccbaabf07e7336ac477e2b424 Mon Sep 17 00:00:00 2001
From: oltolm <[email protected]>
Date: Fri, 17 May 2024 21:10:49 +0200
Subject: [PATCH] avutil/hwcontext_qsv: fix GCC 14.1 warnings

Tested-by: Tong Wu <[email protected]>
Signed-off-by: oltolm <[email protected]>
---
libavutil/hwcontext_qsv.c | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 8b7b4dc501..f3d919daea 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -36,6 +36,7 @@
#include "hwcontext_d3d11va.h"
#endif
#if CONFIG_DXVA2
+#include <initguid.h>
#include "hwcontext_dxva2.h"
#endif

@@ -904,9 +905,11 @@ static int qsv_d3d9_update_config(void *ctx, mfxHDL handle, mfxConfig cfg)
#if CONFIG_DXVA2
mfxStatus sts;
IDirect3DDeviceManager9* devmgr = handle;
- IDirect3DDevice9Ex *device = NULL;
+ IDirect3DDevice9 *device = NULL;
+ IDirect3DDevice9Ex *device_ex = NULL;
HANDLE device_handle = 0;
IDirect3D9Ex *d3d9ex = NULL;
+ IDirect3D9 *d3d9 = NULL;
LUID luid;
D3DDEVICE_CREATION_PARAMETERS params;
HRESULT hr;
@@ -924,18 +927,31 @@ static int qsv_d3d9_update_config(void *ctx, mfxHDL handle, mfxConfig cfg)
IDirect3DDeviceManager9_CloseDeviceHandle(devmgr, device_handle);
goto fail;
}
+ hr = IDirect3DDevice9_QueryInterface(device, &IID_IDirect3DDevice9Ex, (void **)&device_ex);
+ IDirect3DDevice9_Release(device);
+ if (FAILED(hr)) {
+ av_log(ctx, AV_LOG_ERROR, "Error IDirect3DDevice9_QueryInterface %d\n", hr);
+ goto unlock;
+ }

- hr = IDirect3DDevice9Ex_GetCreationParameters(device, &params);
+ hr = IDirect3DDevice9Ex_GetCreationParameters(device_ex, &params);
if (FAILED(hr)) {
av_log(ctx, AV_LOG_ERROR, "Error IDirect3DDevice9_GetCreationParameters %d\n", hr);
- IDirect3DDevice9Ex_Release(device);
+ IDirect3DDevice9Ex_Release(device_ex);
goto unlock;
}

- hr = IDirect3DDevice9Ex_GetDirect3D(device, &d3d9ex);
+ hr = IDirect3DDevice9Ex_GetDirect3D(device_ex, &d3d9);
if (FAILED(hr)) {
- av_log(ctx, AV_LOG_ERROR, "Error IDirect3DDevice9Ex_GetAdapterLUID %d\n", hr);
- IDirect3DDevice9Ex_Release(device);
+ av_log(ctx, AV_LOG_ERROR, "Error IDirect3DDevice9Ex_GetDirect3D %d\n", hr);
+ IDirect3DDevice9Ex_Release(device_ex);
+ goto unlock;
+ }
+ hr = IDirect3D9_QueryInterface(d3d9, &IID_IDirect3D9Ex, (void **)&d3d9ex);
+ IDirect3D9_Release(d3d9);
+ if (FAILED(hr)) {
+ av_log(ctx, AV_LOG_ERROR, "Error IDirect3D9_QueryInterface3D %d\n", hr);
+ IDirect3DDevice9Ex_Release(device_ex);
goto unlock;
}

@@ -959,7 +975,7 @@ static int qsv_d3d9_update_config(void *ctx, mfxHDL handle, mfxConfig cfg)

release:
IDirect3D9Ex_Release(d3d9ex);
- IDirect3DDevice9Ex_Release(device);
+ IDirect3DDevice9Ex_Release(device_ex);

unlock:
IDirect3DDeviceManager9_UnlockDevice(devmgr, device_handle, FALSE);
@@ -1519,8 +1535,9 @@ static int qsv_frames_derive_from(AVHWFramesContext *dst_ctx,
case AV_HWDEVICE_TYPE_D3D11VA:
{
D3D11_TEXTURE2D_DESC texDesc;
+ AVD3D11VAFramesContext *dst_hwctx;
dst_ctx->initial_pool_size = src_ctx->initial_pool_size;
- AVD3D11VAFramesContext *dst_hwctx = dst_ctx->hwctx;
+ dst_hwctx = dst_ctx->hwctx;
dst_hwctx->texture_infos = av_calloc(src_hwctx->nb_surfaces,
sizeof(*dst_hwctx->texture_infos));
if (!dst_hwctx->texture_infos)
--
2.25.1

6 changes: 3 additions & 3 deletions contrib/ffmpeg/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ endif
$(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,$(__deps__)))
$(eval $(call import.CONTRIB.defs,FFMPEG))

FFMPEG.FETCH.url = https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs/ffmpeg-7.0.tar.bz2
FFMPEG.FETCH.url += https://ffmpeg.org/releases/ffmpeg-7.0.tar.bz2
FFMPEG.FETCH.sha256 = a24d9074bf5523a65aaa9e7bd02afe4109ce79d69bd77d104fed3dab4b934d7a
FFMPEG.FETCH.url = https://github.com/HandBrake/HandBrake-contribs/releases/download/contribs2/ffmpeg-7.0.1.tar.bz2
FFMPEG.FETCH.url += https://ffmpeg.org/releases/ffmpeg-7.0.1.tar.bz2
FFMPEG.FETCH.sha256 = 5e77e84b6434d656106fafe3bceccc77176449014f3eba24d33db3fbd0939dc9

FFMPEG.GCC.args.c_std =

Expand Down

0 comments on commit faa2f3c

Please sign in to comment.