diff options
Diffstat (limited to 'src/video_out')
-rwxr-xr-x | src/video_out/video_out_directx.c | 1650 | ||||
-rw-r--r-- | src/video_out/video_out_fb.c | 29 | ||||
-rw-r--r-- | src/video_out/video_out_sdl.c | 36 | ||||
-rw-r--r-- | src/video_out/video_out_stk.c | 48 | ||||
-rw-r--r-- | src/video_out/video_out_vidix.c | 100 | ||||
-rw-r--r-- | src/video_out/video_out_xshm.c | 44 | ||||
-rw-r--r-- | src/video_out/video_out_xv.c | 25 | ||||
-rw-r--r-- | src/video_out/video_out_xvmc.c | 102 | ||||
-rw-r--r-- | src/video_out/yuv2rgb.c | 14 |
9 files changed, 1000 insertions, 1048 deletions
diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index 4852b3e00..4f773d535 100755 --- a/src/video_out/video_out_directx.c +++ b/src/video_out/video_out_directx.c @@ -20,7 +20,7 @@ * video_out_directx.c, direct draw video output plugin for xine * by Matthew Grooms <elon@altavista.com> * - * $Id: video_out_directx.c,v 1.10 2003/11/11 18:45:00 f1rmb Exp $ + * $Id: video_out_directx.c,v 1.11 2003/11/26 19:43:37 f1rmb Exp $ */ typedef unsigned char boolean; @@ -32,1105 +32,1086 @@ typedef unsigned char boolean; #include "video_out.h" #include "video_out_win32.h" #include "alphablend.h" + +#define LOG_MODULE "video_out_directx" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "yuv2rgb.h" -/**/ -#define LOG 1 -/**/ - #define NEW_YUV 1 /* Set to 1 for RGB support */ -#define RGB_SUPPORT 0 - -#define BORDER_SIZE 8 -#define IMGFMT_NATIVE 4 - -// ----------------------------------------- -// -// vo_directx frame struct -// -// ----------------------------------------- - -typedef struct win32_frame_s -{ - vo_frame_t vo_frame; - - uint8_t * buffer; - int format; - int width; - int height; - int size; - double ratio; - -}win32_frame_t; - -// ----------------------------------------- -// -// vo_directx driver struct -// -// ----------------------------------------- - -typedef struct -{ - vo_driver_t vo_driver; - win32_visual_t * win32_visual; - - LPDIRECTDRAW7 ddobj; // direct draw object - LPDIRECTDRAWSURFACE primary; // primary dd surface - LPDIRECTDRAWSURFACE secondary; // secondary dd surface - LPDIRECTDRAWCLIPPER ddclipper; // dd clipper object - uint8_t * contents; // secondary contents - win32_frame_t *current; // current frame +#define RGB_SUPPORT 0 - int req_format; // requested frame format - int act_format; // actual frame format - int width; // frame with - int height; // frame height - double ratio; // frame ratio - - yuv2rgb_factory_t *yuv2rgb_factory; // used for format conversion - yuv2rgb_t *yuv2rgb; // used for format conversion - int mode; // rgb mode - int bytespp; // rgb bits per pixel - -}win32_driver_t; +#define BORDER_SIZE 8 +#define IMGFMT_NATIVE 4 +/* ----------------------------------------- + * + * vo_directx frame struct + * + * ----------------------------------------- */ typedef struct { - video_driver_class_t driver_class; + vo_frame_t vo_frame; + uint8_t *buffer; + int format; + int width; + int height; + int size; + double ratio; +} win32_frame_t; + +/* ----------------------------------------- + * + * vo_directx driver struct + * + * ----------------------------------------- */ - config_values_t *config; +typedef struct { + vo_driver_t vo_driver; + win32_visual_t *win32_visual; + + LPDIRECTDRAW7 ddobj; /* direct draw object */ + LPDIRECTDRAWSURFACE primary; /* primary dd surface */ + LPDIRECTDRAWSURFACE secondary; /* secondary dd surface */ + LPDIRECTDRAWCLIPPER ddclipper; /* dd clipper object */ + uint8_t * contents; /* secondary contents */ + win32_frame_t *current; /* current frame */ + + int req_format; /* requested frame format */ + int act_format; /* actual frame format */ + int width; /* frame with */ + int height; /* frame height */ + double ratio; /* frame ratio */ + + yuv2rgb_factory_t *yuv2rgb_factory; /* used for format conversion */ + yuv2rgb_t *yuv2rgb; /* used for format conversion */ + int mode; /* rgb mode */ + int bytespp; /* rgb bits per pixel */ +} win32_driver_t; - char *device_name; +typedef struct { + video_driver_class_t driver_class; + config_values_t *config; + char *device_name; } directx_class_t; -// ----------------------------------------- -// -// BEGIN : Direct Draw and win32 handlers -// for xine video output plugins. -// -// ----------------------------------------- +/* ----------------------------------------- + * + * BEGIN : Direct Draw and win32 handlers + * for xine video output plugins. + * + * ----------------------------------------- */ -// Display formatted error message in -// popup message box. +/* Display formatted error message in + * popup message box.*/ void Error( HWND hwnd, LPSTR szfmt, ... ) { - char tempbuff[ 256 ]; - *tempbuff = 0; - wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) ); - MessageBox( hwnd, tempbuff, "Error", MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL ); + char tempbuff[ 256 ]; + *tempbuff = 0; + wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) ); + MessageBox( hwnd, tempbuff, "Error", MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL ); } -// Update our drivers current knowledge -// of our windows video out posistion +/* Update our drivers current knowledge + * of our windows video out posistion */ void UpdateRect( win32_visual_t * win32_visual ) { - if( win32_visual->FullScreen ) + if( win32_visual->FullScreen ) { - SetRect( &win32_visual->WndRect, 0, 0, - GetSystemMetrics( SM_CXSCREEN ), - GetSystemMetrics( SM_CYSCREEN ) ); + SetRect( &win32_visual->WndRect, 0, 0, + GetSystemMetrics( SM_CXSCREEN ), + GetSystemMetrics( SM_CYSCREEN ) ); } - else + else { - GetClientRect( win32_visual->WndHnd, &win32_visual->WndRect ); - ClientToScreen( win32_visual->WndHnd, ( POINT * ) &win32_visual->WndRect ); - ClientToScreen( win32_visual->WndHnd, ( POINT * ) &win32_visual->WndRect + 1 ); + GetClientRect( win32_visual->WndHnd, &win32_visual->WndRect ); + ClientToScreen( win32_visual->WndHnd, ( POINT * ) &win32_visual->WndRect ); + ClientToScreen( win32_visual->WndHnd, ( POINT * ) &win32_visual->WndRect + 1 ); } } -// Create our direct draw object, primary -// surface and clipper object. -// -// NOTE : The primary surface is more or -// less a viewport into the parent desktop -// window and will always have a pixel format -// identical to the current display mode. +/* Create our direct draw object, primary + * surface and clipper object. + * + * NOTE : The primary surface is more or + * less a viewport into the parent desktop + * window and will always have a pixel format + * identical to the current display mode. */ boolean CreatePrimary( win32_driver_t * win32_driver ) { - LPDIRECTDRAW ddobj; - DDSURFACEDESC2 ddsd; - HRESULT result; + LPDIRECTDRAW ddobj; + DDSURFACEDESC2 ddsd; + HRESULT result; - // create direct draw object + /* create direct draw object */ - result = DirectDrawCreate( 0, &ddobj, 0 ); - if( result != DD_OK ) - { - Error( 0, "DirectDrawCreate : error %i", result ); - printf( "vo_out_directx : DirectDrawCreate : error %i\n", result ); - return 0; - } + result = DirectDrawCreate( 0, &ddobj, 0 ); + if( result != DD_OK ) + { + Error( 0, "DirectDrawCreate : error %i", result ); + printf( "vo_out_directx : DirectDrawCreate : error %i\n", result ); + return 0; + } - // set cooperative level + /* set cooperative level */ - result = IDirectDraw_SetCooperativeLevel( ddobj, win32_driver->win32_visual->WndHnd, DDSCL_NORMAL ); - if( result != DD_OK ) - { - Error( 0, "SetCooperativeLevel : error %i", result ); - return 0; - } + result = IDirectDraw_SetCooperativeLevel( ddobj, win32_driver->win32_visual->WndHnd, DDSCL_NORMAL ); + if( result != DD_OK ) + { + Error( 0, "SetCooperativeLevel : error %i", result ); + return 0; + } - // try to get new interface + /* try to get new interface */ - result = IDirectDraw_QueryInterface( ddobj, &IID_IDirectDraw7, (LPVOID *) &win32_driver->ddobj ); - if( result != DD_OK ) - { - Error( 0, "ddobj->QueryInterface : DirectX 7 or higher required" ); - return 0; - } + result = IDirectDraw_QueryInterface( ddobj, &IID_IDirectDraw7, (LPVOID *) &win32_driver->ddobj ); + if( result != DD_OK ) + { + Error( 0, "ddobj->QueryInterface : DirectX 7 or higher required" ); + return 0; + } - // release our old interface + /* release our old interface */ - IDirectDraw_Release( ddobj ); + IDirectDraw_Release( ddobj ); - // create primary_surface + /* create primary_surface */ - memset( &ddsd, 0, sizeof( ddsd ) ); - ddsd.dwSize = sizeof( ddsd ); - ddsd.dwFlags = DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - result = IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->primary, 0 ); - if( result != DD_OK ) - { - Error( 0, "CreateSurface ( primary ) : error %i ", result ); - return 0; - } + result = IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->primary, 0 ); + if( result != DD_OK ) + { + Error( 0, "CreateSurface ( primary ) : error %i ", result ); + return 0; + } - // create our clipper object + /* create our clipper object */ - result = IDirectDraw7_CreateClipper( win32_driver->ddobj, 0, &win32_driver->ddclipper, 0 ); - if( result != DD_OK ) - { - Error( 0, "CreateClipper : error %i", result ); - return 0; - } + result = IDirectDraw7_CreateClipper( win32_driver->ddobj, 0, &win32_driver->ddclipper, 0 ); + if( result != DD_OK ) + { + Error( 0, "CreateClipper : error %i", result ); + return 0; + } - // associate our clipper with our window + /* associate our clipper with our window */ - result = IDirectDrawClipper_SetHWnd( win32_driver->ddclipper, 0, win32_driver->win32_visual->WndHnd ); - if( result != DD_OK ) - { - Error( 0, "ddclipper->SetHWnd : error %i", result ); - return 0; - } + result = IDirectDrawClipper_SetHWnd( win32_driver->ddclipper, 0, win32_driver->win32_visual->WndHnd ); + if( result != DD_OK ) + { + Error( 0, "ddclipper->SetHWnd : error %i", result ); + return 0; + } - // associate our primary surface with our clipper + /* associate our primary surface with our clipper */ - result = IDirectDrawSurface7_SetClipper( win32_driver->primary, win32_driver->ddclipper ); - if( result != DD_OK ) - { - Error( 0, "ddclipper->SetHWnd : error %i", result ); - return 0; - } + result = IDirectDrawSurface7_SetClipper( win32_driver->primary, win32_driver->ddclipper ); + if( result != DD_OK ) + { + Error( 0, "ddclipper->SetHWnd : error %i", result ); + return 0; + } - // store our objects in our visual struct + /* store our objects in our visual struct */ - UpdateRect( win32_driver->win32_visual ); + UpdateRect( win32_driver->win32_visual ); - return 1; + return 1; } -// Create our secondary ( off screen ) buffer. -// The optimal secondary buffer is a h/w -// overlay with the same pixel format as the -// xine frame type. However, since this is -// not always supported by the host h/w, -// we will fall back to creating an rgb buffer -// in video memory qith the same pixel format -// as the primary surface. At least then we -// can use h/w scaling if supported. +/* Create our secondary ( off screen ) buffer. + * The optimal secondary buffer is a h/w + * overlay with the same pixel format as the + * xine frame type. However, since this is + * not always supported by the host h/w, + * we will fall back to creating an rgb buffer + * in video memory qith the same pixel format + * as the primary surface. At least then we + * can use h/w scaling if supported. */ boolean CreateSecondary( win32_driver_t * win32_driver, int width, int height, int format ) { - DDSURFACEDESC2 ddsd; + DDSURFACEDESC2 ddsd; - if( format == XINE_IMGFMT_YV12 ) - printf( "vo_out_directx : switching to YV12 overlay type\n" ); + if( format == XINE_IMGFMT_YV12 ) + printf( "vo_out_directx : switching to YV12 overlay type\n" ); - if( format == XINE_IMGFMT_YUY2 ) - printf( "vo_out_directx : switching to YUY2 overlay type\n" ); + if( format == XINE_IMGFMT_YUY2 ) + printf( "vo_out_directx : switching to YUY2 overlay type\n" ); #if RGB_SUPPORT - if( format == IMGFMT_RGB ) - printf( "vo_out_directx : switching to RGB overlay type\n" ); + if( format == IMGFMT_RGB ) + printf( "vo_out_directx : switching to RGB overlay type\n" ); #endif - if( !win32_driver->ddobj ) - return FALSE; + if( !win32_driver->ddobj ) + return FALSE; - // store our reqested format, - // width and height + /* store our reqested format, + * width and height */ - win32_driver->req_format = format; - win32_driver->width = width; - win32_driver->height = height; + win32_driver->req_format = format; + win32_driver->width = width; + win32_driver->height = height; - // if we already have a secondary - // surface then release it + /* if we already have a secondary + * surface then release it */ - if( win32_driver->secondary ) - IDirectDrawSurface7_Release( win32_driver->secondary ); + if( win32_driver->secondary ) + IDirectDrawSurface7_Release( win32_driver->secondary ); - memset( &ddsd, 0, sizeof( ddsd ) ); - ddsd.dwSize = sizeof( ddsd ); - ddsd.dwWidth = width; - ddsd.dwHeight = height; + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwWidth = width; + ddsd.dwHeight = height; - if( format == XINE_IMGFMT_YV12 ) - { - // the requested format is XINE_IMGFMT_YV12 + if( format == XINE_IMGFMT_YV12 ) + { + /* the requested format is XINE_IMGFMT_YV12 */ - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; - ddsd.ddpfPixelFormat.dwYUVBitCount = 16; - ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC( 'Y', 'V', '1', '2' ); + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); + ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; + ddsd.ddpfPixelFormat.dwYUVBitCount = 16; + ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC( 'Y', 'V', '1', '2' ); -#ifdef LOG - printf("CreateSecondary() - act_format = (YV12) %d\n", XINE_IMGFMT_YV12); -#endif + lprintf("CreateSecondary() - act_format = (YV12) %d\n", XINE_IMGFMT_YV12); - win32_driver->act_format = XINE_IMGFMT_YV12; - } + win32_driver->act_format = XINE_IMGFMT_YV12; + } - if( format == XINE_IMGFMT_YUY2 ) - { - // the requested format is XINE_IMGFMT_YUY2 + if( format == XINE_IMGFMT_YUY2 ) + { + /* the requested format is XINE_IMGFMT_YUY2 */ - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; - ddsd.ddpfPixelFormat.dwYUVBitCount = 16; - ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC( 'Y', 'U', 'Y', '2' ); + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); + ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; + ddsd.ddpfPixelFormat.dwYUVBitCount = 16; + ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC( 'Y', 'U', 'Y', '2' ); -#ifdef LOG - printf("CreateSecondary() - act_format = (YUY2) %d\n", XINE_IMGFMT_YUY2); -#endif + lprintf("CreateSecondary() - act_format = (YUY2) %d\n", XINE_IMGFMT_YUY2); - win32_driver->act_format = XINE_IMGFMT_YUY2; - } + win32_driver->act_format = XINE_IMGFMT_YUY2; + } #if RGB_SUPPORT - if( format == IMGFMT_RGB ) - { - // the requested format is IMGFMT_RGB - - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; - ddsd.ddpfPixelFormat.dwYUVBitCount = 24; - ddsd.ddpfPixelFormat.dwRBitMask = 0xff0000; - ddsd.ddpfPixelFormat.dwGBitMask = 0x00ff00; - ddsd.ddpfPixelFormat.dwBBitMask = 0x0000ff; - -#ifdef LOG - printf("CreateSecondary() - act_format = (RGB) %d\n", IMGFMT_RGB); -#endif + if( format == IMGFMT_RGB ) + { + /* the requested format is IMGFMT_RGB */ + + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); + ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; + ddsd.ddpfPixelFormat.dwYUVBitCount = 24; + ddsd.ddpfPixelFormat.dwRBitMask = 0xff0000; + ddsd.ddpfPixelFormat.dwGBitMask = 0x00ff00; + ddsd.ddpfPixelFormat.dwBBitMask = 0x0000ff; - win32_driver->act_format = IMGFMT_RGB; - } + lprintf("CreateSecondary() - act_format = (RGB) %d\n", IMGFMT_RGB); + + win32_driver->act_format = IMGFMT_RGB; + } #endif /* RGB_SUPPORT */ -#ifdef LOG - printf("CreateSecondary() - IDirectDraw7_CreateSurface()\n"); -#endif + lprintf("CreateSecondary() - IDirectDraw7_CreateSurface()\n"); - if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->secondary, 0 ) == DD_OK ) - return TRUE; + if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->secondary, 0 ) == DD_OK ) + return TRUE; - // Our fallback method is to create a back buffer - // with the same image format as the primary surface + /* Our fallback method is to create a back buffer + * with the same image format as the primary surface */ -#ifdef LOG - printf("CreateSecondary() - Falling back to back buffer same as primary\n"); -#endif + lprintf("CreateSecondary() - Falling back to back buffer same as primary\n"); - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; -#ifdef LOG - printf("CreateSecondary() - act_format = (NATIVE) %d\n", IMGFMT_NATIVE); -#endif + lprintf("CreateSecondary() - act_format = (NATIVE) %d\n", IMGFMT_NATIVE); - win32_driver->act_format = IMGFMT_NATIVE; + win32_driver->act_format = IMGFMT_NATIVE; - if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->secondary, 0 ) == DD_OK ) - return TRUE; + if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->secondary, 0 ) == DD_OK ) + return TRUE; - // This is bad. We cant even create a surface with - // the same format as the primary surface. + /* This is bad. We cant even create a surface with + * the same format as the primary surface. */ - Error( 0, "CreateSurface ( Secondary ) : unable to create a suitable rendering surface" ); + Error( 0, "CreateSurface ( Secondary ) : unable to create a suitable rendering surface" ); - return FALSE; + return FALSE; } -// Destroy all direct draw driver allocated -// resources. +/* Destroy all direct draw driver allocated + * resources. */ void Destroy( win32_driver_t * win32_driver ) { - if( win32_driver->ddclipper ) - IDirectDrawClipper_Release( win32_driver->ddclipper ); + if( win32_driver->ddclipper ) + IDirectDrawClipper_Release( win32_driver->ddclipper ); - if( win32_driver->primary ) - IDirectDrawSurface7_Release( win32_driver->primary ); + if( win32_driver->primary ) + IDirectDrawSurface7_Release( win32_driver->primary ); - if( win32_driver->secondary ) - IDirectDrawSurface7_Release( win32_driver->secondary ); + if( win32_driver->secondary ) + IDirectDrawSurface7_Release( win32_driver->secondary ); - if( win32_driver->ddobj ) - IDirectDraw_Release( win32_driver->ddobj ); + if( win32_driver->ddobj ) + IDirectDraw_Release( win32_driver->ddobj ); - free( win32_driver ); + free( win32_driver ); } -// Check the current pixel format of the -// display mode. This is neccesary in case -// the h/w does not support an overlay for -// the native frame format. +/* Check the current pixel format of the + * display mode. This is neccesary in case + * the h/w does not support an overlay for + * the native frame format. */ boolean CheckPixelFormat( win32_driver_t * win32_driver ) { - DDPIXELFORMAT ddpf; - HRESULT result; + DDPIXELFORMAT ddpf; + HRESULT result; - // get the pixel format of our primary surface + /* get the pixel format of our primary surface */ - memset( &ddpf, 0, sizeof( DDPIXELFORMAT )); - ddpf.dwSize = sizeof( DDPIXELFORMAT ); - result = IDirectDrawSurface7_GetPixelFormat( win32_driver->primary, &ddpf ); - if( result != DD_OK ) - { - Error( 0, "IDirectDrawSurface7_GetPixelFormat ( CheckPixelFormat ) : error %u", result ); - return 0; - } + memset( &ddpf, 0, sizeof( DDPIXELFORMAT )); + ddpf.dwSize = sizeof( DDPIXELFORMAT ); + result = IDirectDrawSurface7_GetPixelFormat( win32_driver->primary, &ddpf ); + if( result != DD_OK ) + { + Error( 0, "IDirectDrawSurface7_GetPixelFormat ( CheckPixelFormat ) : error %u", result ); + return 0; + } - // TODO : support paletized video modes + /* TODO : support paletized video modes */ - if( ( ddpf.dwFlags & DDPF_PALETTEINDEXED1 ) || - ( ddpf.dwFlags & DDPF_PALETTEINDEXED2 ) || - ( ddpf.dwFlags & DDPF_PALETTEINDEXED4 ) || - ( ddpf.dwFlags & DDPF_PALETTEINDEXED8 ) || - ( ddpf.dwFlags & DDPF_PALETTEINDEXEDTO8 ) ) - return FALSE; + if( ( ddpf.dwFlags & DDPF_PALETTEINDEXED1 ) || + ( ddpf.dwFlags & DDPF_PALETTEINDEXED2 ) || + ( ddpf.dwFlags & DDPF_PALETTEINDEXED4 ) || + ( ddpf.dwFlags & DDPF_PALETTEINDEXED8 ) || + ( ddpf.dwFlags & DDPF_PALETTEINDEXEDTO8 ) ) + return FALSE; - // store bytes per pixel + /* store bytes per pixel */ - win32_driver->bytespp = ddpf.dwRGBBitCount / 8; + win32_driver->bytespp = ddpf.dwRGBBitCount / 8; - // find the rgb mode for software - // colorspace conversion + /* find the rgb mode for software + * colorspace conversion */ - if( ddpf.dwRGBBitCount == 32 ) - { - if( ddpf.dwRBitMask == 0xff0000 ) - win32_driver->mode = MODE_32_RGB; - else - win32_driver->mode = MODE_32_BGR; - } + if( ddpf.dwRGBBitCount == 32 ) + { + if( ddpf.dwRBitMask == 0xff0000 ) + win32_driver->mode = MODE_32_RGB; + else + win32_driver->mode = MODE_32_BGR; + } - if( ddpf.dwRGBBitCount == 24 ) - { - if( ddpf.dwRBitMask == 0xff0000 ) - win32_driver->mode = MODE_24_RGB; - else - win32_driver->mode = MODE_24_BGR; - } + if( ddpf.dwRGBBitCount == 24 ) + { + if( ddpf.dwRBitMask == 0xff0000 ) + win32_driver->mode = MODE_24_RGB; + else + win32_driver->mode = MODE_24_BGR; + } - if( ddpf.dwRGBBitCount == 16 ) - { - if( ddpf.dwRBitMask == 0xf800 ) - win32_driver->mode = MODE_16_RGB; - else - win32_driver->mode = MODE_16_BGR; - } + if( ddpf.dwRGBBitCount == 16 ) + { + if( ddpf.dwRBitMask == 0xf800 ) + win32_driver->mode = MODE_16_RGB; + else + win32_driver->mode = MODE_16_BGR; + } - if( ddpf.dwRGBBitCount == 15 ) - { - if( ddpf.dwRBitMask == 0x7C00 ) - win32_driver->mode = MODE_15_RGB; - else - win32_driver->mode = MODE_15_BGR; - } + if( ddpf.dwRGBBitCount == 15 ) + { + if( ddpf.dwRBitMask == 0x7C00 ) + win32_driver->mode = MODE_15_RGB; + else + win32_driver->mode = MODE_15_BGR; + } - return TRUE; + return TRUE; } -// Create a Direct draw surface from -// a bitmap resource.. -// -// NOTE : This is not really useful -// anymore since the xine logo code is -// being pushed to the backend. +/* Create a Direct draw surface from + * a bitmap resource.. + * + * NOTE : This is not really useful + * anymore since the xine logo code is + * being pushed to the backend. */ LPDIRECTDRAWSURFACE7 CreateBMP( win32_driver_t * win32_driver, int resource ) { - LPDIRECTDRAWSURFACE7 bmp_surf; - DDSURFACEDESC2 bmp_ddsd; - HBITMAP bmp_hndl; - BITMAP bmp_head; - HDC hdc_dds; - HDC hdc_mem; + LPDIRECTDRAWSURFACE7 bmp_surf; + DDSURFACEDESC2 bmp_ddsd; + HBITMAP bmp_hndl; + BITMAP bmp_head; + HDC hdc_dds; + HDC hdc_mem; - // load our bitmap from a resource + /* load our bitmap from a resource */ - if( !( bmp_hndl = LoadBitmap( win32_driver->win32_visual->HInst, MAKEINTRESOURCE( resource ) ) ) ) - { - Error( 0, "CreateBitmap : could not load bmp resource" ); - return 0; - } + if( !( bmp_hndl = LoadBitmap( win32_driver->win32_visual->HInst, MAKEINTRESOURCE( resource ) ) ) ) + { + Error( 0, "CreateBitmap : could not load bmp resource" ); + return 0; + } - // create an off screen surface with - // the same dimentions as our bitmap + /* create an off screen surface with + * the same dimentions as our bitmap */ - GetObject( bmp_hndl, sizeof( bmp_head ), &bmp_head ); + GetObject( bmp_hndl, sizeof( bmp_head ), &bmp_head ); - memset( &bmp_ddsd, 0, sizeof( bmp_ddsd ) ); - bmp_ddsd.dwSize = sizeof( bmp_ddsd ); - bmp_ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; - bmp_ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; - bmp_ddsd.dwWidth = bmp_head.bmWidth; - bmp_ddsd.dwHeight = bmp_head.bmHeight; + memset( &bmp_ddsd, 0, sizeof( bmp_ddsd ) ); + bmp_ddsd.dwSize = sizeof( bmp_ddsd ); + bmp_ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + bmp_ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; + bmp_ddsd.dwWidth = bmp_head.bmWidth; + bmp_ddsd.dwHeight = bmp_head.bmHeight; - if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &bmp_ddsd, &bmp_surf, 0 ) != DD_OK ) - { - Error( 0, "CreateSurface ( bitmap ) : could not create dd surface" ); - return 0; - } + if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &bmp_ddsd, &bmp_surf, 0 ) != DD_OK ) + { + Error( 0, "CreateSurface ( bitmap ) : could not create dd surface" ); + return 0; + } - // get a handle to our surface dc, - // create a compat dc and load - // our bitmap into the compat dc + /* get a handle to our surface dc, + * create a compat dc and load + * our bitmap into the compat dc */ - IDirectDrawSurface7_GetDC( bmp_surf, &hdc_dds ); - hdc_mem = CreateCompatibleDC( hdc_dds ); - SelectObject( hdc_mem, bmp_hndl ); + IDirectDrawSurface7_GetDC( bmp_surf, &hdc_dds ); + hdc_mem = CreateCompatibleDC( hdc_dds ); + SelectObject( hdc_mem, bmp_hndl ); - // copy our bmp from the compat dc - // into our dd surface + /* copy our bmp from the compat dc + * into our dd surface */ - BitBlt( hdc_dds, 0, 0, bmp_head.bmWidth, bmp_head.bmHeight, - hdc_mem, 0, 0, SRCCOPY ); + BitBlt( hdc_dds, 0, 0, bmp_head.bmWidth, bmp_head.bmHeight, + hdc_mem, 0, 0, SRCCOPY ); - // clean up + /* clean up */ - DeleteDC( hdc_mem ); - DeleteObject( bmp_hndl ); - IDirectDrawSurface7_ReleaseDC( bmp_surf, hdc_dds ); + DeleteDC( hdc_mem ); + DeleteObject( bmp_hndl ); + IDirectDrawSurface7_ReleaseDC( bmp_surf, hdc_dds ); - return bmp_surf; + return bmp_surf; } -// Merge overlay with the current primary -// surface. This funtion is only used when -// a h/w overlay of the current frame type -// is supported. +/* Merge overlay with the current primary + * surface. This funtion is only used when + * a h/w overlay of the current frame type + * is supported. */ boolean Overlay( LPDIRECTDRAWSURFACE7 src_surface, RECT * src_rect, - LPDIRECTDRAWSURFACE7 dst_surface, RECT * dst_rect, - COLORREF color_key ) + LPDIRECTDRAWSURFACE7 dst_surface, RECT * dst_rect, + COLORREF color_key ) { - DWORD dw_color_key; - DDPIXELFORMAT ddpf; - DDOVERLAYFX ddofx; - int flags; - HRESULT result; - - // compute the colorkey pixel value from the RGB value we've got/ - // NOTE : based on videolan colorkey code - - memset( &ddpf, 0, sizeof( DDPIXELFORMAT )); - ddpf.dwSize = sizeof( DDPIXELFORMAT ); - result = IDirectDrawSurface7_GetPixelFormat( dst_surface, &ddpf ); - if( result != DD_OK ) - { - Error( 0, "IDirectDrawSurface7_GetPixelFormat : could not get surface pixel format" ); - return FALSE; - } + DWORD dw_color_key; + DDPIXELFORMAT ddpf; + DDOVERLAYFX ddofx; + int flags; + HRESULT result; + + /* compute the colorkey pixel value from the RGB value we've got/ + * NOTE : based on videolan colorkey code */ + + memset( &ddpf, 0, sizeof( DDPIXELFORMAT )); + ddpf.dwSize = sizeof( DDPIXELFORMAT ); + result = IDirectDrawSurface7_GetPixelFormat( dst_surface, &ddpf ); + if( result != DD_OK ) + { + Error( 0, "IDirectDrawSurface7_GetPixelFormat : could not get surface pixel format" ); + return FALSE; + } - dw_color_key = ( DWORD ) color_key; - dw_color_key = ( DWORD ) ( ( ( dw_color_key * ddpf.dwRBitMask ) / 255 ) & ddpf.dwRBitMask ); + dw_color_key = ( DWORD ) color_key; + dw_color_key = ( DWORD ) ( ( ( dw_color_key * ddpf.dwRBitMask ) / 255 ) & ddpf.dwRBitMask ); - memset( &ddofx, 0, sizeof( DDOVERLAYFX ) ); - ddofx.dwSize = sizeof( DDOVERLAYFX ); - ddofx.dckDestColorkey.dwColorSpaceLowValue = dw_color_key; - ddofx.dckDestColorkey.dwColorSpaceHighValue = dw_color_key; + memset( &ddofx, 0, sizeof( DDOVERLAYFX ) ); + ddofx.dwSize = sizeof( DDOVERLAYFX ); + ddofx.dckDestColorkey.dwColorSpaceLowValue = dw_color_key; + ddofx.dckDestColorkey.dwColorSpaceHighValue = dw_color_key; - // set our overlay flags + /* set our overlay flags */ - flags = DDOVER_SHOW | DDOVER_KEYDESTOVERRIDE; + flags = DDOVER_SHOW | DDOVER_KEYDESTOVERRIDE; - // attempt to overlay the surface + /* attempt to overlay the surface */ - result = IDirectDrawSurface7_UpdateOverlay( src_surface, src_rect, dst_surface, dst_rect, flags, &ddofx ); - if( result != DD_OK ) + result = IDirectDrawSurface7_UpdateOverlay( src_surface, src_rect, dst_surface, dst_rect, flags, &ddofx ); + if( result != DD_OK ) + { + if( result == DDERR_SURFACELOST ) { - if( result == DDERR_SURFACELOST ) - { - IDirectDrawSurface7_Restore( src_surface ); - IDirectDrawSurface7_Restore( dst_surface ); - - IDirectDrawSurface7_UpdateOverlay( src_surface, src_rect, dst_surface, dst_rect, flags, &ddofx ); - } - else - { - Error( 0, "IDirectDrawSurface7_UpdateOverlay : error %i", result ); - return FALSE; - } + IDirectDrawSurface7_Restore( src_surface ); + IDirectDrawSurface7_Restore( dst_surface ); + + IDirectDrawSurface7_UpdateOverlay( src_surface, src_rect, dst_surface, dst_rect, flags, &ddofx ); } + else + { + Error( 0, "IDirectDrawSurface7_UpdateOverlay : error %i", result ); + return FALSE; + } + } - return TRUE; + return TRUE; } -// Copy our off screen surface into our primary -// surface. This funtion is only used when a -// h/w overlay of the current frame format is -// not supported. +/* Copy our off screen surface into our primary + * surface. This funtion is only used when a + * h/w overlay of the current frame format is + * not supported. */ boolean BltCopy( LPDIRECTDRAWSURFACE7 src_surface, RECT * src_rect, - LPDIRECTDRAWSURFACE7 dst_surface, RECT * dst_rect ) + LPDIRECTDRAWSURFACE7 dst_surface, RECT * dst_rect ) { - DDSURFACEDESC ddsd_target; - HRESULT result; + DDSURFACEDESC ddsd_target; + HRESULT result; - memset( &ddsd_target, 0, sizeof( ddsd_target ) ); - ddsd_target.dwSize = sizeof( ddsd_target ); + memset( &ddsd_target, 0, sizeof( ddsd_target ) ); + ddsd_target.dwSize = sizeof( ddsd_target ); - // attempt to blt the surface sontents + /* attempt to blt the surface sontents */ - result = IDirectDrawSurface7_Blt( dst_surface, dst_rect, src_surface, src_rect, DDBLT_WAIT, 0 ); - if( result != DD_OK ) + result = IDirectDrawSurface7_Blt( dst_surface, dst_rect, src_surface, src_rect, DDBLT_WAIT, 0 ); + if( result != DD_OK ) + { + if( result != DDERR_SURFACELOST ) { - if( result != DDERR_SURFACELOST ) - { - IDirectDrawSurface7_Restore( src_surface ); - IDirectDrawSurface7_Restore( dst_surface ); - - IDirectDrawSurface7_Blt( dst_surface, dst_rect, src_surface, src_rect, DDBLT_WAIT, 0 ); - } - else - { - Error( 0, "IDirectDrawSurface7_Blt : error %i", result ); - return FALSE; - } + IDirectDrawSurface7_Restore( src_surface ); + IDirectDrawSurface7_Restore( dst_surface ); + + IDirectDrawSurface7_Blt( dst_surface, dst_rect, src_surface, src_rect, DDBLT_WAIT, 0 ); } + else + { + Error( 0, "IDirectDrawSurface7_Blt : error %i", result ); + return FALSE; + } + } - return TRUE; + return TRUE; } -// Display our current frame. This function -// corrects frame output ratio and clipps the -// frame if nessesary. It will then handle -// moving the image contents contained in our -// secondary surface to our primary surface. +/* Display our current frame. This function + * corrects frame output ratio and clipps the + * frame if nessesary. It will then handle + * moving the image contents contained in our + * secondary surface to our primary surface. */ boolean DisplayFrame( win32_driver_t * win32_driver ) { - int view_width; - int view_height; - int scaled_width; - int scaled_height; - int screen_width; - int screen_height; - RECT clipped; - RECT centered; + int view_width; + int view_height; + int scaled_width; + int scaled_height; + int screen_width; + int screen_height; + RECT clipped; + RECT centered; - // aspect ratio calculations + /* aspect ratio calculations */ - // TODO : account for screen ratio as well + /* TODO : account for screen ratio as well */ - view_width = win32_driver->win32_visual->WndRect.right - win32_driver->win32_visual->WndRect.left; - view_height = win32_driver->win32_visual->WndRect.bottom - win32_driver->win32_visual->WndRect.top; + view_width = win32_driver->win32_visual->WndRect.right - win32_driver->win32_visual->WndRect.left; + view_height = win32_driver->win32_visual->WndRect.bottom - win32_driver->win32_visual->WndRect.top; - if( view_width / win32_driver->ratio < view_height ) - { - scaled_width = view_width - BORDER_SIZE; - scaled_height = view_width / win32_driver->ratio - BORDER_SIZE; - } - else - { - scaled_width = view_height * win32_driver->ratio - BORDER_SIZE; - scaled_height = view_height - BORDER_SIZE; - } - - // center our overlay in our view frame - - centered.left = ( view_width - scaled_width ) / 2 + win32_driver->win32_visual->WndRect.left; - centered.right = centered.left + scaled_width; - centered.top = ( view_height - scaled_height ) / 2 + win32_driver->win32_visual->WndRect.top; - centered.bottom = centered.top + scaled_height; + if( view_width / win32_driver->ratio < view_height ) + { + scaled_width = view_width - BORDER_SIZE; + scaled_height = view_width / win32_driver->ratio - BORDER_SIZE; + } + else + { + scaled_width = view_height * win32_driver->ratio - BORDER_SIZE; + scaled_height = view_height - BORDER_SIZE; + } - // clip our overlay if it is off screen + /* center our overlay in our view frame */ - screen_width = GetSystemMetrics( SM_CXSCREEN ); - screen_height = GetSystemMetrics( SM_CYSCREEN ); + centered.left = ( view_width - scaled_width ) / 2 + win32_driver->win32_visual->WndRect.left; + centered.right = centered.left + scaled_width; + centered.top = ( view_height - scaled_height ) / 2 + win32_driver->win32_visual->WndRect.top; + centered.bottom = centered.top + scaled_height; - if( centered.left < 0 ) - { - double x_scale = ( double ) ( view_width + centered.left ) / ( double ) view_width; - clipped.left = win32_driver->width - ( int ) ( win32_driver->width * x_scale ); - centered.left = 0; - } - else - clipped.left = 0; + /* clip our overlay if it is off screen */ - if( centered.top < 0 ) - { - double y_scale = ( double ) ( view_height + centered.top ) / ( double ) view_height; - clipped.left = win32_driver->height - ( int ) ( win32_driver->height * y_scale ); - centered.left = 0; - } - else - clipped.top = 0; + screen_width = GetSystemMetrics( SM_CXSCREEN ); + screen_height = GetSystemMetrics( SM_CYSCREEN ); - if( centered.right > screen_width ) - { - double x_scale = ( double ) ( view_width - ( centered.right - screen_width ) ) / ( double ) view_width; - clipped.right = ( int ) ( win32_driver->width * x_scale ); - centered.right = screen_width; - } - else - clipped.right = win32_driver->width; + if( centered.left < 0 ) + { + double x_scale = ( double ) ( view_width + centered.left ) / ( double ) view_width; + clipped.left = win32_driver->width - ( int ) ( win32_driver->width * x_scale ); + centered.left = 0; + } + else + clipped.left = 0; - if( centered.bottom > screen_height ) - { - double y_scale = ( double ) ( view_height - ( centered.bottom - screen_height ) ) / ( double ) view_height; - clipped.bottom = ( int ) ( win32_driver->height * y_scale ); - centered.bottom = screen_height; - } - else - clipped.bottom = win32_driver->height; + if( centered.top < 0 ) + { + double y_scale = ( double ) ( view_height + centered.top ) / ( double ) view_height; + clipped.left = win32_driver->height - ( int ) ( win32_driver->height * y_scale ); + centered.left = 0; + } + else + clipped.top = 0; - // if surface is entirely off screen or the - // width or height is 0 for the overlay or - // the output view area, then return without - // overlay update + if( centered.right > screen_width ) + { + double x_scale = ( double ) ( view_width - ( centered.right - screen_width ) ) / ( double ) view_width; + clipped.right = ( int ) ( win32_driver->width * x_scale ); + centered.right = screen_width; + } + else + clipped.right = win32_driver->width; - if( ( centered.left > screen_width ) || - ( centered.top > screen_height ) || - ( centered.right < 0 ) || - ( centered.bottom < 0 ) || - ( clipped.left >= clipped.right ) || - ( clipped.top >= clipped.bottom ) || - ( view_width <= 0 ) || - ( view_height <= 0 ) ) + if( centered.bottom > screen_height ) + { + double y_scale = ( double ) ( view_height - ( centered.bottom - screen_height ) ) / ( double ) view_height; + clipped.bottom = ( int ) ( win32_driver->height * y_scale ); + centered.bottom = screen_height; + } + else + clipped.bottom = win32_driver->height; + + /* if surface is entirely off screen or the + * width or height is 0 for the overlay or + * the output view area, then return without + * overlay update */ + + if( ( centered.left > screen_width ) || + ( centered.top > screen_height ) || + ( centered.right < 0 ) || + ( centered.bottom < 0 ) || + ( clipped.left >= clipped.right ) || + ( clipped.top >= clipped.bottom ) || + ( view_width <= 0 ) || + ( view_height <= 0 ) ) - return 1; + return 1; - // we have a h/w supported overlay + /* we have a h/w supported overlay */ - if( ( win32_driver->act_format == XINE_IMGFMT_YV12 ) || ( win32_driver->act_format == XINE_IMGFMT_YUY2 ) ) - return Overlay( win32_driver->secondary, &clipped, win32_driver->primary, ¢ered, win32_driver->win32_visual->ColorKey ); + if( ( win32_driver->act_format == XINE_IMGFMT_YV12 ) || ( win32_driver->act_format == XINE_IMGFMT_YUY2 ) ) + return Overlay( win32_driver->secondary, &clipped, win32_driver->primary, ¢ered, win32_driver->win32_visual->ColorKey ); - // we do not have a h/w supported overlay + /* we do not have a h/w supported overlay */ - return BltCopy( win32_driver->secondary, &clipped, win32_driver->primary, ¢ered ); + return BltCopy( win32_driver->secondary, &clipped, win32_driver->primary, ¢ered ); } -// Lock our back buffer to update its contents. +/* Lock our back buffer to update its contents. */ void * Lock( void * surface ) { - LPDIRECTDRAWSURFACE7 lock_surface = ( LPDIRECTDRAWSURFACE7 ) surface; - DDSURFACEDESC2 ddsd; - HRESULT result; + LPDIRECTDRAWSURFACE7 lock_surface = ( LPDIRECTDRAWSURFACE7 ) surface; + DDSURFACEDESC2 ddsd; + HRESULT result; - if( !surface ) - return 0; + if( !surface ) + return 0; - memset( &ddsd, 0, sizeof( ddsd ) ); - ddsd.dwSize = sizeof( ddsd ); + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); - result = IDirectDrawSurface7_Lock( lock_surface, 0, &ddsd, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0 ); - if( result == DDERR_SURFACELOST ) + result = IDirectDrawSurface7_Lock( lock_surface, 0, &ddsd, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0 ); + if( result == DDERR_SURFACELOST ) { - IDirectDrawSurface7_Restore( lock_surface ); - result = IDirectDrawSurface7_Lock( lock_surface, 0, &ddsd, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0 ); + IDirectDrawSurface7_Restore( lock_surface ); + result = IDirectDrawSurface7_Lock( lock_surface, 0, &ddsd, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0 ); - if( result != DD_OK ) - return 0; + if( result != DD_OK ) + return 0; - } - else if( result != DD_OK ) + } + else if( result != DD_OK ) + { + if( result == DDERR_GENERIC ) { - if( result == DDERR_GENERIC ) - { - Error( 0, "surface->Lock : error, DDERR_GENERIC" ); - exit( 1 ); - } + Error( 0, "surface->Lock : error, DDERR_GENERIC" ); + exit( 1 ); } + } - return ddsd.lpSurface; + return ddsd.lpSurface; - return 0; + return 0; } -// Unlock our back buffer to prepair for display. +/* Unlock our back buffer to prepair for display. */ void Unlock( void * surface ) { - LPDIRECTDRAWSURFACE7 lock_surface = ( LPDIRECTDRAWSURFACE7 ) surface; + LPDIRECTDRAWSURFACE7 lock_surface = ( LPDIRECTDRAWSURFACE7 ) surface; - if( !surface ) - return; + if( !surface ) + return; - IDirectDrawSurface7_Unlock( lock_surface, 0 ); + IDirectDrawSurface7_Unlock( lock_surface, 0 ); } -// ----------------------------------------- -// -// BEGIN : Xine driver video output plugin -// handlers. -// -// ----------------------------------------- +/* ----------------------------------------- + * + * BEGIN : Xine driver video output plugin + * handlers. + * + * ----------------------------------------- */ static uint32_t win32_get_capabilities( vo_driver_t * vo_driver ) { - uint32_t retVal; + uint32_t retVal; - retVal = VO_CAP_YV12 | VO_CAP_YUY2; + retVal = VO_CAP_YV12 | VO_CAP_YUY2; #if RGB_SUPPORT - retVal |= VO_CAP_RGB; + retVal |= VO_CAP_RGB; #endif /* RGB_SUPPORT */ - return retVal; + return retVal; } static void win32_frame_field( vo_frame_t * vo_frame, int which_field ) { - // I have no idea what this even - // does, frame interlace stuff? + /* I have no idea what this even + * does, frame interlace stuff? */ } static void win32_free_framedata(vo_frame_t* vo_frame) { - win32_frame_t * frame = ( win32_frame_t * ) vo_frame; + win32_frame_t * frame = ( win32_frame_t * ) vo_frame; - if(frame->vo_frame.base[0]) { - free(frame->vo_frame.base[0]); - frame->vo_frame.base[0] = NULL; - } + if(frame->vo_frame.base[0]) { + free(frame->vo_frame.base[0]); + frame->vo_frame.base[0] = NULL; + } - if(frame->vo_frame.base[1]) { - free(frame->vo_frame.base[1]); - frame->vo_frame.base[1] = NULL; - } + if(frame->vo_frame.base[1]) { + free(frame->vo_frame.base[1]); + frame->vo_frame.base[1] = NULL; + } - if(frame->vo_frame.base[2]) { - free(frame->vo_frame.base[2]); - frame->vo_frame.base[2] = NULL; - } + if(frame->vo_frame.base[2]) { + free(frame->vo_frame.base[2]); + frame->vo_frame.base[2] = NULL; + } } static void win32_frame_dispose( vo_frame_t * vo_frame ) { - win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; + win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; - if( win32_frame->buffer ) - free( win32_frame->buffer ); + if( win32_frame->buffer ) + free( win32_frame->buffer ); - win32_free_framedata(vo_frame); + win32_free_framedata(vo_frame); - free( win32_frame ); + free( win32_frame ); } static vo_frame_t * win32_alloc_frame( vo_driver_t * vo_driver ) { - win32_frame_t * win32_frame; + win32_frame_t * win32_frame; - win32_frame = ( win32_frame_t * ) malloc( sizeof( win32_frame_t ) ); - if (win32_frame == NULL) { - printf("win32_alloc_frame: out of memory\n"); - return NULL; - } - memset( win32_frame, 0, sizeof( win32_frame_t ) ); + win32_frame = ( win32_frame_t * ) malloc( sizeof( win32_frame_t ) ); + if (win32_frame == NULL) { + printf("win32_alloc_frame: out of memory\n"); + return NULL; + } + memset( win32_frame, 0, sizeof( win32_frame_t ) ); - win32_frame->vo_frame.proc_slice = NULL; - win32_frame->vo_frame.proc_frame = NULL; - win32_frame->vo_frame.field = win32_frame_field; - win32_frame->vo_frame.dispose = win32_frame_dispose; - win32_frame->format = -1; + win32_frame->vo_frame.proc_slice = NULL; + win32_frame->vo_frame.proc_frame = NULL; + win32_frame->vo_frame.field = win32_frame_field; + win32_frame->vo_frame.dispose = win32_frame_dispose; + win32_frame->format = -1; - return ( vo_frame_t * ) win32_frame; + return ( vo_frame_t * ) win32_frame; } static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_frame, uint32_t width, - uint32_t height, double ratio, int format, int flags ) + uint32_t height, double ratio, int format, int flags ) { - win32_driver_t * win32_driver = ( win32_driver_t * ) vo_driver; - win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; + win32_driver_t *win32_driver = ( win32_driver_t * ) vo_driver; + win32_frame_t *win32_frame = ( win32_frame_t * ) vo_frame; - /*printf("vo_out_directx : win32_update_frame_format() - width = %d, height=%d, ratio_code=%d, format=%d, flags=%d\n", width, height, ratio_code, format, flags);*/ + /*printf("vo_out_directx : win32_update_frame_format() - width = %d, height=%d, ratio_code=%d, format=%d, flags=%d\n", width, height, ratio_code, format, flags);*/ - if( ( win32_frame->format != format ) || - ( win32_frame->width != width ) || - ( win32_frame->height != height ) ) - { - // free our allocated memory + if( ( win32_frame->format != format ) || + ( win32_frame->width != width ) || + ( win32_frame->height != height ) ) + { + /* free our allocated memory */ - win32_free_framedata((vo_frame_t *)&win32_frame->vo_frame); + win32_free_framedata((vo_frame_t *)&win32_frame->vo_frame); - // create new render buffer - if( format == XINE_IMGFMT_YV12 ) - { - win32_frame->vo_frame.pitches[0] = 8*((width + 7) / 8); - win32_frame->vo_frame.pitches[1] = 8*((width + 15) / 16); - win32_frame->vo_frame.pitches[2] = 8*((width + 15) / 16); + /* create new render buffer */ + if( format == XINE_IMGFMT_YV12 ) + { + win32_frame->vo_frame.pitches[0] = 8*((width + 7) / 8); + win32_frame->vo_frame.pitches[1] = 8*((width + 15) / 16); + win32_frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - win32_frame->vo_frame.base[0] = malloc(win32_frame->vo_frame.pitches[0] * height); - win32_frame->vo_frame.base[1] = malloc(win32_frame->vo_frame.pitches[1] * ((height+1)/2)); - win32_frame->vo_frame.base[2] = malloc(win32_frame->vo_frame.pitches[2] * ((height+1)/2)); + win32_frame->vo_frame.base[0] = malloc(win32_frame->vo_frame.pitches[0] * height); + win32_frame->vo_frame.base[1] = malloc(win32_frame->vo_frame.pitches[1] * ((height+1)/2)); + win32_frame->vo_frame.base[2] = malloc(win32_frame->vo_frame.pitches[2] * ((height+1)/2)); - win32_frame->size = win32_frame->vo_frame.pitches[0] * height * 2; - } - else if( format == XINE_IMGFMT_YUY2 ) - { - win32_frame->vo_frame.pitches[0] = 8*((width + 3) / 4); + win32_frame->size = win32_frame->vo_frame.pitches[0] * height * 2; + } + else if( format == XINE_IMGFMT_YUY2 ) + { + win32_frame->vo_frame.pitches[0] = 8*((width + 3) / 4); - win32_frame->vo_frame.base[0] = malloc(win32_frame->vo_frame.pitches[0] * height * 2); - win32_frame->vo_frame.base[1] = NULL; - win32_frame->vo_frame.base[2] = NULL; + win32_frame->vo_frame.base[0] = malloc(win32_frame->vo_frame.pitches[0] * height * 2); + win32_frame->vo_frame.base[1] = NULL; + win32_frame->vo_frame.base[2] = NULL; - win32_frame->size = win32_frame->vo_frame.pitches[0] * height * 2; - } + win32_frame->size = win32_frame->vo_frame.pitches[0] * height * 2; + } #if RGB_SUPPORT - else if( format == IMGFMT_RGB ) - { - win32_frame->size = width * height * 3; - win32_frame->buffer = malloc( win32_frame->size ); - vo_frame->base[0] = win32_frame->buffer; - } + else if( format == IMGFMT_RGB ) + { + win32_frame->size = width * height * 3; + win32_frame->buffer = malloc( win32_frame->size ); + vo_frame->base[0] = win32_frame->buffer; + } #endif - else - { - printf ( "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); - exit (1); - } - - win32_frame->format = format; - win32_frame->width = width; - win32_frame->height = height; - win32_frame->ratio = ratio; + else + { + printf ( "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); + exit (1); } + + win32_frame->format = format; + win32_frame->width = width; + win32_frame->height = height; + win32_frame->ratio = ratio; + } } static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame ) { - win32_driver_t * win32_driver = ( win32_driver_t * ) vo_driver; - win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; - int offset; - int size; + win32_driver_t *win32_driver = ( win32_driver_t * ) vo_driver; + win32_frame_t *win32_frame = ( win32_frame_t * ) vo_frame; + int offset; + int size; - // if the required width, height or format has changed - // then recreate the secondary buffer + /* if the required width, height or format has changed + * then recreate the secondary buffer */ - if( ( win32_driver->req_format != win32_frame->format ) || - ( win32_driver->width != win32_frame->width ) || - ( win32_driver->height != win32_frame->height ) ) - { - CreateSecondary( win32_driver, win32_frame->width, win32_frame->height, win32_frame->format ); - } + if( ( win32_driver->req_format != win32_frame->format ) || + ( win32_driver->width != win32_frame->width ) || + ( win32_driver->height != win32_frame->height ) ) + { + CreateSecondary( win32_driver, win32_frame->width, win32_frame->height, win32_frame->format ); + } - // determine desired ratio + /* determine desired ratio */ - win32_driver->ratio = win32_frame->ratio; + win32_driver->ratio = win32_frame->ratio; - // lock our surface to update its contents + /* lock our surface to update its contents */ - win32_driver->contents = Lock( win32_driver->secondary ); + win32_driver->contents = Lock( win32_driver->secondary ); - // surface unavailable, skip frame render + /* surface unavailable, skip frame render */ - if( !win32_driver->contents ) - { - vo_frame->free( vo_frame ); - return; - } + if( !win32_driver->contents ) + { + vo_frame->free( vo_frame ); + return; + } - // if our actual frame format is the native screen - // pixel format, we need to convert it + /* if our actual frame format is the native screen + * pixel format, we need to convert it */ - if( win32_driver->act_format == IMGFMT_NATIVE ) - { - // use the software color conversion functions - // to rebuild the frame in our native screen - // pixel format ... this is slow + if( win32_driver->act_format == IMGFMT_NATIVE ) + { + /* use the software color conversion functions + * to rebuild the frame in our native screen + * pixel format ... this is slow */ - if( win32_driver->req_format == XINE_IMGFMT_YV12 ) - { - // convert from yv12 to native - // screen pixel format + if( win32_driver->req_format == XINE_IMGFMT_YV12 ) + { + /* convert from yv12 to native + * screen pixel format */ #if NEW_YUV - win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, - win32_driver->width, win32_driver->height, - win32_driver->width, win32_driver->width/2, - win32_driver->width, win32_driver->height, - win32_driver->width * win32_driver->bytespp ); + win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, + win32_driver->width, win32_driver->height, + win32_driver->width, win32_driver->width/2, + win32_driver->width, win32_driver->height, + win32_driver->width * win32_driver->bytespp ); #else - yuv2rgb_setup( win32_driver->yuv2rgb, - win32_driver->width, win32_driver->height, - win32_driver->width, win32_driver->width/2, - win32_driver->width, win32_driver->height, - win32_driver->width * win32_driver->bytespp ); + yuv2rgb_setup( win32_driver->yuv2rgb, + win32_driver->width, win32_driver->height, + win32_driver->width, win32_driver->width/2, + win32_driver->width, win32_driver->height, + win32_driver->width * win32_driver->bytespp ); #endif - win32_driver->yuv2rgb->yuv2rgb_fun( win32_driver->yuv2rgb, - win32_driver->contents, - win32_frame->vo_frame.base[0], - win32_frame->vo_frame.base[1], - win32_frame->vo_frame.base[2] ); - } - - if( win32_driver->req_format == XINE_IMGFMT_YUY2 ) - { - // convert from yuy2 to native - // screen pixel format + win32_driver->yuv2rgb->yuv2rgb_fun( win32_driver->yuv2rgb, + win32_driver->contents, + win32_frame->vo_frame.base[0], + win32_frame->vo_frame.base[1], + win32_frame->vo_frame.base[2] ); + } + + if( win32_driver->req_format == XINE_IMGFMT_YUY2 ) + { + /* convert from yuy2 to native + * screen pixel format */ #if NEW_YUV - win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, - win32_driver->width, win32_driver->height, - win32_driver->width, win32_driver->width/2, - win32_driver->width, win32_driver->height, - win32_driver->width * win32_driver->bytespp ); + win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, + win32_driver->width, win32_driver->height, + win32_driver->width, win32_driver->width/2, + win32_driver->width, win32_driver->height, + win32_driver->width * win32_driver->bytespp ); #else - yuv2rgb_setup( win32_driver->yuv2rgb, - win32_driver->width, win32_driver->height, - win32_driver->width, win32_driver->width/2, - win32_driver->width, win32_driver->height, - win32_driver->width * win32_driver->bytespp ); + yuv2rgb_setup( win32_driver->yuv2rgb, + win32_driver->width, win32_driver->height, + win32_driver->width, win32_driver->width/2, + win32_driver->width, win32_driver->height, + win32_driver->width * win32_driver->bytespp ); #endif - win32_driver->yuv2rgb->yuy22rgb_fun( win32_driver->yuv2rgb, - win32_driver->contents, - win32_frame->vo_frame.base[0] ); - } + win32_driver->yuv2rgb->yuy22rgb_fun( win32_driver->yuv2rgb, + win32_driver->contents, + win32_frame->vo_frame.base[0] ); + } #if RGB_SUPPORT - if( win32_driver->req_format == IMGFMT_RGB ) - { - // convert from 24 bit rgb to native - // screen pixel format + if( win32_driver->req_format == IMGFMT_RGB ) + { + /* convert from 24 bit rgb to native + * screen pixel format */ - // TODO : rgb2rgb conversion - } -#endif + /* TODO : rgb2rgb conversion */ } - else +#endif + } + else + { + /* the actual format is identical to our + * stream format. we just need to copy it */ + + switch(win32_frame->format) { - // the actual format is identical to our - // stream format. we just need to copy it - - switch(win32_frame->format) - { - case XINE_IMGFMT_YV12: - { - vo_frame_t *frame; - uint8_t *img; - - frame = vo_frame; - img = (uint8_t *)win32_driver->contents; - - offset = 0; - size = frame->pitches[0] * frame->height; - memcpy( img+offset, frame->base[0], size); - - offset += size; - size = frame->pitches[2]* frame->height / 2; - memcpy( img+offset, frame->base[2], size); + case XINE_IMGFMT_YV12: + { + vo_frame_t *frame; + uint8_t *img; + + frame = vo_frame; + img = (uint8_t *)win32_driver->contents; + + offset = 0; + size = frame->pitches[0] * frame->height; + memcpy( img+offset, frame->base[0], size); + + offset += size; + size = frame->pitches[2]* frame->height / 2; + memcpy( img+offset, frame->base[2], size); - offset += size; - size = frame->pitches[1] * frame->height / 2; - memcpy( img+offset, frame->base[1], size); - } - break; - case XINE_IMGFMT_YUY2: - memcpy( win32_driver->contents, win32_frame->vo_frame.base[0], win32_frame->vo_frame.pitches[0] * win32_frame->vo_frame.height * 2); - break; - default: - memcpy( win32_driver->contents, win32_frame->vo_frame.base[0], win32_frame->vo_frame.pitches[0] * win32_frame->vo_frame.height * 2); - break; - } + offset += size; + size = frame->pitches[1] * frame->height / 2; + memcpy( img+offset, frame->base[1], size); + } + break; + case XINE_IMGFMT_YUY2: + memcpy( win32_driver->contents, win32_frame->vo_frame.base[0], win32_frame->vo_frame.pitches[0] * win32_frame->vo_frame.height * 2); + break; + default: + memcpy( win32_driver->contents, win32_frame->vo_frame.base[0], win32_frame->vo_frame.pitches[0] * win32_frame->vo_frame.height * 2); + break; } + } - // unlock the surface + /* unlock the surface */ - Unlock( win32_driver->secondary ); + Unlock( win32_driver->secondary ); - // scale, clip and display our frame + /* scale, clip and display our frame */ - DisplayFrame( win32_driver ); + DisplayFrame( win32_driver ); - // tag our frame as displayed - if((win32_driver->current != NULL) && (win32_driver->current != vo_frame)) { - vo_frame->free(&win32_driver->current->vo_frame); - } - win32_driver->current = vo_frame; + /* tag our frame as displayed */ + if((win32_driver->current != NULL) && (win32_driver->current != vo_frame)) { + vo_frame->free(&win32_driver->current->vo_frame); + } + win32_driver->current = vo_frame; } static void win32_overlay_blend( vo_driver_t * vo_driver, vo_frame_t * vo_frame, vo_overlay_t * vo_overlay ) { - win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; + win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; - // temporary overlay support, somthing more appropriate - // for win32 will be devised at a later date + /* temporary overlay support, somthing more appropriate + * for win32 will be devised at a later date */ - if( vo_overlay->rle ) - { - if( vo_frame->format == XINE_IMGFMT_YV12 ) - blend_yuv( win32_frame->vo_frame.base, vo_overlay, win32_frame->width, win32_frame->height, win32_frame->vo_frame.pitches ); - else - blend_yuy2( win32_frame->vo_frame.base[0], vo_overlay, win32_frame->width, win32_frame->height, win32_frame->vo_frame.pitches[0] ); - } + if( vo_overlay->rle ) + { + if( vo_frame->format == XINE_IMGFMT_YV12 ) + blend_yuv( win32_frame->vo_frame.base, vo_overlay, win32_frame->width, win32_frame->height, win32_frame->vo_frame.pitches ); + else + blend_yuy2( win32_frame->vo_frame.base[0], vo_overlay, win32_frame->width, win32_frame->height, win32_frame->vo_frame.pitches[0] ); + } } static int win32_get_property( vo_driver_t * vo_driver, int property ) { -#ifdef LOG - printf( "win32_get_property\n" ); -#endif + lprintf( "win32_get_property\n" ); - return 0; + return 0; } static int win32_set_property( vo_driver_t * vo_driver, int property, int value ) { - return value; + return value; } static void win32_get_property_min_max( vo_driver_t * vo_driver, int property, int * min, int * max ) { - *min = 0; - *max = 0; + *min = 0; + *max = 0; } static int win32_gui_data_exchange( vo_driver_t * vo_driver, int data_type, void * data ) { - win32_driver_t * win32_driver = ( win32_driver_t * ) vo_driver; + win32_driver_t *win32_driver = ( win32_driver_t * ) vo_driver; - switch( data_type ) - { - case GUI_WIN32_MOVED_OR_RESIZED: - UpdateRect( win32_driver->win32_visual ); - DisplayFrame( win32_driver ); - break; - } + switch( data_type ) + { + case GUI_WIN32_MOVED_OR_RESIZED: + UpdateRect( win32_driver->win32_visual ); + DisplayFrame( win32_driver ); + break; + } return 0; } @@ -1138,7 +1119,7 @@ static int win32_gui_data_exchange( vo_driver_t * vo_driver, int data_type, void static int win32_redraw_needed(vo_driver_t* this_gen) { - win32_driver_t* win32_driver = (win32_driver_t *) this_gen; + win32_driver_t *win32_driver = (win32_driver_t *) this_gen; int ret = 0; @@ -1155,52 +1136,52 @@ static int win32_redraw_needed(vo_driver_t* this_gen) static void win32_exit( vo_driver_t * vo_driver ) { - win32_driver_t * win32_driver = ( win32_driver_t * ) vo_driver; + win32_driver_t *win32_driver = ( win32_driver_t * ) vo_driver; - free(win32_driver->win32_visual); + free(win32_driver->win32_visual); - Destroy( win32_driver ); + Destroy( win32_driver ); } static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *win32_visual) -/*vo_driver_t *init_video_out_plugin( config_values_t * config, void * win32_visual )*/ + /*vo_driver_t *init_video_out_plugin( config_values_t * config, void * win32_visual )*/ { - - /* Make sure that the DirectX drivers are available and present! */ - /* Not complete yet */ - - win32_driver_t * win32_driver = ( win32_driver_t * ) malloc ( sizeof( win32_driver_t ) ); - memset( win32_driver, 0, sizeof( win32_driver_t ) ); - - win32_driver->win32_visual = win32_visual; - win32_driver->vo_driver.get_capabilities = win32_get_capabilities; - win32_driver->vo_driver.alloc_frame = win32_alloc_frame ; - win32_driver->vo_driver.update_frame_format = win32_update_frame_format; - win32_driver->vo_driver.display_frame = win32_display_frame; - win32_driver->vo_driver.overlay_blend = win32_overlay_blend; - win32_driver->vo_driver.get_property = win32_get_property; - win32_driver->vo_driver.set_property = win32_set_property; - win32_driver->vo_driver.get_property_min_max = win32_get_property_min_max; - win32_driver->vo_driver.gui_data_exchange = win32_gui_data_exchange; - win32_driver->vo_driver.dispose = win32_exit; - win32_driver->vo_driver.redraw_needed = win32_redraw_needed; - - CreatePrimary( win32_driver ); - if( !CheckPixelFormat( win32_driver ) ) - { - Error( 0, "vo_directx : Your screen pixel format is not supported" ); - Destroy( win32_driver ); - return 0; - } + win32_driver_t *win32_driver = ( win32_driver_t * ) malloc ( sizeof( win32_driver_t ) ); + + memset( win32_driver, 0, sizeof( win32_driver_t ) ); + + /* Make sure that the DirectX drivers are available and present! */ + /* Not complete yet */ + + win32_driver->win32_visual = win32_visual; + win32_driver->vo_driver.get_capabilities = win32_get_capabilities; + win32_driver->vo_driver.alloc_frame = win32_alloc_frame ; + win32_driver->vo_driver.update_frame_format = win32_update_frame_format; + win32_driver->vo_driver.display_frame = win32_display_frame; + win32_driver->vo_driver.overlay_blend = win32_overlay_blend; + win32_driver->vo_driver.get_property = win32_get_property; + win32_driver->vo_driver.set_property = win32_set_property; + win32_driver->vo_driver.get_property_min_max = win32_get_property_min_max; + win32_driver->vo_driver.gui_data_exchange = win32_gui_data_exchange; + win32_driver->vo_driver.dispose = win32_exit; + win32_driver->vo_driver.redraw_needed = win32_redraw_needed; + + CreatePrimary( win32_driver ); + if( !CheckPixelFormat( win32_driver ) ) + { + Error( 0, "vo_directx : Your screen pixel format is not supported" ); + Destroy( win32_driver ); + return 0; + } #if (NEW_YUV) - win32_driver->yuv2rgb_factory = yuv2rgb_factory_init( win32_driver->mode, 0, 0 ); - win32_driver->yuv2rgb = win32_driver->yuv2rgb_factory->create_converter(win32_driver->yuv2rgb_factory); + win32_driver->yuv2rgb_factory = yuv2rgb_factory_init( win32_driver->mode, 0, 0 ); + win32_driver->yuv2rgb = win32_driver->yuv2rgb_factory->create_converter(win32_driver->yuv2rgb_factory); #else - win32_driver->yuv2rgb = yuv2rgb_init( win32_driver->mode, 0, 0 ); + win32_driver->yuv2rgb = yuv2rgb_init( win32_driver->mode, 0, 0 ); #endif - return ( vo_driver_t * ) win32_driver; + return ( vo_driver_t * ) win32_driver; } @@ -1213,32 +1194,31 @@ static char* get_description (video_driver_class_t *this_gen) { } static void dispose_class (video_driver_class_t *this_gen) { - directx_class_t *directx = (directx_class_t *) this_gen; + free (directx); } static void *init_class (xine_t *xine, void *visual_gen) { - directx_class_t *directx; - char* device_name; - + directx_class_t *directx; + char* device_name; #ifdef TC - int fd; + int fd; #endif - device_name = xine->config->register_string(xine->config, - "video.directx_device", "/dev/directx", - _("xine video output plugin for win32 using directx"), - NULL, 10, NULL, NULL); + device_name = xine->config->register_string(xine->config, + "video.directx_device", "/dev/directx", + _("xine video output plugin for win32 using directx"), + NULL, 10, NULL, NULL); #ifdef TC - /* check for directx device */ - if((fd = open(device_name, O_RDWR)) < 0) { - printf("video_out_directx: aborting. (unable to open directx device \"%s\")\n", device_name); - return NULL; - } - close(fd); + /* check for directx device */ + if((fd = open(device_name, O_RDWR)) < 0) { + printf("video_out_directx: aborting. (unable to open directx device \"%s\")\n", device_name); + return NULL; + } + close(fd); #endif /* @@ -1252,14 +1232,14 @@ static void *init_class (xine_t *xine, void *visual_gen) { directx->driver_class.get_description = get_description; directx->driver_class.dispose = dispose_class; - directx->config = xine->config; - directx->device_name = device_name; + directx->config = xine->config; + directx->device_name = device_name; return directx; } static vo_info_t vo_info_win32 = { - 7, /* priority */ + 7, /* priority */ XINE_VISUAL_TYPE_DIRECTX /* visual type */ }; diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 5fa3df6e6..3900d5b66 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_fb.c,v 1.32 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: video_out_fb.c,v 1.33 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_fb.c, frame buffer xine driver by Miguel Freitas * @@ -74,14 +74,18 @@ #include <linux/kd.h> #include <linux/vt.h> +#define LOG_MODULE "video_out_fb" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "alphablend.h" #include "yuv2rgb.h" #include "xineutils.h" #include "vo_scale.h" -#define LOG - typedef struct fb_frame_s { vo_frame_t vo_frame; @@ -272,14 +276,12 @@ static void fb_compute_rgb_size(fb_driver_t *this, fb_frame_t *frame) if (frame->sc.output_width & 1) frame->sc.output_width++; -#ifdef LOG - printf("video_out_fb: frame source %d x %d => screen output %d x %d%s\n", - frame->sc.delivered_width, frame->sc.delivered_height, - frame->sc.output_width, frame->sc.output_height, - (frame->sc.delivered_width != frame->sc.output_width || - frame->sc.delivered_height != frame->sc.output_height ? - ", software scaling" : "")); -#endif + lprintf("frame source %d x %d => screen output %d x %d%s\n", + frame->sc.delivered_width, frame->sc.delivered_height, + frame->sc.output_width, frame->sc.output_height, + (frame->sc.delivered_width != frame->sc.output_width || + frame->sc.delivered_height != frame->sc.output_height ? + ", software scaling" : "")); } static void setup_colorspace_converter(fb_frame_t *frame, int flags) @@ -430,10 +432,7 @@ static void fb_update_frame_format(vo_driver_t *this_gen, format != frame->format || this->sc.user_ratio != frame->sc.user_ratio) { -#ifdef LOG - printf("video_out_fb: frame format (from decoder) " - "has changed => adapt\n"); -#endif + lprintf("frame format (from decoder) has changed => adapt\n"); frame->sc.delivered_width = width; frame->sc.delivered_height = height; diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c index 18c9c962d..516e8af56 100644 --- a/src/video_out/video_out_sdl.c +++ b/src/video_out/video_out_sdl.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_sdl.c,v 1.32 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: video_out_sdl.c,v 1.33 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_sdl.c, Simple DirectMedia Layer * @@ -53,6 +53,12 @@ # include <SDL/SDL.h> #endif +#define LOG_MODULE "video_out_sdl" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine.h" #include "xine_internal.h" #include "video_out.h" @@ -64,10 +70,6 @@ #include <X11/Xlib.h> #endif -/* -#define SDL_LOG -*/ - typedef struct sdl_driver_s sdl_driver_t; typedef struct sdl_frame_s { @@ -164,11 +166,9 @@ static void sdl_compute_output_size (sdl_driver_t *this) { _x_vo_scale_compute_output_size( &this->sc ); -#ifdef LOG - printf ("video_out_sdl: frame source %d x %d => screen output %d x %d\n", - this->sc.delivered_width, this->sc.delivered_height, - this->sc.output_width, this->sc.output_height); -#endif + lprintf ("frame source %d x %d => screen output %d x %d\n", + this->sc.delivered_width, this->sc.delivered_height, + this->sc.output_width, this->sc.output_height); } @@ -194,16 +194,12 @@ static void sdl_update_frame_format (vo_driver_t *this_gen, } if( format == XINE_IMGFMT_YV12 ) { -#ifdef SDL_LOG - printf ("video_out_sdl: format YV12 "); -#endif + lprintf ("format YV12 "); frame->overlay = SDL_CreateYUVOverlay (width, height, SDL_YV12_OVERLAY, this->surface); } else if( format == XINE_IMGFMT_YUY2 ) { -#ifdef SDL_LOG - printf ("video_out_sdl: format YUY2 "); -#endif + lprintf ("format YUY2 "); frame->overlay = SDL_CreateYUVOverlay (width, height, SDL_YUY2_OVERLAY, this->surface); } @@ -404,9 +400,7 @@ static int sdl_gui_data_exchange (vo_driver_t *this_gen, switch (data_type) { case XINE_GUI_SEND_DRAWABLE_CHANGED: -#ifdef SDL_LOG - printf ("video_out_sdl: XINE_GUI_SEND_DRAWABLE_CHANGED\n"); -#endif + lprintf ("XINE_GUI_SEND_DRAWABLE_CHANGED\n"); this->drawable = (Drawable) data; /* OOPS! Is it possible to change SDL window id? */ @@ -414,9 +408,7 @@ static int sdl_gui_data_exchange (vo_driver_t *this_gen, break; case XINE_GUI_SEND_EXPOSE_EVENT: -#ifdef SDL_LOG - printf ("video_out_sdl: XINE_GUI_SEND_EXPOSE_EVENT\n"); -#endif + lprintf ("XINE_GUI_SEND_EXPOSE_EVENT\n"); break; case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: diff --git a/src/video_out/video_out_stk.c b/src/video_out/video_out_stk.c index 3d215294b..0b92b6a0d 100644 --- a/src/video_out/video_out_stk.c +++ b/src/video_out/video_out_stk.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_stk.c,v 1.9 2003/11/11 18:45:00 f1rmb Exp $ + * $Id: video_out_stk.c,v 1.10 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_stk.c, Libstk Surface Video Driver * more info on Libstk at http://www.libstk.org @@ -54,6 +54,12 @@ #include <libstk/stk_c_wrapper.h> +#define LOG_MODULE "video_out_stk" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine.h" #include "xine_internal.h" #include "video_out.h" @@ -61,10 +67,6 @@ #include "xineutils.h" #include "vo_scale.h" -/* -#define STK_LOG -*/ - /* Extend the video frame class with stk private data */ typedef struct stk_frame_s { /* public interface */ @@ -156,11 +158,9 @@ static void stk_compute_output_size (stk_driver_t *this) { //printf("video_out_stk: compute_output_size()\n"); _x_vo_scale_compute_output_size( &this->sc ); -#ifdef LOG - printf ("video_out_stk: frame source %d x %d => screen output %d x %d\n", - this->sc.delivered_width, this->sc.delivered_height, - this->sc.output_width, this->sc.output_height); -#endif + lprintf ("frame source %d x %d => screen output %d x %d\n", + this->sc.delivered_width, this->sc.delivered_height, + this->sc.output_width, this->sc.output_height); } @@ -171,13 +171,11 @@ static void stk_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge //printf("video_out_stk: update_frame_format()\n"); if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { -#ifdef STK_LOG - printf("video_out_stk: update_frame_format - %d=%d, %d=%d, %d=%d\n", - frame->width, width, frame->height, height, frame->format, format); - printf("video_out_stk: vo_frame data - width, height, format: %d, %d, %d\n", - frame->vo_frame.width, frame->vo_frame.height, frame->vo_frame.format); -#endif - + lprintf("update_frame_format - %d=%d, %d=%d, %d=%d\n", + frame->width, width, frame->height, height, frame->format, format); + lprintf("vo_frame data - width, height, format: %d, %d, %d\n", + frame->vo_frame.width, frame->vo_frame.height, frame->vo_frame.format); + /* (re-) allocate image */ if (frame->overlay) { stk_overlay_free(frame->overlay); @@ -185,18 +183,14 @@ static void stk_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge } if (format == XINE_IMGFMT_YV12) { -#ifdef STK_LOG - printf ("video_out_stk: format YV12\n"); -#endif - frame->overlay = stk_surface_create_overlay(this->surface, width, height, - STK_FORMAT_YV12); + lprintf ("format YV12\n"); + frame->overlay = stk_surface_create_overlay(this->surface, width, height, + STK_FORMAT_YV12); } else if (format == XINE_IMGFMT_YUY2) { -#ifdef STK_LOG - printf("video_out_stk: format YUY2\n"); -#endif - frame->overlay = stk_surface_create_overlay(this->surface, width, height, - STK_FORMAT_YUY2); + lprintf("format YUY2\n"); + frame->overlay = stk_surface_create_overlay(this->surface, width, height, + STK_FORMAT_YUY2); } if (frame->overlay == NULL) diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 8e06be682..bb4baf299 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_vidix.c,v 1.53 2003/11/26 18:36:34 miguelfreitas Exp $ + * $Id: video_out_vidix.c,v 1.54 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_vidix.c * @@ -53,6 +53,12 @@ #include "vidixlib.h" #include "fourcc.h" +#define LOG_MODULE "video_out_vidix" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "video_out.h" #include "xine_internal.h" #include "alphablend.h" @@ -63,10 +69,6 @@ #include "x11osd.h" #endif -/* -#define LOG -*/ - #define NUM_FRAMES 3 typedef struct vidix_driver_s vidix_driver_t; @@ -436,9 +438,7 @@ static void vidix_config_playback (vidix_driver_t *this) { _x_vo_scale_compute_output_size( &this->sc ); if( this->vidix_started > 0 ) { -#ifdef LOG - printf("video_out_vidix: overlay off\n"); -#endif + lprintf("video_out_vidix: overlay off\n"); vdlPlaybackOff(this->vidix_handler); } @@ -469,31 +469,29 @@ static void vidix_config_playback (vidix_driver_t *this) { return; } -#ifdef LOG - printf("video_out_vidix: dga_addr = %p frame_size = %d frames = %d\n", - this->vidix_play.dga_addr, this->vidix_play.frame_size, - this->vidix_play.num_frames ); + lprintf("video_out_vidix: dga_addr = %p frame_size = %d frames = %d\n", + this->vidix_play.dga_addr, this->vidix_play.frame_size, + this->vidix_play.num_frames ); - printf("video_out_vidix: offsets[0..2] = %d %d %d\n", - this->vidix_play.offsets[0], this->vidix_play.offsets[1], - this->vidix_play.offsets[2] ); + lprintf("video_out_vidix: offsets[0..2] = %d %d %d\n", + this->vidix_play.offsets[0], this->vidix_play.offsets[1], + this->vidix_play.offsets[2] ); - printf("video_out_vidix: offset.y/u/v = %d/%d/%d\n", - this->vidix_play.offset.y, this->vidix_play.offset.u, - this->vidix_play.offset.v ); + lprintf("video_out_vidix: offset.y/u/v = %d/%d/%d\n", + this->vidix_play.offset.y, this->vidix_play.offset.u, + this->vidix_play.offset.v ); - printf("video_out_vidix: src.x/y/w/h = %d/%d/%d/%d\n", - this->vidix_play.src.x, this->vidix_play.src.y, - this->vidix_play.src.w, this->vidix_play.src.h ); + lprintf("video_out_vidix: src.x/y/w/h = %d/%d/%d/%d\n", + this->vidix_play.src.x, this->vidix_play.src.y, + this->vidix_play.src.w, this->vidix_play.src.h ); - printf("video_out_vidix: dest.x/y/w/h = %d/%d/%d/%d\n", - this->vidix_play.dest.x, this->vidix_play.dest.y, - this->vidix_play.dest.w, this->vidix_play.dest.h ); - - printf("video_out_vidix: dest.pitch.y/u/v = %d/%d/%d\n", - this->vidix_play.dest.pitch.y, this->vidix_play.dest.pitch.u, - this->vidix_play.dest.pitch.v ); -#endif + lprintf("video_out_vidix: dest.x/y/w/h = %d/%d/%d/%d\n", + this->vidix_play.dest.x, this->vidix_play.dest.y, + this->vidix_play.dest.w, this->vidix_play.dest.h ); + + lprintf("video_out_vidix: dest.pitch.y/u/v = %d/%d/%d\n", + this->vidix_play.dest.pitch.y, this->vidix_play.dest.pitch.u, + this->vidix_play.dest.pitch.v ); this->vidix_mem = this->vidix_play.dga_addr; @@ -522,9 +520,7 @@ static void vidix_config_playback (vidix_driver_t *this) { this->delivered_format); } -#ifdef LOG - printf("video_out_vidix: overlay on\n"); -#endif + lprintf("video_out_vidix: overlay on\n"); vdlPlaybackOn(this->vidix_handler); this->vidix_started = 1; } @@ -664,17 +660,15 @@ static void vidix_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) || (frame->format != this->delivered_format ) ) { -#ifdef LOG - printf("video_out_vidix: change frame format\n"); -#endif - - this->sc.delivered_width = frame->width; - this->sc.delivered_height = frame->height; - this->sc.delivered_ratio = frame->ratio; - this->delivered_format = frame->format; - - vidix_compute_ideal_size( this ); - this->sc.force_redraw = 1; + lprintf("video_out_vidix: change frame format\n"); + + this->sc.delivered_width = frame->width; + this->sc.delivered_height = frame->height; + this->sc.delivered_ratio = frame->ratio; + this->delivered_format = frame->format; + + vidix_compute_ideal_size( this ); + this->sc.force_redraw = 1; } /* @@ -712,10 +706,8 @@ static int vidix_get_property (vo_driver_t *this_gen, int property) { break; } -#ifdef LOG - printf ("video_out_vidix: property #%d = %d\n", property, - this->props[property].value); -#endif + lprintf ("video_out_vidix: property #%d = %d\n", property, + this->props[property].value); return this->props[property].value; } @@ -733,10 +725,8 @@ static int vidix_set_property (vo_driver_t *this_gen, this->props[property].value = value; if ( property == VO_PROP_ASPECT_RATIO) { -#ifdef LOG - printf("video_out_vidix: aspect ratio changed to %s\n", - _x_vo_scale_aspect_ratio_name(value)); -#endif + lprintf("video_out_vidix: aspect ratio changed to %s\n", + _x_vo_scale_aspect_ratio_name(value)); if(value == XINE_VO_ASPECT_NUM_RATIOS) value = this->props[property].value = XINE_VO_ASPECT_AUTO; @@ -871,9 +861,7 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, switch (data_type) { case XINE_GUI_SEND_DRAWABLE_CHANGED: -#ifdef LOG - printf ("video_out_vidix: GUI_DATA_EX_DRAWABLE_CHANGED\n"); -#endif + lprintf ("video_out_vidix: GUI_DATA_EX_DRAWABLE_CHANGED\n"); if(this->visual_type == XINE_VISUAL_TYPE_X11) { #ifdef HAVE_X11 @@ -890,9 +878,7 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, break; case XINE_GUI_SEND_EXPOSE_EVENT: -#ifdef LOG - printf ("video_out_vidix: GUI_DATA_EX_EXPOSE_EVENT\n"); -#endif + lprintf ("video_out_vidix: GUI_DATA_EX_EXPOSE_EVENT\n"); vidix_clean_output_area(this); #ifdef HAVE_X11 XLockDisplay (this->display); diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 26e9bd4c1..4cde70123 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xshm.c,v 1.121 2003/11/26 18:36:34 miguelfreitas Exp $ + * $Id: video_out_xshm.c,v 1.122 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -54,6 +54,12 @@ #include <pthread.h> #include <netinet/in.h> +#define LOG_MODULE "video_out_xshm" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "alphablend.h" #include "yuv2rgb.h" @@ -61,10 +67,6 @@ #include "vo_scale.h" #include "x11osd.h" -/* -#define LOG -*/ - typedef struct { vo_frame_t vo_frame; @@ -320,9 +322,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { vo_img->proc_called = 1; -#ifdef LOG - printf ("video_out_xshm: copy... (format %d)\n", frame->format); -#endif + lprintf ("copy... (format %d)\n", frame->format); if (frame->format == XINE_IMGFMT_YV12) frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, @@ -331,9 +331,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0]); -#ifdef LOG - printf ("video_out_xshm: copy...done\n"); -#endif + lprintf ("copy...done\n"); } static void xshm_frame_field (vo_frame_t *vo_img, int which_field) { @@ -423,7 +421,7 @@ static void xshm_compute_rgb_size (xshm_driver_t *this, xshm_frame_t *frame) { if (frame->sc.output_width & 1) /* yuv2rgb_mlib needs an even YUV2 width */ frame->sc.output_width++; - lprintf("video_out_xshm: frame source %d x %d => screen output %d x %d%s\n", + lprintf("frame source %d x %d => screen output %d x %d%s\n", frame->sc.delivered_width, frame->sc.delivered_height, frame->sc.output_width, frame->sc.output_height, ( frame->sc.delivered_width != frame->sc.output_width @@ -459,7 +457,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, do_adapt = 1; - lprintf ("video_out_xshm: frame format (from decoder) has changed => adapt\n"); + lprintf ("frame format (from decoder) has changed => adapt\n"); frame->sc.delivered_width = width; frame->sc.delivered_height = height; @@ -488,7 +486,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, xshm_compute_rgb_size (this, frame); - lprintf ("video_out_xshm: gui_size has changed => adapt\n"); + lprintf ("gui_size has changed => adapt\n"); } @@ -496,7 +494,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, if (do_adapt) { - lprintf ("video_out_xshm: updating frame to %d x %d\n", + lprintf ("updating frame to %d x %d\n", frame->sc.output_width, frame->sc.output_height); XLockDisplay (this->display); @@ -544,7 +542,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->chunk[2] = NULL; } - lprintf ("video_out_xshm: stripe out_ht=%i, deliv_ht=%i\n", + lprintf ("stripe out_ht=%i, deliv_ht=%i\n", frame->sc.output_height, frame->sc.delivered_height); /* @@ -713,8 +711,8 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { xshm_driver_t *this = (xshm_driver_t *) this_gen; xshm_frame_t *frame = (xshm_frame_t *) frame_gen; - lprintf ("video_out_xshm: display frame...\n"); - lprintf ("video_out_xshm: about to draw frame %d x %d...\n", + lprintf ("display frame...\n"); + lprintf ("about to draw frame %d x %d...\n", frame->sc.output_width, frame->sc.output_height); /* @@ -744,11 +742,11 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { this->cur_frame = frame; XLockDisplay (this->display); - lprintf ("video_out_xshm: display locked...\n"); + lprintf ("display locked...\n"); if (this->use_shm) { - lprintf ("video_out_xshm: put image (shm)\n"); + lprintf ("put image (shm)\n"); XShmPutImage(this->display, this->drawable, this->gc, frame->image, 0, 0, frame->sc.output_xoffset, frame->sc.output_yoffset, @@ -756,7 +754,7 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { } else { - lprintf ("video_out_xshm: put image (plain/remote)\n"); + lprintf ("put image (plain/remote)\n"); XPutImage(this->display, this->drawable, this->gc, frame->image, 0, 0, frame->sc.output_xoffset, frame->sc.output_yoffset, @@ -766,7 +764,7 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { XSync(this->display, False); XUnlockDisplay (this->display); - lprintf ("video_out_xshm: display frame done\n"); + lprintf ("display frame done\n"); } static int xshm_get_property (vo_driver_t *this_gen, int property) { @@ -879,7 +877,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, case XINE_GUI_SEND_EXPOSE_EVENT: - lprintf ("video_out_xshm: expose event\n"); + lprintf ("expose event\n"); if (this->cur_frame) { XExposeEvent * xev = (XExposeEvent *) data; diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index ae9b76579..a91bf39eb 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xv.c,v 1.183 2003/11/26 18:36:34 miguelfreitas Exp $ + * $Id: video_out_xv.c,v 1.184 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -64,6 +64,12 @@ #include <X11/extensions/Xv.h> #include <X11/extensions/Xvlib.h> +#define LOG_MODULE "vidoe_out_xv" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine.h" #include "video_out.h" #include "xine_internal.h" @@ -74,10 +80,6 @@ #include "vo_scale.h" #include "x11osd.h" -/* -#define LOG -*/ - typedef struct xv_driver_s xv_driver_t; typedef struct { @@ -736,9 +738,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) ) { -#ifdef LOG - printf("video_out_xv: frame format changed\n"); -#endif + lprintf("frame format changed\n"); this->sc.force_redraw = 1; /* trigger re-calc of output size */ } @@ -1337,11 +1337,10 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->xv_format_yuy2 = 0; for(i = 0; i < formats; i++) { -#ifdef LOG - printf ("video_out_xv: Xv image format: 0x%x (%4.4s) %s\n", - fo[i].id, (char*)&fo[i].id, - (fo[i].format == XvPacked) ? "packed" : "planar"); -#endif + lprintf ("Xv image format: 0x%x (%4.4s) %s\n", + fo[i].id, (char*)&fo[i].id, + (fo[i].format == XvPacked) ? "packed" : "planar"); + if (fo[i].id == XINE_IMGFMT_YV12) { this->xv_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c index 547cf5804..04c94ba0b 100644 --- a/src/video_out/video_out_xvmc.c +++ b/src/video_out/video_out_xvmc.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xvmc.c,v 1.8 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: video_out_xvmc.c,v 1.9 2003/11/26 19:43:38 f1rmb Exp $ * * video_out_xvmc.c, X11 video motion compensation extension interface for xine * @@ -61,6 +61,12 @@ #include <X11/extensions/XvMClib.h> #include <X11/extensions/XvMC.h> +#define LOG_MODULE "video_out_xvmc" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine.h" #include "video_out.h" #include "xine_internal.h" @@ -72,11 +78,7 @@ #include "xineutils.h" #include "vo_scale.h" -/* -#define LOG -*/ /* #define LOG1 */ -/* #define LOG */ /* #define DLOG */ /* #define PRINTDATA */ @@ -458,7 +460,7 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, static uint32_t xvmc_get_capabilities (vo_driver_t *this_gen) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_get_capabilities\n"); + lprintf ("xvmc_get_capabilities\n"); return this->capabilities; } @@ -466,7 +468,7 @@ static uint32_t xvmc_get_capabilities (vo_driver_t *this_gen) { static void xvmc_frame_field (vo_frame_t *vo_img, int which_field) { xvmc_driver_t *this = (xvmc_driver_t *) vo_img->driver; - lprintf ("video_out_xvmc: xvmc_frame_field\n"); + lprintf ("xvmc_frame_field\n"); this->macroblocks.num_blocks = 0; this->macroblocks.macroblockptr = this->macroblocks.macroblockbaseptr; @@ -477,7 +479,7 @@ static void xvmc_frame_dispose (vo_frame_t *vo_img) { xvmc_frame_t *frame = (xvmc_frame_t *) vo_img ; xvmc_driver_t *this = (xvmc_driver_t *) vo_img->driver; - lprintf ("video_out_xvmc: xvmc_frame_dispose\n"); + lprintf ("xvmc_frame_dispose\n"); /* * TODO - clean up of images/surfaces and frames @@ -505,12 +507,12 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, xvmc_frame_t *forward_frame = (xvmc_frame_t *) forward_ref_image; xvmc_frame_t *backward_frame = (xvmc_frame_t *) backward_ref_image; - lprintf ("video_out_xvmc: xvmc_render_macro_blocks\n"); - lprintf (" slices %d 0x%08lx 0x%08lx 0x%08lx\n", + lprintf ("xvmc_render_macro_blocks\n"); + lprintf ("slices %d 0x%08lx 0x%08lx 0x%08lx\n", macroblocks->slices, (long) current_frame, (long) backward_frame, (long) forward_frame); - /* lprintf (" slices %d 0x%08lx 0x%08lx 0x%08lx\n",macroblocks->slices, + /* lprintf ("slices %d 0x%08lx 0x%08lx 0x%08lx\n",macroblocks->slices, (long) current_frame->surface, (long) backward_frame->surface, (long) forward_frame->surface); */ @@ -559,14 +561,14 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, /* XvMCFlushSurface(this->display, ¤t_frame->surface); */ - lprintf ("video_out_xvmc: xvmc_render_macro_blocks done\n"); + lprintf ("xvmc_render_macro_blocks done\n"); } static vo_frame_t *xvmc_alloc_frame (vo_driver_t *this_gen) { xvmc_frame_t *frame; xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_alloc_frame\n"); + lprintf ("xvmc_alloc_frame\n"); frame = (xvmc_frame_t *) malloc (sizeof (xvmc_frame_t)); @@ -604,7 +606,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, int slices = 1; xvmc_macroblocks_t *macroblocks = (xvmc_macroblocks_t *) macro_blocks; - lprintf ("video_out_xvmc: xvmc_set_context %dx%d %04x\n",width,height,format); + lprintf ("xvmc_set_context %dx%d %04x\n",width,height,format); /* initialize block & macro block pointers first time */ if(macroblocks->blocks == NULL || macroblocks->macro_blocks == NULL) { @@ -613,7 +615,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, memset (macroblocks->blocks, 0, sizeof(XvMCBlockArray)); memset (macroblocks->macro_blocks, 0, sizeof(XvMCMacroBlockArray)); - lprintf(" macroblocks->blocks %lx ->macro_blocks %lx\n", + lprintf("macroblocks->blocks %lx ->macro_blocks %lx\n", macroblocks->blocks,macroblocks->macro_blocks); } @@ -624,7 +626,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, (flags == this->surface_flags)) { /* don't need to change context */ - lprintf ("video_out_xvmc: didn't change context\n"); + lprintf ("didn't change context\n"); return(&this->context_id); @@ -636,7 +638,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, * flush any drawing and wait till we are done with the old stuff * blow away the old stuff */ - lprintf ("video_out_xvmc: freeing previous context\n"); + lprintf ("freeing previous context\n"); XvMCDestroyBlocks(this->display, macroblocks->blocks); XvMCDestroyMacroBlocks(this->display, macroblocks->macro_blocks); @@ -721,7 +723,7 @@ static XvImage *create_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, unsigned int xvmc_format; XvImage *image = NULL; - lprintf ("video_out_xvmc: create_ximage\n"); + lprintf ("create_ximage\n"); switch (format) { case XINE_IMGFMT_YV12: @@ -768,7 +770,7 @@ static void dispose_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, XvImage *myimage) { - lprintf ("video_out_xvmc: dispose_ximage\n"); + lprintf ("dispose_ximage\n"); XFree(myimage); } @@ -779,13 +781,13 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen, xvmc_driver_t *this = (xvmc_driver_t *) this_gen; xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen; - lprintf ("video_out_xvmc: xvmc_update_frame_format\n"); + lprintf ("xvmc_update_frame_format\n"); if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { - lprintf ("video_out_xvmc: updating frame to %d x %d (ratio=%f, format=%08x)\n", + lprintf ("updating frame to %d x %d (ratio=%f, format=%08x)\n", width, height, ratio, format); XLockDisplay (this->display); @@ -828,7 +830,7 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen, } static void xvmc_clean_output_area (xvmc_driver_t *this) { - lprintf ("video_out_xvmc: xvmc_clean_output_area\n"); + lprintf ("xvmc_clean_output_area\n"); XLockDisplay (this->display); XSetForeground (this->display, this->gc, this->black.pixel); @@ -866,7 +868,7 @@ static void xvmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen; - lprintf ("video_out_xvmc: xvmc_overlay_blend\n"); + lprintf ("xvmc_overlay_blend\n"); /* Alpha Blend here * As XV drivers improve to support Hardware overlay, we will change this function. @@ -885,7 +887,7 @@ static void xvmc_overlay_blend (vo_driver_t *this_gen, static void xvmc_add_recent_frame (xvmc_driver_t *this, xvmc_frame_t *frame) { int i; - lprintf ("video_out_xvmc: xvmc_add_recent_frame\n"); + lprintf ("xvmc_add_recent_frame\n"); i = VO_NUM_RECENT_FRAMES-1; if( this->recent_frames[i] ) @@ -903,7 +905,7 @@ static void xvmc_add_recent_frame (xvmc_driver_t *this, xvmc_frame_t *frame) { static void xvmc_flush_recent_frames (xvmc_driver_t *this) { int i; - lprintf ("video_out_xvmc: xvmc_flush_recent_frames\n"); + lprintf ("xvmc_flush_recent_frames\n"); for( i=0; i < VO_NUM_RECENT_FRAMES; i++ ) { if( this->recent_frames[i] ) @@ -943,7 +945,7 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen; int status; - lprintf ("video_out_xvmc: xvmc_display_frame %d %x\n",frame_gen->id,frame_gen); + lprintf ("xvmc_display_frame %d %x\n",frame_gen->id,frame_gen); /* * queue frames (deinterlacing) @@ -962,7 +964,7 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) ) { - lprintf("video_out_xvmc: frame format changed\n"); + lprintf("frame format changed\n"); /* this->delivered_width = frame->width; @@ -1021,7 +1023,7 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int xvmc_get_property (vo_driver_t *this_gen, int property) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_get_property\n"); + lprintf ("xvmc_get_property\n"); switch (property) { case VO_PROP_WINDOW_WIDTH: @@ -1039,7 +1041,7 @@ static void xvmc_property_callback (void *property_gen, xine_cfg_entry_t *entry) xvmc_property_t *property = (xvmc_property_t *) property_gen; xvmc_driver_t *this = property->this; - lprintf ("video_out_xvmc: xvmc_property_callback\n"); + lprintf ("xvmc_property_callback\n"); XLockDisplay(this->display); XvSetPortAttribute (this->display, this->xv_port, @@ -1051,7 +1053,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, int property, int value) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_set_property %d value %d\n",property,value); + lprintf ("xvmc_set_property %d value %d\n",property,value); if (this->props[property].atom != None) { /* value is out of bound */ @@ -1075,7 +1077,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, switch (property) { case VO_PROP_INTERLACED: this->props[property].value = value; - lprintf("video_out_xvmc: VO_PROP_INTERLACED(%d)\n", this->props[property].value); + lprintf("VO_PROP_INTERLACED(%d)\n", this->props[property].value); this->deinterlace_enabled = value; if (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) { @@ -1088,7 +1090,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; - lprintf("video_out_xvmc: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); + lprintf("VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); xvmc_compute_ideal_size (this); xvmc_compute_output_size (this); @@ -1129,7 +1131,7 @@ static void xvmc_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_get_property_min_max\n"); + lprintf ("xvmc_get_property_min_max\n"); *min = this->props[property].min; *max = this->props[property].max; @@ -1139,14 +1141,14 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_gui_data_exchange\n"); + lprintf ("xvmc_gui_data_exchange\n"); switch (data_type) { case XINE_GUI_SEND_EXPOSE_EVENT: { /* XExposeEvent * xev = (XExposeEvent *) data; */ /* FIXME : take care of completion events */ - lprintf ("video_out_xvmc: XINE_GUI_SEND_EXPOSE_EVENT\n"); + lprintf ("XINE_GUI_SEND_EXPOSE_EVENT\n"); if (this->cur_frame) { int i; @@ -1234,7 +1236,7 @@ static void xvmc_dispose (vo_driver_t *this_gen) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; int i; - lprintf ("video_out_xvmc: xvmc_dispose\n"); + lprintf ("xvmc_dispose\n"); if (this->deinterlace_frame.image) { /* dispose_ximage should be xlocked */ @@ -1260,7 +1262,7 @@ static void xvmc_dispose (vo_driver_t *this_gen) { XLockDisplay (this->display); if(XvUngrabPort (this->display, this->xv_port, CurrentTime) != Success) { - lprintf ("video_out_xvmc: xvmc_dispose: XvUngrabPort() failed.\n"); + lprintf ("xvmc_dispose: XvUngrabPort() failed.\n"); } XUnlockDisplay (this->display); @@ -1331,7 +1333,7 @@ static void xvmc_check_capability (xvmc_driver_t *this, static void xvmc_update_deinterlace(void *this_gen, xine_cfg_entry_t *entry) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_update_deinterlace method = %d\n",entry->num_value); + lprintf ("xvmc_update_deinterlace method = %d\n",entry->num_value); this->deinterlace_method = entry->num_value; } @@ -1349,7 +1351,7 @@ static void xvmc_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry XvSetPortAttribute (this->display, this->xv_port, atom, xvmc_double_buffer); XUnlockDisplay(this->display); - lprintf("video_out_xvmc: double buffering mode = %d\n",xvmc_double_buffer); + lprintf("double buffering mode = %d\n",xvmc_double_buffer); } static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) { @@ -1366,7 +1368,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XColor dummy; /* XvImage *myimage; */ - lprintf ("video_out_xvmc: open_plugin\n"); + lprintf ("open_plugin\n"); display = visual->display; @@ -1518,19 +1520,19 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->xvmc_format_yuy2 = 0; for(i = 0; i < formats; i++) { - lprintf ("video_out_xvmc: XvMC image format: 0x%x (%4.4s) %s\n", + lprintf ("XvMC image format: 0x%x (%4.4s) %s\n", fo[i].id, (char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar"); if (fo[i].id == XINE_IMGFMT_YV12) { this->xvmc_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; - lprintf("video_out_xvmc: this adaptor supports the yv12 format.\n"); + lprintf("this adaptor supports the yv12 format.\n"); } else if (fo[i].id == XINE_IMGFMT_YUY2) { this->xvmc_format_yuy2 = fo[i].id; this->capabilities |= VO_CAP_YUY2; - lprintf("video_out_xvmc: this adaptor supports the yuy2 format.\n"); + lprintf("this adaptor supports the yuy2 format.\n"); } } @@ -1552,7 +1554,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi NULL, 10, xvmc_update_deinterlace, this); this->deinterlace_enabled = 1; /* default is enabled */ - lprintf("video_out_xvmc: deinterlace_methods %d ",this->deinterlace_method); + lprintf("deinterlace_methods %d ",this->deinterlace_method); switch(this->deinterlace_method) { case DEINTERLACE_NONE: @@ -1578,7 +1580,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi break; } - lprintf("video_out_xvmc: initialization of plugin successful\n"); + lprintf("initialization of plugin successful\n"); return &this->vo_driver; } @@ -1627,7 +1629,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* * check for Xv and XvMC video support */ - lprintf ("video_out_xvmc: XvMC init_class\n"); + lprintf ("XvMC init_class\n"); XLockDisplay(display); if (Success != XvQueryExtension(display, &ver, &rel, &req, &ev, &err)) { @@ -1684,13 +1686,13 @@ static void *init_class (xine_t *xine, void *visual_gen) { } if(!xv_port) { /* try for just XVMC_MOCOMP */ - lprintf ("video_out_xvmc: didn't find XVMC_IDCT acceleration trying for MC\n"); + lprintf ("didn't find XVMC_IDCT acceleration trying for MC\n"); for(surface_num = 0; surface_num < types; surface_num++) { if((surfaceInfo[surface_num].chroma_format == XVMC_CHROMA_FORMAT_420) && ((surfaceInfo[surface_num].mc_type == (XVMC_MOCOMP | XVMC_MPEG_2)))) { - lprintf ("video_out_xvmc: Found XVMC_MOCOMP\n"); + lprintf ("Found XVMC_MOCOMP\n"); max_width = surfaceInfo[surface_num].max_width; max_height = surfaceInfo[surface_num].max_height; @@ -1710,7 +1712,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { } } if(xv_port) { - lprintf ("video_out_xvmc: port %ld surface %d\n",xv_port,j); + lprintf ("port %ld surface %d\n",xv_port,j); if(surfaceInfo[j].flags & XVMC_OVERLAID_SURFACE) useOverlay = 1; @@ -1782,7 +1784,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->max_surface_height = max_height; this->acceleration = IDCTaccel; - lprintf("video_out_xvmc: init_class done\n"); + lprintf("init_class done\n"); return this; } diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c index ac7a55b2b..174d1414e 100644 --- a/src/video_out/yuv2rgb.c +++ b/src/video_out/yuv2rgb.c @@ -23,7 +23,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: yuv2rgb.c,v 1.45 2003/10/20 00:33:29 komadori Exp $ + * $Id: yuv2rgb.c,v 1.46 2003/11/26 19:43:38 f1rmb Exp $ */ #include "config.h" @@ -34,12 +34,15 @@ #include <inttypes.h> #include "yuv2rgb.h" -#include "xineutils.h" +#define LOG_MODULE "yuv2rgb" +#define LOG_VERBOSE /* -#define LOG +#define LOG */ +#include "xineutils.h" + static int prof_scale_line = -1; static scale_line_func_t find_scale_line_func(int step); @@ -3212,9 +3215,8 @@ yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, } #endif if (this->yuv2rgb_fun == NULL) { -#ifdef LOG - printf ("yuv2rgb: no accelerated colorspace conversion found\n"); -#endif + lprintf ("no accelerated colorspace conversion found\n"); + yuv2rgb_c_init (this); } |