[vlc-devel] [PATCH] direct3d9: support rendering of D3D9 surfaces coming out of DXVA2

Jean-Baptiste Kempf jb at videolan.org
Tue Apr 28 22:38:29 CEST 2015


On 28 Apr, Steve Lhomme wrote :
> +#include "../../src/win32/direct3d9_pool.h"

This is fugly :)

> +    { "DXVANV12",   MAKEFOURCC('N','V','1','2'),    VLC_CODEC_D3D9_OPAQUE,  0,0,0 },

"DXVA" should be enough, no?

> -
> -    /* Create a surface */
> -    LPDIRECT3DSURFACE9 surface;
> -    HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(d3ddev,
> -                                                              fmt->i_visible_width,
> -                                                              fmt->i_visible_height,
> -                                                              d3dfmt->format,
> -                                                              D3DPOOL_DEFAULT,
> -                                                              &surface,
> -                                                              NULL);
> -    if (FAILED(hr)) {
> -        msg_Err(vd, "Failed to create picture surface. (hr=0x%lx)", hr);
> -        return VLC_EGENERIC;
> -    }
> +    if ( fmt->i_chroma != VLC_CODEC_D3D9_OPAQUE )

Most of the code that follow seems to be just a reindentation, in this
case, until the end of function,
Why not do if ( fmt->i_chroma == VLC_CODEC_D3D9_OPAQUE ) return; ?

>      /* Copy picture surface into texture surface
>       * color space conversion happen here */
> -    RECT cropSource;
> -    cropSource.left = 0;
> -    cropSource.top = 0;
> -    cropSource.right = vd->fmt.i_visible_width;
> -    cropSource.bottom = vd->fmt.i_visible_height;
> -    hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, &cropSource, destination, NULL, D3DTEXF_LINEAR);
> +    hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, NULL, destination, NULL, D3DTEXF_LINEAR);

Why don't you need the crop anymore?

With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device



More information about the vlc-devel mailing list