[MPlayer-dev-eng] Direct3D OSD discussion

Diego Biurrun diego at biurrun.de
Thu Nov 27 23:46:59 CET 2008


On Wed, Nov 26, 2008 at 07:26:10PM +0000, Jim Hauxwell wrote:
> Diego Biurrun wrote:
> > On Wed, Nov 26, 2008 at 07:56:18AM +0000, Jim Hauxwell wrote:
> >>> This patch is broken and does not apply.  I suspect Windows linebreaks.
> >> Sorry, my mistake.  Visual Studio had decided to add CR/LF to all the
> >> lines and svn diff doesn't take this into account.
> >>
> >> New, smaller patch file
> >>
> >> --- libvo/vo_direct3d.c	(revision 28034)
> >> +++ libvo/vo_direct3d.c	(working copy)
> >> @@ -71,8 +71,14 @@
> >>      IDirect3DSurface9 *d3d_surface; /**< Offscreen Direct3D Surface. MPlayer
> >>                                      renders inside it. Uses colorspace
> >>                                      priv->movie_src_fmt */
> >> +	IDirect3DTexture9 *d3d_texture_osd; /**< Direct3D Texture. Uses RGBA */
> >> +	IDirect3DTexture9 *d3d_texture_system; /**< Direct3D Texture. System memory
> >> +										     cant lock a normal texture. Uses RGBA */
> > 
> > Do not add tabs to a file without tabs
> 
> Done

No.

> >> @@ -180,6 +207,25 @@
> >> +	/* kill the VB and the texture */
> >> +	if (priv->d3d_texture_osd != NULL)
> >> +	{
> > 
> > Respect the coding style of the file, keep braces on the same line as
> > the if.
> 
> Done

No.

> --- libvo/vo_direct3d.c	(revision 28042)
> +++ libvo/vo_direct3d.c	(working copy)
> @@ -71,8 +72,14 @@
> +    IDirect3DTexture9 *d3d_texture_osd; /**< Direct3D Texture. Uses RGBA */
> +    IDirect3DTexture9 *d3d_texture_system; /**< Direct3D Texture. System memory
> +                                    cant lock a normal texture. Uses RGBA */

cannot

> @@ -101,6 +108,22 @@
>  
> +#define OSD_TEXTURE_SIZE 1024   /* as this is a texture, it can be a different size to the movie */

than the movie

> @@ -264,6 +308,50 @@
>  
> +    /* create OSD */
> +    if (FAILED (IDirect3DDevice9_CreateTexture(
> +        priv->d3d_device, OSD_TEXTURE_SIZE, OSD_TEXTURE_SIZE, 1, D3DUSAGE_DYNAMIC,
> +        D3DFMT_A8L8, D3DPOOL_SYSTEMMEM, &priv->d3d_texture_system, NULL))) {
> +        mp_msg(MSGT_VO,MSGL_ERR,
> +        "<vo_direct3d><INFO>IDirect3DDevice9_CreateTexture Failed (d3d_texture_system).\n");

random indentation, same below

> +    memcpy( vertices, osd_quad_vb, sizeof(osd_quad_vb) );

No other function call in the file has spaces around the parentheses.

> +    /* populate the Y with the correct coordinate */

"the Y"?

> @@ -672,3 +753,133 @@
> +
> +    for (y=0; y < h; y++) {
> +        register unsigned short *dst = (unsigned short*) dstbase;
> +        register int x;
> +        for(x=0; x < w; x++) {
> +            if(srca[x])

You have spaces after if and for in other places.

> +        src+=srcstride;
> +        srca+=srcstride;
> +        dstbase+=dststride;

This would be more readable aligned and with spaces around the
operators.

> +        if (FAILED (IDirect3DTexture9_LockRect(priv->d3d_texture_system, 0,
> +                                   &locked_rect, NULL, 0))) {

random indentation

> +        if (FAILED(IDirect3DDevice9_EndScene(priv->d3d_device))) {
> +           mp_msg(MSGT_VO,MSGL_ERR,"<vo_direct3d>EndScene failed\n");
> +           return;

3 space indentation

Diego



More information about the MPlayer-dev-eng mailing list