History

libavfilter/vf_scale_qsv: enabling d3d11va support, added mfxhdlpair

Adding DX11 relevant device type checks and adjusting callback with proper MediaSDK pair type support.

Artem Galin committed 5 years ago

Commit 46c69461 parent 36166cc1 file · +18 −13Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_scale_qsv.c+18−13
@@ -70,6 +70,7 @@ enum var_name { · 69 unmodified lines
7070 };
7171
7272 #define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19)
73+#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
7374
7475 typedef struct QSVScaleContext {
7576 const AVClass *class;
@@ -259,16 +260,16 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) · 183 unmodified lines
259260
260261 static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
261262 {
262− *hdl = mid;
263+ mfxHDLPair *pair_dst = (mfxHDLPair*)hdl;
264+ mfxHDLPair *pair_src = (mfxHDLPair*)mid;
265+
266+ pair_dst->first = pair_src->first;
267+
268+ if (pair_src->second != (mfxMemId)MFX_INFINITE)
269+ pair_dst->second = pair_src->second;
263270 return MFX_ERR_NONE;
264271 }
265272
266−static const mfxHandleType handle_types[] = {
267− MFX_HANDLE_VA_DISPLAY,
268− MFX_HANDLE_D3D9_DEVICE_MANAGER,
269− MFX_HANDLE_D3D11_DEVICE,
270−};
271−
272273 static int init_out_session(AVFilterContext *ctx)
273274 {
274275
@@ -300,14 +301,18 @@ static int init_out_session(AVFilterContext *ctx) · 25 unmodified lines
300301 return AVERROR_UNKNOWN;
301302 }
302303
303− for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) {
304− err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], &handle);
305− if (err == MFX_ERR_NONE) {
306− handle_type = handle_types[i];
307− break;
308− }
304+ if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) {
305+ handle_type = MFX_HANDLE_VA_DISPLAY;
306+ } else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) {
307+ handle_type = MFX_HANDLE_D3D11_DEVICE;
308+ } else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) {
309+ handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER;
310+ } else {
311+ av_log(ctx, AV_LOG_ERROR, "Error unsupported handle type\n");
312+ return AVERROR_UNKNOWN;
309313 }
310314
315+ err = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, &handle);
311316 if (err < 0)
312317 return ff_qsvvpp_print_error(ctx, err, "Error getting the session handle");
313318 else if (err > 0) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t