Example #1
0
bool VideoDecoderDXVAPrivate::open()
{
    if (!prepare())
        return false;
    if (codec_ctx->codec_id == QTAV_CODEC_ID(HEVC)) {
        // runtime hevc check
        if (isHEVCSupported()) {
            qWarning("HEVC DXVA2 is supported by current FFmpeg runtime.");
        } else {
            qWarning("HEVC DXVA2 is not supported by current FFmpeg runtime.");
            return false;
        }
    }
    if (!D3dCreateDevice()) {
        qWarning("Failed to create Direct3D device");
        goto error;
    }
    qDebug("D3dCreateDevice succeed");
    if (!D3dCreateDeviceManager()) {
        qWarning("D3dCreateDeviceManager failed");
        goto error;
    }
    if (!DxCreateVideoService()) {
        qWarning("DxCreateVideoService failed");
        goto error;
    }
    if (!DxFindVideoServiceConversion(&input, &render)) {
        qWarning("DxFindVideoServiceConversion failed");
        goto error;
    }
    IDirect3DDevice9Ex *devEx;
    d3ddev->QueryInterface(IID_IDirect3DDevice9Ex, (void**)&devEx);
    qDebug("using D3D9Ex: %d", !!devEx);
    // runtime check gles for dynamic gl
#if QTAV_HAVE(DXVA_EGL)
    if (OpenGLHelper::isOpenGLES()) {
        // d3d9ex is required to share d3d resource. It's available in vista and later. d3d9 can not CreateTexture with shared handle
        if (devEx)
            interop_res = dxva::InteropResourcePtr(new dxva::EGLInteropResource(d3ddev));
        else
            qDebug("D3D9Ex is not available. Disable 0-copy.");
    }
#endif
    SafeRelease(&devEx);
#if QTAV_HAVE(DXVA_GL)
    if (!OpenGLHelper::isOpenGLES())
        interop_res = dxva::InteropResourcePtr(new dxva::GLInteropResource(d3ddev));
#endif
    return true;
error:
    close();
    return false;
}
Example #2
0
bool VideoDecoderDXVAPrivate::open()
{
    if (codec_ctx->codec_id == QTAV_CODEC_ID(HEVC)) {
        // runtime hevc check
        if (isHEVCSupported()) {
            qWarning("HEVC DXVA2 is supported by current FFmpeg runtime.");
        } else {
            qWarning("HEVC DXVA2 is not supported by current FFmpeg runtime.");
            return false;
        }
    }
    if (!D3dCreateDevice()) {
        qWarning("Failed to create Direct3D device");
        goto error;
    }
    qDebug("D3dCreateDevice succeed");
    if (!D3dCreateDeviceManager()) {
        qWarning("D3dCreateDeviceManager failed");
        goto error;
    }
    if (!DxCreateVideoService()) {
        qWarning("DxCreateVideoService failed");
        goto error;
    }
    if (!DxFindVideoServiceConversion(&input, &render)) {
        qWarning("DxFindVideoServiceConversion failed");
        goto error;
    }
    IDirect3DDevice9Ex *devEx;
    d3ddev->QueryInterface(IID_IDirect3DDevice9Ex, (void**)&devEx);
    qDebug("using D3D9Ex: %d", !!devEx);
    SafeRelease(&devEx);
    /* TODO print the hardware name/vendor for debugging purposes */
    return true;
error:
    close();
    return false;
}
Example #3
0
bool VideoDecoderD3DPrivate::open()
{
    if (!prepare())
        return false;
    if (codec_ctx->codec_id == QTAV_CODEC_ID(HEVC)) {
        // runtime hevc check
        if (!isHEVCSupported()) {
            qWarning("HEVC DXVA2/D3D11VA is not supported by current FFmpeg runtime.");
            return false;
        }
    }
    if (!createDevice())
        return false;
    format_fcc = 0;
    QVector<GUID> codecs = getSupportedCodecs();
    const d3d_format_t *fmt = getFormat(codec_ctx, codecs, &codec_guid);
    if (!fmt)
        return false;
    format_fcc = fmt->fourcc;
    if (!setupSurfaceInterop())
        return false;
    return true;
}