Esempio n. 1
0
File: d3d11va.c Progetto: DZW314/mpv
        MP_ERR(p, "Failed to map D3D11 surface: %s\n", mp_HRESULT_to_str(hr));
        talloc_free(sw_img);
        return img;
    }
    copy_nv12(sw_img, lock.pData, lock.RowPitch, texture_desc.Height);
    ID3D11DeviceContext_Unmap(p->device_ctx, (ID3D11Resource *)staging, 0);

    mp_image_set_size(sw_img, img->w, img->h);
    mp_image_copy_attributes(sw_img, img);
    talloc_free(img);
    return sw_img;
}

#define DFMT(name) MP_CONCAT(DXGI_FORMAT_, name), # name
static const struct d3d_decoded_format d3d11_formats[] = {
    {DFMT(NV12),  8, IMGFMT_NV12},
    {DFMT(P010), 10, IMGFMT_P010},
    {DFMT(P016), 16, IMGFMT_P010},
};
#undef DFMT

// Update hw_subfmt to the underlying format. Needed because AVFrame does not
// have such an attribute, so it can't be passed through, and is updated here
// instead. (But in the future, AVHWFramesContext could be used.)
static struct mp_image *d3d11va_update_image_attribs(struct lavc_ctx *s,
                                                     struct mp_image *img)
{
    ID3D11Texture2D *texture = (void *)img->planes[1];

    if (!texture)
        return img;
Esempio n. 2
0
File: d3d11va.c Progetto: 2ion/mpv
    mp_image_set_size(sw_img, img->w, img->h);
    mp_image_copy_attributes(sw_img, img);
    talloc_free(img);
    return sw_img;
}

struct d3d11_format {
    DXGI_FORMAT format;
    const char *name;
    int         depth;
};

#define DFMT(name) MP_CONCAT(DXGI_FORMAT_, name), # name
static const struct d3d11_format d3d11_formats[] = {
    {DFMT(NV12),  8},
    {DFMT(P010), 10},
    {DFMT(P016), 16},
};
#undef DFMT

static BOOL d3d11_format_supported(struct lavc_ctx *s, const GUID *guid,
                                   const struct d3d11_format *format)
{
    struct priv *p = s->hwdec_priv;
    BOOL is_supported = FALSE;
    HRESULT hr = ID3D11VideoDevice_CheckVideoDecoderFormat(
        p->video_dev, guid, format->format, &is_supported);
    if (FAILED(hr)) {
        MP_ERR(p, "Check decoder output format %s for decoder %s: %s\n",
               format->name, d3d_decoder_guid_to_desc(guid),