Commit 4a422c22 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Screen Win32: cosmetics

parent 97c0744f
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software Foundation,
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_modules.h> #include <vlc_modules.h> /* module_need for "video blending" */
#include "screen.h" #include "screen.h"
/***************************************************************************** /*****************************************************************************
......
/***************************************************************************** /*****************************************************************************
* win32.c: Screen capture module. * win32.c: Screen capture module.
***************************************************************************** *****************************************************************************
* Copyright (C) 2004-2008 the VideoLAN team * Copyright (C) 2004-2011 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Gildas Bazin <gbazin@videolan.org> * Authors: Gildas Bazin <gbazin@videolan.org>
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software Foundation,
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
/***************************************************************************** /*****************************************************************************
...@@ -33,10 +33,6 @@ ...@@ -33,10 +33,6 @@
#include "screen.h" #include "screen.h"
#ifndef CAPTUREBLT
# define CAPTUREBLT (DWORD)0x40000000 /* Include layered windows */
#endif
struct screen_data_t struct screen_data_t
{ {
HDC hdc_src; HDC hdc_src;
...@@ -90,8 +86,7 @@ int screen_InitCapture( demux_t *p_demux ) ...@@ -90,8 +86,7 @@ int screen_InitCapture( demux_t *p_demux )
case 32: case 32:
i_chroma = VLC_CODEC_RGB32; break; i_chroma = VLC_CODEC_RGB32; break;
default: default:
msg_Err( p_demux, "unknown screen depth %i", msg_Err( p_demux, "unknown screen depth %i", i_bits_per_pixel );
p_sys->fmt.video.i_bits_per_pixel );
DeleteDC( p_data->hdc_dst ); DeleteDC( p_data->hdc_dst );
ReleaseDC( 0, p_data->hdc_src ); ReleaseDC( 0, p_data->hdc_src );
free( p_data ); free( p_data );
...@@ -128,7 +123,6 @@ int screen_InitCapture( demux_t *p_demux ) ...@@ -128,7 +123,6 @@ int screen_InitCapture( demux_t *p_demux )
break; break;
} }
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -181,7 +175,7 @@ static block_t *CaptureBlockNew( demux_t *p_demux ) ...@@ -181,7 +175,7 @@ static block_t *CaptureBlockNew( demux_t *p_demux )
p_data->bmi.bmiHeader.biBitCount = p_sys->fmt.video.i_bits_per_pixel; p_data->bmi.bmiHeader.biBitCount = p_sys->fmt.video.i_bits_per_pixel;
p_data->bmi.bmiHeader.biCompression = BI_RGB; p_data->bmi.bmiHeader.biCompression = BI_RGB;
p_data->bmi.bmiHeader.biSizeImage = 0; p_data->bmi.bmiHeader.biSizeImage = 0;
p_data->bmi.bmiHeader.biXPelsPerMeter = p_data->bmi.bmiHeader.biXPelsPerMeter = 0;
p_data->bmi.bmiHeader.biYPelsPerMeter = 0; p_data->bmi.bmiHeader.biYPelsPerMeter = 0;
p_data->bmi.bmiHeader.biClrUsed = 0; p_data->bmi.bmiHeader.biClrUsed = 0;
p_data->bmi.bmiHeader.biClrImportant = 0; p_data->bmi.bmiHeader.biClrImportant = 0;
...@@ -204,8 +198,7 @@ static block_t *CaptureBlockNew( demux_t *p_demux ) ...@@ -204,8 +198,7 @@ static block_t *CaptureBlockNew( demux_t *p_demux )
if( !hbmp || !p_buffer ) if( !hbmp || !p_buffer )
{ {
msg_Err( p_demux, "cannot create bitmap" ); msg_Err( p_demux, "cannot create bitmap" );
if( hbmp ) DeleteObject( hbmp ); goto error;
return NULL;
} }
/* Select the bitmap into the compatible DC */ /* Select the bitmap into the compatible DC */
...@@ -217,16 +210,13 @@ static block_t *CaptureBlockNew( demux_t *p_demux ) ...@@ -217,16 +210,13 @@ static block_t *CaptureBlockNew( demux_t *p_demux )
if( !p_data->hgdi_backup ) if( !p_data->hgdi_backup )
{ {
msg_Err( p_demux, "cannot select bitmap" ); msg_Err( p_demux, "cannot select bitmap" );
DeleteObject( hbmp ); goto error;
return NULL;
} }
/* Build block */ /* Build block */
if( !(p_block = malloc( sizeof( block_t ) + sizeof( block_sys_t ) )) ) if( !(p_block = malloc( sizeof( block_t ) + sizeof( block_sys_t ) )) )
{ goto error;
DeleteObject( hbmp );
return NULL;
}
/* Fill all fields */ /* Fill all fields */
i_buffer = (p_sys->fmt.video.i_bits_per_pixel + 7) / 8 * i_buffer = (p_sys->fmt.video.i_bits_per_pixel + 7) / 8 *
p_sys->fmt.video.i_width * p_sys->fmt.video.i_height; p_sys->fmt.video.i_width * p_sys->fmt.video.i_height;
...@@ -235,6 +225,10 @@ static block_t *CaptureBlockNew( demux_t *p_demux ) ...@@ -235,6 +225,10 @@ static block_t *CaptureBlockNew( demux_t *p_demux )
p_block->hbmp = hbmp; p_block->hbmp = hbmp;
return &p_block->self; return &p_block->self;
error:
if( hbmp ) DeleteObject( hbmp );
return NULL;
} }
block_t *screen_Capture( demux_t *p_demux ) block_t *screen_Capture( demux_t *p_demux )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment