@ -42,6 +42,8 @@
# include "internal.h"
# include "internal.h"
# include "video.h"
# include "video.h"
# define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
enum {
enum {
QSVDEINT_MORE_OUTPUT = 1 ,
QSVDEINT_MORE_OUTPUT = 1 ,
QSVDEINT_MORE_INPUT ,
QSVDEINT_MORE_INPUT ,
@ -144,16 +146,16 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
static mfxStatus frame_get_hdl ( mfxHDL pthis , mfxMemId mid , mfxHDL * hdl )
static mfxStatus frame_get_hdl ( mfxHDL pthis , mfxMemId mid , mfxHDL * hdl )
{
{
* hdl = mid ;
mfxHDLPair * pair_dst = ( mfxHDLPair * ) hdl ;
mfxHDLPair * pair_src = ( mfxHDLPair * ) mid ;
pair_dst - > first = pair_src - > first ;
if ( pair_src - > second ! = ( mfxMemId ) MFX_INFINITE )
pair_dst - > second = pair_src - > second ;
return MFX_ERR_NONE ;
return MFX_ERR_NONE ;
}
}
static const mfxHandleType handle_types [ ] = {
MFX_HANDLE_VA_DISPLAY ,
MFX_HANDLE_D3D9_DEVICE_MANAGER ,
MFX_HANDLE_D3D11_DEVICE ,
} ;
static int init_out_session ( AVFilterContext * ctx )
static int init_out_session ( AVFilterContext * ctx )
{
{
@ -181,14 +183,18 @@ static int init_out_session(AVFilterContext *ctx)
return AVERROR_UNKNOWN ;
return AVERROR_UNKNOWN ;
}
}
for ( i = 0 ; i < FF_ARRAY_ELEMS ( handle_types ) ; i + + ) {
if ( MFX_IMPL_VIA_VAAPI = = MFX_IMPL_VIA_MASK ( impl ) ) {
err = MFXVideoCORE_GetHandle ( device_hwctx - > session , handle_types [ i ] , & handle ) ;
handle_type = MFX_HANDLE_VA_DISPLAY ;
if ( err = = MFX_ERR_NONE ) {
} else if ( MFX_IMPL_VIA_D3D11 = = MFX_IMPL_VIA_MASK ( impl ) ) {
handle_type = handle_types [ i ] ;
handle_type = MFX_HANDLE_D3D11_DEVICE ;
break ;
} else if ( MFX_IMPL_VIA_D3D9 = = MFX_IMPL_VIA_MASK ( impl ) ) {
}
handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER ;
} else {
av_log ( ctx , AV_LOG_ERROR , " Error unsupported handle type \n " ) ;
return AVERROR_UNKNOWN ;
}
}
err = MFXVideoCORE_GetHandle ( device_hwctx - > session , handle_type , & handle ) ;
if ( err < 0 )
if ( err < 0 )
return ff_qsvvpp_print_error ( ctx , err , " Error getting the session handle " ) ;
return ff_qsvvpp_print_error ( ctx , err , " Error getting the session handle " ) ;
else if ( err > 0 ) {
else if ( err > 0 ) {