diff options
Diffstat (limited to 'src/video_out')
-rw-r--r-- | src/video_out/alphablend.c | 4 | ||||
-rw-r--r-- | src/video_out/deinterlace.c | 6 | ||||
-rw-r--r-- | src/video_out/video_out_aa.c | 38 | ||||
-rw-r--r-- | src/video_out/video_out_directfb.c | 64 | ||||
-rwxr-xr-x | src/video_out/video_out_directx.c | 38 | ||||
-rw-r--r-- | src/video_out/video_out_fb.c | 145 | ||||
-rw-r--r-- | src/video_out/video_out_none.c | 32 | ||||
-rw-r--r-- | src/video_out/video_out_opengl.c | 44 | ||||
-rw-r--r-- | src/video_out/video_out_pgx64.c | 57 | ||||
-rw-r--r-- | src/video_out/video_out_sdl.c | 54 | ||||
-rw-r--r-- | src/video_out/video_out_stk.c | 47 | ||||
-rw-r--r-- | src/video_out/video_out_syncfb.c | 151 | ||||
-rw-r--r-- | src/video_out/video_out_vidix.c | 89 | ||||
-rw-r--r-- | src/video_out/video_out_xshm.c | 61 | ||||
-rw-r--r-- | src/video_out/video_out_xv.c | 80 | ||||
-rw-r--r-- | src/video_out/video_out_xvmc.c | 111 | ||||
-rw-r--r-- | src/video_out/x11osd.c | 19 | ||||
-rw-r--r-- | src/video_out/x11osd.h | 18 | ||||
-rw-r--r-- | src/video_out/yuv2rgb.c | 10 |
19 files changed, 546 insertions, 522 deletions
diff --git a/src/video_out/alphablend.c b/src/video_out/alphablend.c index ecf963613..111f3fee3 100644 --- a/src/video_out/alphablend.c +++ b/src/video_out/alphablend.c @@ -767,7 +767,9 @@ void blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, #endif if ((rlelen < 0) || (rle_remainder < 0)) { +#ifdef LOG_BLEND_YUV printf("alphablend: major bug in blend_yuv < 0\n"); +#endif } if (rlelen == 0) { rle_remainder = rlelen = rle->len; @@ -971,7 +973,9 @@ void blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, uint16_t o; if ((rlelen < 0) || (rle_remainder < 0)) { +#ifdef LOG_BLEND_YUV printf("alphablend: major bug in blend_yuv < 0\n"); +#endif } if (rlelen == 0) { rle_remainder = rlelen = rle->len; diff --git a/src/video_out/deinterlace.c b/src/video_out/deinterlace.c index fe75cee5c..d08346cfc 100644 --- a/src/video_out/deinterlace.c +++ b/src/video_out/deinterlace.c @@ -811,7 +811,7 @@ void deinterlace_yuv( uint8_t *pdst, uint8_t *psrc[], xine_fast_memcpy(pdst,psrc[0],width*height); break; case DEINTERLACE_ONEFIELDXV: - printf("deinterlace: ONEFIELDXV must be handled by the video driver.\n"); + lprintf("deinterlace: ONEFIELDXV must be handled by the video driver.\n"); break; case DEINTERLACE_LINEARBLEND: if( check_for_mmx() ) @@ -820,7 +820,7 @@ void deinterlace_yuv( uint8_t *pdst, uint8_t *psrc[], deinterlace_linearblend_yuv(pdst,psrc,width,height); break; default: - printf("deinterlace: unknow method %d.\n",method); + lprintf("deinterlace: unknow method %d.\n",method); break; } } @@ -836,7 +836,7 @@ int deinterlace_yuv_supported ( int method ) case DEINTERLACE_ONEFIELD: return check_for_mmx(); case DEINTERLACE_ONEFIELDXV: - printf ("deinterlace: ONEFIELDXV must be handled by the video driver.\n"); + lprintf ("deinterlace: ONEFIELDXV must be handled by the video driver.\n"); return 0; case DEINTERLACE_LINEARBLEND: return 1; diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index 17a947fee..accd9c22b 100644 --- a/src/video_out/video_out_aa.c +++ b/src/video_out/video_out_aa.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_aa.c,v 1.40 2003/10/31 17:25:20 mroi Exp $ + * $Id: video_out_aa.c,v 1.41 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_aa.c, ascii-art output plugin for xine * @@ -66,6 +66,7 @@ typedef struct { vo_driver_t vo_driver; config_values_t *config; + xine_t *xine; int user_ratio; aa_context *context; @@ -75,6 +76,7 @@ typedef struct { video_driver_class_t driver_class; config_values_t *config; + xine_t *xine; } aa_class_t; @@ -103,30 +105,28 @@ static void aa_frame_field (vo_frame_t *vo_img, int which_field) { } -static vo_frame_t *aa_alloc_frame(vo_driver_t *this) { - aa_frame_t *frame; +static vo_frame_t *aa_alloc_frame(vo_driver_t *this_gen) { + /* aa_driver_t *this = (aa_driver_t*) this_gen; */ + aa_frame_t *frame; - frame = (aa_frame_t *) malloc (sizeof (aa_frame_t)); - if (frame == NULL) { - printf("aa_alloc_frame: out of memory\n"); + frame = (aa_frame_t *) xine_xmalloc (sizeof (aa_frame_t)); + if (!frame) return NULL; - } - memset (frame, 0, sizeof (aa_frame_t)); frame->vo_frame.proc_slice = NULL; frame->vo_frame.proc_frame = NULL; frame->vo_frame.field = aa_frame_field; frame->vo_frame.dispose = aa_dispose_frame; - frame->vo_frame.driver = this; + frame->vo_frame.driver = this_gen; return (vo_frame_t*) frame; } -static void aa_update_frame_format (vo_driver_t *this, vo_frame_t *img, +static void aa_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, uint32_t width, uint32_t height, double ratio, int format, int flags) { - - aa_frame_t *frame = (aa_frame_t *) img; + aa_driver_t *this = (aa_driver_t*) this_gen; + aa_frame_t *frame = (aa_frame_t *) img; /* printf ("aa_update_format...\n"); */ @@ -166,7 +166,7 @@ static void aa_update_frame_format (vo_driver_t *this, vo_frame_t *img, frame->vo_frame.pitches[0] = 8*((width + 3) / 4); frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[0] * height, (void**) &frame->mem[0]); } else { - printf ("alert! unsupported image format %04x\n", format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "alert! unsupported image format %04x\n", format); abort(); } @@ -236,7 +236,8 @@ static int aa_get_property (vo_driver_t *this_gen, int property) { if ( property == VO_PROP_ASPECT_RATIO) { return this->user_ratio ; } else { - printf ("video_out_aa: tried to get unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_aa: tried to get unsupported property %d\n", property); } return 0; @@ -252,7 +253,8 @@ static int aa_set_property (vo_driver_t *this_gen, this->user_ratio = value; } else { - printf ("video_out_aa: tried to set unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_aa: tried to set unsupported property %d\n", property); } return value; @@ -275,11 +277,12 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi aa_class_t *class = (aa_class_t *) class_gen; aa_driver_t *this; - this = (aa_driver_t*) malloc (sizeof (aa_driver_t)); + this = (aa_driver_t*) xine_xmalloc (sizeof (aa_driver_t)); this->context = (aa_context*) visual_gen; this->config = class->config; + this->xine = class->xine; this->vo_driver.get_capabilities = aa_get_capabilities; this->vo_driver.alloc_frame = aa_alloc_frame ; @@ -314,7 +317,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* aa_context *context = (aa_context*) visual_gen; */ aa_class_t *this; - this = (aa_class_t *) malloc(sizeof(aa_class_t)); + this = (aa_class_t *) xine_xmalloc(sizeof(aa_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -322,6 +325,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->driver_class.dispose = dispose_class; this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c index 14e271908..63b099200 100644 --- a/src/video_out/video_out_directfb.c +++ b/src/video_out/video_out_directfb.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_directfb.c,v 1.23 2003/10/23 15:17:07 mroi Exp $ + * $Id: video_out_directfb.c,v 1.24 2003/12/05 15:55:03 f1rmb Exp $ * * DirectFB based output plugin. * Rich Wareham <richwareham@users.sourceforge.net> @@ -70,6 +70,7 @@ typedef struct directfb_frame_s { vo_frame_t vo_frame; + xine_t *xine; int width, height; double ratio; @@ -80,9 +81,9 @@ typedef struct directfb_frame_s { } directfb_frame_t; typedef struct directfb_driver_s { - vo_driver_t vo_driver; + xine_t *xine; config_values_t *config; directfb_frame_t *cur_frame; @@ -119,7 +120,8 @@ typedef struct directfb_driver_s { } directfb_driver_t; typedef struct { - video_driver_class_t driver_class; + video_driver_class_t driver_class; + xine_t *xine; } directfb_class_t; #define CONTEXT_BAD 0 @@ -137,14 +139,13 @@ static uint32_t directfb_get_capabilities (vo_driver_t *this_gen) { } static void directfb_frame_field (vo_frame_t *vo_img, int which_field) { - - /* directfb_frame_t *frame = (directfb_frame_t *) vo_img ; */ + directfb_frame_t *frame = (directfb_frame_t *) vo_img ; switch(which_field) { case VO_BOTH_FIELDS: break; default: - fprintf(stderr, "Interlaced images not supported\n"); + xprintf(frame->xine, XINE_VERBOSITY_DEBUG, "Interlaced images not supported\n"); } #if 0 switch (which_field) { @@ -179,11 +180,12 @@ static void directfb_frame_dispose (vo_frame_t *vo_img) { static vo_frame_t *directfb_alloc_frame (vo_driver_t *this_gen) { + directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame ; frame = (directfb_frame_t *) calloc (1, sizeof (directfb_frame_t)); if (frame==NULL) { - printf ("directfb_alloc_frame: out of memory\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "directfb_alloc_frame: out of memory\n"); return NULL; } @@ -201,7 +203,8 @@ static vo_frame_t *directfb_alloc_frame (vo_driver_t *this_gen) { frame->vo_frame.dispose = directfb_frame_dispose; frame->surface = NULL; - frame->locked = 0; + frame->locked = 0; + frame->xine = this->xine; return (vo_frame_t *) frame; } @@ -258,7 +261,8 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, l_dsc.pixelformat = DSPF_YUY2; break; default: - fprintf(stderr,"Error unknown image format (%i), assuming YV12\n", frame->format); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "Error unknown image format (%i), assuming YV12\n", frame->format); s_dsc.pixelformat = DSPF_YV12; l_dsc.pixelformat = DSPF_YV12; } @@ -277,7 +281,7 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, l_dsc.options = 0; ret = this->layer->TestConfiguration(this->layer, &l_dsc, &failed ); if (ret == DFB_UNSUPPORTED) { - fprintf(stderr, "Error: Unsupported operation\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "Error: Unsupported operation\n"); return; } DFBCHECK(this->layer->SetConfiguration(this->layer, &l_dsc)); @@ -400,8 +404,8 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen this->last_frame_height = frame->height; this->last_frame_ratio = frame->ratio; - fprintf (stderr, "video_out_directfb: frame size %d x %d\n", - this->frame_width, this->frame_height); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_directfb: frame size %d x %d\n", this->frame_width, this->frame_height); } directfb_render_image (this, frame); @@ -413,12 +417,13 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen static int directfb_get_property (vo_driver_t *this_gen, int property) { - /* directfb_driver_t *this = (directfb_driver_t *) this_gen; */ + directfb_driver_t *this = (directfb_driver_t *) this_gen; if ( property == VO_PROP_ASPECT_RATIO) { return 1; } else { - printf ("video_out_directfb: tried to get unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_directfb: tried to get unsupported property %d\n", property); } return 0; @@ -446,16 +451,17 @@ static char *aspect_ratio_name(int a) static int directfb_set_property (vo_driver_t *this_gen, int property, int value) { - /* directfb_driver_t *this = (directfb_driver_t *) this_gen; */ + directfb_driver_t *this = (directfb_driver_t *) this_gen; if ( property == VO_PROP_ASPECT_RATIO) { if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; /* this->user_ratio = value; */ - printf("video_out_directfb: aspect ratio changed to %s\n", - aspect_ratio_name(value)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_directfb: aspect ratio changed to %s\n", aspect_ratio_name(value)); } else { - printf ("video_out_directfb: tried to set unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_directfb: tried to set unsupported property %d\n", property); } return value; @@ -484,7 +490,7 @@ static void directfb_translate_gui2video(directfb_driver_t *this, static int directfb_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { - /* directfb_driver_t *this = (directfb_driver_t *) this_gen; */ + directfb_driver_t *this = (directfb_driver_t *) this_gen; switch (data_type) { @@ -492,7 +498,7 @@ static int directfb_gui_data_exchange (vo_driver_t *this_gen, return -1; } -fprintf (stderr, "done gui_data_exchange\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "done gui_data_exchange\n"); return 0; } @@ -514,24 +520,20 @@ typedef struct { static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) { - /* directfb_class_t *class = (directfb_class_t *) class_gen; */ + directfb_class_t *class = (directfb_class_t *) class_gen; directfb_driver_t *this; dfb_visual_info_t *visual_info = (dfb_visual_info_t*)visual_gen; - fprintf (stderr, "EXPERIMENTAL directfb output plugin\n"); + xprintf (class->xine, XINE_VERBOSITY_DEBUG, "EXPERIMENTAL directfb output plugin\n"); /* * allocate plugin struct */ - this = malloc (sizeof (directfb_driver_t)); - - if (!this) { - printf ("video_out_directfb: malloc failed\n"); + this = xine_xmalloc (sizeof (directfb_driver_t)); + if (!this) return NULL; - } - - memset (this, 0, sizeof(directfb_driver_t)); + this->xine = class->xine; this->frame_width = 0; this->frame_height = 0; @@ -576,12 +578,14 @@ static void *init_class (xine_t *xine, void *visual_gen) { directfb_class_t *this; - this = (directfb_class_t *) malloc (sizeof (directfb_class_t)); + this = (directfb_class_t *) xine_xmalloc (sizeof (directfb_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; this->driver_class.get_description = get_description; this->driver_class.dispose = dispose_class; + this->xine = xine; + return this; } diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index 4f773d535..dec8eb50f 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.11 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: video_out_directx.c,v 1.12 2003/12/05 15:55:03 f1rmb Exp $ */ typedef unsigned char boolean; @@ -76,6 +76,8 @@ typedef struct { vo_driver_t vo_driver; win32_visual_t *win32_visual; + xine_t *xine; + LPDIRECTDRAW7 ddobj; /* direct draw object */ LPDIRECTDRAWSURFACE primary; /* primary dd surface */ LPDIRECTDRAWSURFACE secondary; /* secondary dd surface */ @@ -99,6 +101,7 @@ typedef struct { video_driver_class_t driver_class; config_values_t *config; char *device_name; + xine_t *xine; } directx_class_t; /* ----------------------------------------- @@ -158,7 +161,7 @@ boolean CreatePrimary( win32_driver_t * win32_driver ) if( result != DD_OK ) { Error( 0, "DirectDrawCreate : error %i", result ); - printf( "vo_out_directx : DirectDrawCreate : error %i\n", result ); + xprintf(win32_driver->xine, XINE_VERBOSITY_DEBUG, "vo_out_directx : DirectDrawCreate : error %i\n", result ); return 0; } @@ -247,14 +250,14 @@ boolean CreateSecondary( win32_driver_t * win32_driver, int width, int height, i DDSURFACEDESC2 ddsd; if( format == XINE_IMGFMT_YV12 ) - printf( "vo_out_directx : switching to YV12 overlay type\n" ); + xprintf(win32_driver->xine, XINE_VERBOSITY_DEBUG, "vo_out_directx : switching to YV12 overlay type\n" ); if( format == XINE_IMGFMT_YUY2 ) - printf( "vo_out_directx : switching to YUY2 overlay type\n" ); + xprintf(win32_driver->xine, XINE_VERBOSITY_DEBUG, "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" ); + xprintf(win32_driver->xine, XINE_VERBOSITY_DEBUG, "vo_out_directx : switching to RGB overlay type\n" ); #endif if( !win32_driver->ddobj ) @@ -833,14 +836,12 @@ static void win32_frame_dispose( vo_frame_t * vo_frame ) static vo_frame_t * win32_alloc_frame( vo_driver_t * vo_driver ) { - win32_frame_t * win32_frame; + win32_driver_t *win32_driver = (win32_driver_t *)vo_driver; + 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"); + win32_frame = ( win32_frame_t * ) xine_malloc( sizeof( win32_frame_t ) ); + if (!win32_frame) return NULL; - } - memset( win32_frame, 0, sizeof( win32_frame_t ) ); win32_frame->vo_frame.proc_slice = NULL; win32_frame->vo_frame.proc_frame = NULL; @@ -901,7 +902,8 @@ static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_ #endif else { - printf ( "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); + xprintf (win32_driver->xine, XINE_VERBOSITY_DEBUG, + "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); exit (1); } @@ -1146,9 +1148,10 @@ static void win32_exit( vo_driver_t * vo_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 )*/ { - win32_driver_t *win32_driver = ( win32_driver_t * ) malloc ( sizeof( win32_driver_t ) ); + directx_class_t *class = (directx_class_t *)class_gen; + win32_driver_t *win32_driver = ( win32_driver_t * ) xine_xmalloc ( sizeof( win32_driver_t ) ); - memset( win32_driver, 0, sizeof( win32_driver_t ) ); + win32_driver->xine = class->xine; /* Make sure that the DirectX drivers are available and present! */ /* Not complete yet */ @@ -1215,7 +1218,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { #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); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "video_out_directx: aborting. (unable to open directx device \"%s\")\n", device_name); return NULL; } close(fd); @@ -1224,14 +1228,14 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* * from this point on, nothing should go wrong anymore */ - directx = (directx_class_t *) malloc (sizeof (directx_class_t)); - memset( directx, 0, sizeof( directx_class_t ) ); + directx = (directx_class_t *) xine_xmalloc (sizeof (directx_class_t)); directx->driver_class.open_plugin = open_plugin; directx->driver_class.get_identifier = get_identifier; directx->driver_class.get_description = get_description; directx->driver_class.dispose = dispose_class; + directx->xine = xine; directx->config = xine->config; directx->device_name = device_name; diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 3900d5b66..80d6221f8 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.33 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: video_out_fb.c,v 1.34 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_fb.c, frame buffer xine driver by Miguel Freitas * @@ -143,12 +143,14 @@ typedef struct fb_driver_s struct fb_fix_screeninfo fb_fix; int use_zero_copy; + xine_t *xine; } fb_driver_t; typedef struct { video_driver_class_t driver_class; config_values_t *config; + xine_t *xine; } fb_class_t; static uint32_t fb_get_capabilities(vo_driver_t *this_gen) @@ -213,14 +215,10 @@ static vo_frame_t *fb_alloc_frame(vo_driver_t *this_gen) this->total_num_native_buffers <= this->used_num_buffers) return 0; - frame = (fb_frame_t *)malloc(sizeof(fb_frame_t)); + frame = (fb_frame_t *)xine_xmalloc(sizeof(fb_frame_t)); if(!frame) - { - fprintf(stderr, "fb_alloc_frame: Out of memory.\n"); - return 0; - } + return NULL; - memset(frame, 0, sizeof(fb_frame_t)); memcpy(&frame->sc, &this->sc, sizeof(vo_scale_t)); pthread_mutex_init(&frame->vo_frame.mutex, NULL); @@ -563,7 +561,8 @@ static void fb_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->sc.output_width = frame->sc.output_width; this->sc.output_height = frame->sc.output_height; - printf("video_out_fb: gui size %d x %d, frame size %d x %d\n", + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: gui size %d x %d, frame size %d x %d\n", this->sc.gui_width, this->sc.gui_height, frame->sc.output_width, frame->sc.output_height); @@ -586,7 +585,8 @@ static void fb_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) this->fb_var.yoffset = frame->yoffset; if(ioctl(this->fd, FBIOPAN_DISPLAY, &this->fb_var) == -1) - perror("video_out_fb: ioctl FBIOPAN_DISPLAY failed"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: ioctl FBIOPAN_DISPLAY failed: %s\n", strerror(errno)); } else { @@ -625,8 +625,8 @@ static int fb_get_property(vo_driver_t *this_gen, int property) return this->sc.gui_height; default: - printf("video_out_fb: tried to get unsupported " - "property %d\n", property); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: tried to get unsupported property %d\n", property); } return 0; @@ -640,22 +640,22 @@ static int fb_set_property(vo_driver_t *this_gen, int property, int value) { case VO_PROP_ASPECT_RATIO: if(value>=XINE_VO_ASPECT_NUM_RATIOS) - value = XINE_VO_ASPECT_AUTO; - this->sc.user_ratio = value; - printf("video_out_fb: aspect ratio changed to %s\n", - _x_vo_scale_aspect_ratio_name(value)); + value = XINE_VO_ASPECT_AUTO; + this->sc.user_ratio = value; + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); break; case VO_PROP_BRIGHTNESS: - this->yuv2rgb_gamma = value; + this->yuv2rgb_gamma = value; this->yuv2rgb_factory-> set_csc_levels(this->yuv2rgb_factory, value, 128, 128); - printf("video_out_fb: gamma changed to %d\n",value); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: gamma changed to %d\n", value); break; default: - printf("video_out_fb: tried to set unsupported " - "property %d\n", property); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: tried to set unsupported property %d\n", property); } return value; @@ -692,13 +692,13 @@ static void fb_dispose(vo_driver_t *this_gen) close(this->fd); } -static int get_fb_var_screeninfo(int fd, struct fb_var_screeninfo *var) +static int get_fb_var_screeninfo(int fd, struct fb_var_screeninfo *var, xine_t *xine) { int i; if(ioctl(fd, FBIOGET_VSCREENINFO, var)) { - perror("video_out_fb: ioctl FBIOGET_VSCREENINFO"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_fb: ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); return 0; } @@ -720,18 +720,18 @@ static int get_fb_var_screeninfo(int fd, struct fb_var_screeninfo *var) /* Get proper value for maximized var->yres_virtual. */ if(ioctl(fd, FBIOGET_VSCREENINFO, var) == -1) { - perror("video_out_fb: ioctl FBIOGET_VSCREENINFO"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_fb: ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); return 0; } return 1; } -static int get_fb_fix_screeninfo(int fd, struct fb_fix_screeninfo *fix) +static int get_fb_fix_screeninfo(int fd, struct fb_fix_screeninfo *fix, xine_t *xine) { if(ioctl(fd, FBIOGET_FSCREENINFO, fix)) { - perror("video_out_fb: ioctl FBIOGET_FSCREENINFO"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_fb: ioctl FBIOGET_FSCREENINFO: %s\n", strerror(errno)); return 0; } @@ -739,9 +739,9 @@ static int get_fb_fix_screeninfo(int fd, struct fb_fix_screeninfo *fix) fix->visual != FB_VISUAL_DIRECTCOLOR) || fix->type != FB_TYPE_PACKED_PIXELS) { - fprintf(stderr, "video_out_fb: only packed truecolor/directcolor is supported (%d).\n" - " Check 'fbset -i' or try 'fbset -depth 16'.\n", - fix->visual); + xprintf(xine, XINE_VERBOSITY_LOG, + _("video_out_fb: only packed truecolor/directcolor is supported (%d).\n" + " Check 'fbset -i' or try 'fbset -depth 16'.\n"), fix->visual); return 0; } @@ -765,7 +765,7 @@ static void register_callbacks(fb_driver_t *this) this->vo_driver.redraw_needed = fb_redraw_needed; } -static int open_fb_device(config_values_t *config) +static int open_fb_device(config_values_t *config, xine_t *xine) { static char devkey[] = "video.fb_device"; /* Why static? */ char *device_name; @@ -792,8 +792,8 @@ static int open_fb_device(config_values_t *config) if(fd < 0) { - fprintf(stderr, "video_out_fb: Unable to open device \"%s\", aborting: %s\n", - device_name, strerror(errno)); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: Unable to open device \"%s\", aborting: %s\n", device_name, strerror(errno)); return -1; } @@ -841,7 +841,7 @@ static int mode_visual(fb_driver_t *this, config_values_t *config, } } - fprintf(stderr, "video_out_fb: Your video mode was not recognized, sorry.\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_fb: Your video mode was not recognized, sorry.\n")); return 0; } @@ -898,31 +898,32 @@ static void setup_buffers(fb_driver_t *this, this->cur_frame = this->old_frame = 0; - printf("video_out_fb: %d video RAM buffers are available.\n", - this->total_num_native_buffers); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_fb: %d video RAM buffers are available.\n"), this->total_num_native_buffers); if(this->total_num_native_buffers < RECOMMENDED_NUM_BUFFERS) { this->use_zero_copy = 0; - printf("WARNING: video_out_fb: Zero copy buffers are DISABLED because only %d buffers\n" - " are available which is less than the recommended %d buffers. Lowering\n" - " the frame buffer resolution might help.\n", - this->total_num_native_buffers, - RECOMMENDED_NUM_BUFFERS); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("WARNING: video_out_fb: Zero copy buffers are DISABLED because only %d buffers\n" + " are available which is less than the recommended %d buffers. Lowering\n" + " the frame buffer resolution might help.\n"), + this->total_num_native_buffers, RECOMMENDED_NUM_BUFFERS); } else { /* test if FBIOPAN_DISPLAY works */ this->fb_var.yoffset = this->fb_var.yres; if(ioctl(this->fd, FBIOPAN_DISPLAY, &this->fb_var) == -1) { - printf("WARNING: video_out_fb: Zero copy buffers are DISABLED because kernel driver\n" - " do not support screen panning (used for frame flips).\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("WARNING: video_out_fb: Zero copy buffers are DISABLED because kernel driver\n" + " do not support screen panning (used for frame flips).\n")); } else { this->fb_var.yoffset = 0; ioctl(this->fd, FBIOPAN_DISPLAY, &this->fb_var); this->use_zero_copy = 1; - printf("video_out_fb: Using zero copy buffers.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: Using zero copy buffers.\n"); } } } @@ -943,24 +944,22 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, config = class->config; /* allocate plugin struct */ - this = malloc(sizeof(fb_driver_t)); + this = (fb_driver_t *) xine_xmalloc(sizeof(fb_driver_t)); if(!this) - { - fprintf(stderr, "video_out_fb: malloc failed\n"); - return 0; - } - memset(this, 0, sizeof(fb_driver_t)); + return NULL; register_callbacks(this); - this->fd = open_fb_device(config); + this->fd = open_fb_device(config, class->xine); if(this->fd == -1) goto error; - if(!get_fb_var_screeninfo(this->fd, &this->fb_var)) + if(!get_fb_var_screeninfo(this->fd, &this->fb_var, class->xine)) goto error; - if(!get_fb_fix_screeninfo(this->fd, &this->fb_fix)) + if(!get_fb_fix_screeninfo(this->fd, &this->fb_fix, class->xine)) goto error; + this->xine = class->xine; + if(this->fb_fix.line_length) this->fb_bytes_per_line = this->fb_fix.line_length; else @@ -986,17 +985,18 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, setup_buffers(this, &this->fb_var); if(this->depth > 16) - printf("WARNING: video_out_fb: current display depth is %d. For better performance\n" - " a depth of 16 bpp is recommended!\n\n", - this->depth); - - printf("video_out_fb: video mode depth is %d (%d bpp),\n" - " red: %d/%d, green: %d/%d, blue: %d/%d\n", - this->depth, this->bpp, - this->fb_var.red.length, this->fb_var.red.offset, - this->fb_var.green.length, this->fb_var.green.offset, - this->fb_var.blue.length, this->fb_var.blue.offset); - + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("WARNING: video_out_fb: current display depth is %d. For better performance\n" + " a depth of 16 bpp is recommended!\n\n"), this->depth); + + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_fb: video mode depth is %d (%d bpp),\n" + " red: %d/%d, green: %d/%d, blue: %d/%d\n", + this->depth, this->bpp, + this->fb_var.red.length, this->fb_var.red.offset, + this->fb_var.green.length, this->fb_var.green.offset, + this->fb_var.blue.length, this->fb_var.blue.offset); + if(!setup_yuv2rgb(this, config, &this->fb_var, &this->fb_fix)) goto error; @@ -1028,7 +1028,7 @@ static void fb_dispose_class(video_driver_class_t *this_gen) static void *fb_init_class(xine_t *xine, void *visual_gen) { - fb_class_t *this = (fb_class_t *)malloc(sizeof(fb_class_t)); + fb_class_t *this = (fb_class_t *)xine_xmalloc(sizeof(fb_class_t)); this->driver_class.open_plugin = fb_open_plugin; this->driver_class.get_identifier = fb_get_identifier; @@ -1036,6 +1036,7 @@ static void *fb_init_class(xine_t *xine, void *visual_gen) this->driver_class.dispose = fb_dispose_class; this->config = xine->config; + this->xine = xine; return this; } @@ -1051,22 +1052,8 @@ static vo_info_t vo_info_fb = }; /* exported plugin catalog entry */ -plugin_info_t xine_plugin_info[] = -{ +plugin_info_t xine_plugin_info[] = { /* type, API, "name", version, special_info, init_function */ - { - PLUGIN_VIDEO_OUT, - 18, - "fb", - XINE_VERSION_CODE, - &vo_info_fb, fb_init_class - }, - { - PLUGIN_NONE, - 0, - "", - 0, - NULL, - NULL - } + { PLUGIN_VIDEO_OUT, 18, "fb", XINE_VERSION_CODE, &vo_info_fb, fb_init_class }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_none.c b/src/video_out/video_out_none.c index e54ed411a..9b5609865 100644 --- a/src/video_out/video_out_none.c +++ b/src/video_out/video_out_none.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_none.c,v 1.18 2003/10/31 17:25:20 mroi Exp $ + * $Id: video_out_none.c,v 1.19 2003/12/05 15:55:03 f1rmb Exp $ * * Was originally part of toxine frontend. * ...but has now been adapted to xine coding style standards ;) @@ -47,17 +47,20 @@ typedef struct { int height; double ratio; int format; + xine_t *xine; } none_frame_t; typedef struct { vo_driver_t vo_driver; config_values_t *config; - int ratio; + int ratio; + xine_t *xine; } none_driver_t; typedef struct { video_driver_class_t driver_class; config_values_t *config; + xine_t *xine; } none_class_t; @@ -85,15 +88,12 @@ static uint32_t none_get_capabilities(vo_driver_t *vo_driver) { } static vo_frame_t *none_alloc_frame(vo_driver_t *vo_driver) { + /* none_driver_t *this = (none_driver_t *) vo_driver; */ none_frame_t *frame; - frame = (none_frame_t *) malloc(sizeof(none_frame_t)); - - if(frame == NULL) { - printf ("video_out_none: out of memory in none_alloc_frame\n"); - abort(); - } - memset(frame, 0, sizeof(none_frame_t)); + frame = (none_frame_t *) xine_xmalloc(sizeof(none_frame_t)); + if(!frame) + return NULL; frame->vo_frame.base[0] = NULL; frame->vo_frame.base[1] = NULL; @@ -111,7 +111,8 @@ static vo_frame_t *none_alloc_frame(vo_driver_t *vo_driver) { static void none_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) { - none_frame_t *frame = (none_frame_t *)vo_frame; + none_driver_t *this = (none_driver_t *) vo_driver; + none_frame_t *frame = (none_frame_t *) vo_frame; if((frame->width != width) || (frame->height != height) || (frame->format != format)) { @@ -148,7 +149,7 @@ static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_fram break; default: - printf ("video_out_none: unknown frame format %04x)\n", format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_none: unknown frame format %04x)\n", format); break; } @@ -158,7 +159,8 @@ static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_fram || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { - printf ("video_out_none: error. (framedata allocation failed: out of memory)\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_none: error. (framedata allocation failed: out of memory)\n"); free_framedata(frame); } } @@ -242,9 +244,10 @@ static vo_driver_t *open_plugin(video_driver_class_t *driver_class, const void * none_class_t *class = (none_class_t *) driver_class; none_driver_t *driver; - driver = (none_driver_t *) malloc(sizeof(none_driver_t)); + driver = (none_driver_t *) xine_xmalloc(sizeof(none_driver_t)); driver->config = class->config; + driver->xine = class->xine; driver->ratio = XINE_VO_ASPECT_AUTO; driver->vo_driver.get_capabilities = none_get_capabilities; @@ -284,7 +287,7 @@ static void dispose_class (video_driver_class_t *driver_class) { static void *init_class (xine_t *xine, void *visual) { none_class_t *this; - this = (none_class_t *) malloc(sizeof(none_class_t)); + this = (none_class_t *) xine_xmalloc(sizeof(none_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -292,6 +295,7 @@ static void *init_class (xine_t *xine, void *visual) { this->driver_class.dispose = dispose_class; this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index ffe00340d..be8be58ca 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.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_opengl.c,v 1.32 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: video_out_opengl.c,v 1.33 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_glut.c, glut based OpenGL rendering interface for xine * Matthias Hopf <mat@mshopf.de> @@ -172,11 +172,13 @@ typedef struct opengl_driver_s { uint8_t *yuv2rgb_cmap; yuv2rgb_factory_t *yuv2rgb_factory; + xine_t *xine; } opengl_driver_t; typedef struct { video_driver_class_t driver_class; config_values_t *config; + xine_t *xine; } opengl_class_t; @@ -271,14 +273,12 @@ static void opengl_frame_dispose (vo_frame_t *vo_img) { static vo_frame_t *opengl_alloc_frame (vo_driver_t *this_gen) { opengl_frame_t *frame ; - opengl_driver_t *this = (opengl_driver_t *) this_gen; + opengl_driver_t *this = (opengl_driver_t *) this_gen; DEBUGF ((stderr, "*** alloc_frame ***\n")); - frame = (opengl_frame_t *) calloc (1, sizeof (opengl_frame_t)); - if (frame==NULL) { - printf ("opengl_alloc_frame: out of memory\n"); - return NULL; - } + frame = (opengl_frame_t *) xine_xmalloc (sizeof (opengl_frame_t)); + if (!frame) + return NULL; pthread_mutex_init (&frame->vo_frame.mutex, NULL); @@ -355,7 +355,8 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[0] * height, (void **) &frame->chunk[0]); break; default: - fprintf (stderr, "video_out_opengl: image format %d not supported, update video driver!\n", format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: image format %d not supported, update video driver!\n", format); return; } @@ -503,7 +504,8 @@ static void opengl_render_image (opengl_driver_t *this, opengl_frame_t *frame, /* already initialized? */ if (! this->drawable || ! this->vinfo) { - fprintf (stderr, "video_out_opengl: early exit due to missing drawable %lx vinfo %p\n", this->drawable, this->vinfo); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: early exit due to missing drawable %lx vinfo %p\n", this->drawable, this->vinfo); return; } @@ -586,7 +588,9 @@ static void opengl_render_image (opengl_driver_t *this, opengl_frame_t *frame, * Set and initialize context */ if (! glXMakeCurrent (this->display, this->drawable, ctx)) { - fprintf (stderr, "video_out_opengl: no OpenGL support available (glXMakeCurrent)\n The drawable does not seem to be updated correctly.\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: no OpenGL support available (glXMakeCurrent)\n" + " The drawable does not seem to be updated correctly.\n"); abort(); } DEBUGF ((stderr, "set context done\n")); @@ -754,8 +758,8 @@ static int opengl_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; default: - printf ("video_out_opengl: tried to get unsupported property %d\n", - property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: tried to get unsupported property %d\n", property); } return 0; @@ -773,7 +777,7 @@ static int opengl_set_property (vo_driver_t *this_gen, if (value >= XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - fprintf (stderr, "video_out_opengl: aspect ratio changed to %s\n", + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_opengl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name (value)); opengl_compute_ideal_size (this); // opengl_redraw_needed ((vo_driver_t *) this); @@ -781,10 +785,11 @@ static int opengl_set_property (vo_driver_t *this_gen, case VO_PROP_BRIGHTNESS: this->yuv2rgb_gamma = value; this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, value, 128, 128); - printf("video_out_opengl: gamma changed to %d\n",value); + xrintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_opengl: gamma changed to %d\n",value); break; default: - printf ("video_out_opengl: tried to set unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: tried to set unsupported property %d\n", property); } return value; @@ -823,7 +828,8 @@ static int opengl_gui_data_exchange (vo_driver_t *this_gen, this->vinfo = glXChooseVisual (this->display, this->screen, glxAttrib); XUnlockDisplay (this->display); if (this->vinfo == NULL) - fprintf (stderr, "video_out_opengl: no OpenGL support available (glXChooseVisual)\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_opengl: no OpenGL support available (glXChooseVisual)\n"); *(XVisualInfo**)data = this->vinfo; DEBUGF ((stderr, "*** visual %p depth %d\n", this->vinfo->visual, this->vinfo->depth)); break; @@ -913,7 +919,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, opengl_driver_t *this; - fprintf (stderr, "EXPERIMENTAL opengl output plugin TNG\n"); + xprintf (class->xine, XINE_VERBOSITY_DEBUG, "EXPERIMENTAL opengl output plugin TNG\n"); /* * allocate plugin struct @@ -922,6 +928,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, XINE_ASSERT (this, "OpenGL driver struct is not defined"); this->config = class->config; + this->xine = class->xine; this->display = visual->display; this->screen = visual->screen; @@ -980,7 +987,7 @@ static void opengl_dispose_class (video_driver_class_t *this) { static void *opengl_init_class (xine_t *xine, void *visual_gen) { - opengl_class_t *this = (opengl_class_t *) malloc (sizeof (opengl_class_t)); + opengl_class_t *this = (opengl_class_t *) xine_xmalloc (sizeof (opengl_class_t)); this->driver_class.open_plugin = opengl_open_plugin; this->driver_class.get_identifier = opengl_get_identifier; @@ -988,6 +995,7 @@ static void *opengl_init_class (xine_t *xine, void *visual_gen) { this->driver_class.dispose = opengl_dispose_class; this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c index 6c4edaa35..94be4fdc9 100644 --- a/src/video_out/video_out_pgx64.c +++ b/src/video_out/video_out_pgx64.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_pgx64.c,v 1.45 2003/11/11 18:45:00 f1rmb Exp $ + * $Id: video_out_pgx64.c,v 1.46 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_pgx64.c, Sun PGX64/PGX24 output plugin for xine * @@ -316,15 +316,12 @@ static uint32_t pgx64_get_capabilities(vo_driver_t *this_gen) static vo_frame_t* pgx64_alloc_frame(vo_driver_t *this_gen) { - /*pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen;*/ + pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen; pgx64_frame_t *frame; - frame = malloc(sizeof(pgx64_frame_t)); - if (!frame) { - printf("video_out_pgx64: Error: frame malloc failed\n"); + frame = (pgx64_frame_t *) xine_xmalloc(sizeof(pgx64_frame_t)); + if (!frame) return NULL; - } - memset(frame, 0, sizeof(pgx64_frame_t)); pthread_mutex_init(&frame->vo_frame.mutex, NULL); @@ -338,7 +335,7 @@ static vo_frame_t* pgx64_alloc_frame(vo_driver_t *this_gen) static void pgx64_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, double ratio, int format, int flags) { - /*pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen;*/ + pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen; pgx64_frame_t *frame = (pgx64_frame_t *)frame_gen; if ((width != frame->width) || @@ -388,7 +385,7 @@ static void pgx64_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_g for (i=0; i<frame->planes; i++) { if (!frame->vo_frame.base[i]) { - printf("video_out_pgx64: frame plane malloc failed\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx64: frame plane malloc failed\n"); abort(); } } @@ -475,7 +472,8 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) return; } else { - printf("video_out_pgx64: Warning: low video memory, multi-buffering disabled\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Warning: low video memory, multi-buffering disabled\n"); vram_reset(this); this->buf_mode = BUF_MODE_NONE; break; @@ -502,7 +500,7 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) if (this->buf_mode == BUF_MODE_NONE) { for (i=0; i<frame->planes; i++) { if ((this->buffers[0][i] = vram_alloc(this, frame->lengths[i])) < 0) { - printf("video_out_pgx64: Error: insuffucient video memory\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx64: Error: insuffucient video memory\n"); return; } else { @@ -521,7 +519,8 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) } if (this->buf_mode == BUF_MODE_SINGLE) { - printf("video_out_pgx64: Warning: low video memory, double-buffering disabled\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_pgx64: Warning: low video memory, double-buffering disabled\n")); for (i=0; i<frame->planes; i++) { this->buffers[1][i] = this->buffers[0][i]; this->buffer_ptrs[1][i] = this->vram + this->buffers[1][i]; @@ -639,7 +638,7 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen ovl = (pgx64_overlay_t *)malloc(sizeof(pgx64_overlay_t)); if (!ovl) { - printf("video_out_pgx64: overlay malloc failed\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx64: overlay malloc failed\n"); return; } ovl->x = scale_down(overlay->x * x_scale); @@ -732,7 +731,8 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen } } if (y < overlay->height) { - printf("video_out_pgx64: Notice: RLE data doesn't extend to height of overlay\n"); + xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Notice: RLE data doesn't extend to height of overlay\n"); XFillRectangle(this->display, ovl->p, this->gc, scale_down(x * x_scale), scale_down(y * y_scale), ovl->width, scale_down(overlay->height * y_scale) - scale_down(y * y_scale)); } XUnlockDisplay(this->display); @@ -937,7 +937,8 @@ static void set_overlay_mode(pgx64_driver_t* this, int ovl_mode) if ((XGetRGBColormaps(this->display, RootWindow(this->display, this->screen), &this->stdcolmap, &this->stdcolmap_size, XA_RGB_BEST_MAP) == 0) || (this->stdcolmap->red_max == 0) || (!this->stdcolmap->colormap)) { - printf("video_out_pgx64: Warning: RGB_BEST_MAP property not set or malformed. Run xstdcmap(1).\n"); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, + _("video_out_pgx64: Warning: RGB_BEST_MAP property not set or malformed. Run xstdcmap(1).\n")); if (this->stdcolmap) { XFree(this->stdcolmap); this->stdcolmap = NULL; @@ -1020,34 +1021,35 @@ static vo_driver_t* pgx64_init_driver(video_driver_class_t *class_gen, const voi devname = class->config->register_string(class->config, "video.pgx64_device", "/dev/fb", "name of pgx64 device", NULL, 10, NULL, NULL); if ((fbfd = open(devname, O_RDWR)) < 0) { - printf("video_out_pgx64: Error: can't open framebuffer device '%s'\n", devname); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Error: can't open framebuffer device '%s'\n", devname); return NULL; } if (ioctl(fbfd, FBIOGATTR, &attr) < 0) { - printf("video_out_pgx64: Error: ioctl failed, unable to determine framebuffer characteristics\n"); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Error: ioctl failed, unable to determine framebuffer characteristics\n"); close(fbfd); return NULL; } if (attr.real_type != 22) { - printf("video_out_pgx64: Error: '%s' is not a mach64 framebuffer device\n", devname); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Error: '%s' is not a mach64 framebuffer device\n", devname); close(fbfd); return NULL; } if ((baseaddr = mmap(0, FB_ADDRSPACE, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0)) == MAP_FAILED) { - printf("video_out_pgx64: Error: unable to memory map framebuffer\n"); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_pgx64: Error: unable to memory map framebuffer\n"); close(fbfd); return NULL; } - this = (pgx64_driver_t*)malloc(sizeof(pgx64_driver_t)); - if (!this) { - printf("video_out_pgx64: Error: driver malloc failed\n"); + this = (pgx64_driver_t*)xine_xmalloc(sizeof(pgx64_driver_t)); + if (!this) return NULL; - } - memset(this, 0, sizeof(pgx64_driver_t)); this->vo_driver.get_capabilities = pgx64_get_capabilities; this->vo_driver.alloc_frame = pgx64_alloc_frame; @@ -1116,12 +1118,9 @@ static void* pgx64_init_class(xine_t *xine, void *visual_gen) { pgx64_driver_class_t *class; - class = (pgx64_driver_class_t*)malloc(sizeof(pgx64_driver_class_t)); - if (!class) { - printf("video_out_pgx64: Error: driver class malloc failed\n"); + class = (pgx64_driver_class_t*)xine_xmalloc(sizeof(pgx64_driver_class_t)); + if (!class) return NULL; - } - memset(class, 0, sizeof(pgx64_driver_class_t)); class->vo_driver_class.open_plugin = pgx64_init_driver; class->vo_driver_class.get_identifier = pgx64_get_identifier; diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c index 516e8af56..31ee6f512 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.33 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: video_out_sdl.c,v 1.34 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_sdl.c, Simple DirectMedia Layer * @@ -102,12 +102,13 @@ struct sdl_driver_s { #endif vo_scale_t sc; - + xine_t *xine; }; typedef struct { video_driver_class_t driver_class; config_values_t *config; + xine_t *xine; } sdl_class_t; static uint32_t sdl_get_capabilities (vo_driver_t *this_gen) { @@ -132,17 +133,14 @@ static void sdl_frame_dispose (vo_frame_t *vo_img) { } static vo_frame_t *sdl_alloc_frame (vo_driver_t *this_gen) { - + /* sdl_driver_t *this = (sdl_driver_t *) this_gen; */ sdl_frame_t *frame ; - frame = (sdl_frame_t *) malloc (sizeof (sdl_frame_t)); + frame = (sdl_frame_t *) xine_xmalloc (sizeof (sdl_frame_t)); - if (frame==NULL) { - printf ("sdl_alloc_frame: out of memory\n"); + if (!frame) return NULL; - } - memset (frame, 0, sizeof(sdl_frame_t)); - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -318,7 +316,7 @@ static void sdl_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) ) { - printf("video_out_sdl: change frame format\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: change frame format\n"); this->sc.delivered_width = frame->width; this->sc.delivered_height = frame->height; @@ -372,8 +370,8 @@ static int sdl_set_property (vo_driver_t *this_gen, if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - printf("video_out_sdl: aspect ratio changed to %s\n", - _x_vo_scale_aspect_ratio_name(value)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_sdl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); sdl_compute_ideal_size (this); this->sc.force_redraw = 1; @@ -462,20 +460,16 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XWindowAttributes window_attributes; #endif - this = malloc (sizeof (sdl_driver_t)); - - if (!this) { - printf ("video_out_sdl: open_plugin - malloc failed\n"); + this = (sdl_driver_t *) xine_xmalloc (sizeof (sdl_driver_t)); + if (this) return NULL; - } - - memset (this, 0, sizeof(sdl_driver_t)); this->sdlflags = SDL_HWSURFACE | SDL_RESIZABLE; xine_setenv("SDL_VIDEO_YUV_HWACCEL", "1", 1); xine_setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 1); + this->xine = class->xine; #ifdef HAVE_X11 this->display = visual->display; this->screen = visual->screen; @@ -492,9 +486,8 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi _x_vo_scale_init( &this->sc, 0, 0, config ); #endif - if ((SDL_Init (SDL_INIT_VIDEO)) < 0) { - printf ("video_out_sdl: open_plugin - sdl video initialization failed.\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: open_plugin - sdl video initialization failed.\n"); return NULL; } @@ -502,15 +495,16 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if (!SDL_ListModes (vidInfo->vfmt, SDL_HWSURFACE | SDL_RESIZABLE)) { this->sdlflags = SDL_RESIZABLE; if (!SDL_ListModes (vidInfo->vfmt, SDL_RESIZABLE)) { - printf ("video_out_sdl: open_plugin - sdl couldn't get any acceptable video mode\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_sdl: open_plugin - sdl couldn't get any acceptable video mode\n"); return NULL; } } this->bpp = vidInfo->vfmt->BitsPerPixel; if (this->bpp < 16) { - fprintf(stderr, "sdl has to emulate a 16 bit surfaces, " - "that will slow things down.\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("sdl has to emulate a 16 bit surfaces, that will slow things down.\n")); this->bpp = 16; } @@ -545,8 +539,8 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->vo_driver.dispose = sdl_dispose; this->vo_driver.redraw_needed = sdl_redraw_needed; - printf ("video_out_sdl: warning, xine's SDL driver is EXPERIMENTAL\n"); - printf ("video_out_sdl: fullscreen mode is NOT supported\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: warning, xine's SDL driver is EXPERIMENTAL\n"); + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_sdl: fullscreen mode is NOT supported\n")); return &this->vo_driver; } /** @@ -571,19 +565,21 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* check if we have SDL */ if ((SDL_Init (SDL_INIT_VIDEO)) < 0) { - printf ("video_out_sdl: open_plugin - sdl video initialization failed.\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, + "video_out_sdl: open_plugin - sdl video initialization failed.\n"); return NULL; } SDL_QuitSubSystem (SDL_INIT_VIDEO); - this = (sdl_class_t*) malloc (sizeof (sdl_class_t)); + this = (sdl_class_t*) xine_xmalloc (sizeof (sdl_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; this->driver_class.get_description = get_description; this->driver_class.dispose = dispose_class; - this->config = xine->config; + this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/video_out/video_out_stk.c b/src/video_out/video_out_stk.c index 0b92b6a0d..2e04708a5 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.10 2003/11/26 19:43:37 f1rmb Exp $ + * $Id: video_out_stk.c,v 1.11 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_stk.c, Libstk Surface Video Driver * more info on Libstk at http://www.libstk.org @@ -92,12 +92,14 @@ typedef struct stk_driver_s { pthread_mutex_t mutex; uint32_t capabilities; vo_scale_t sc; + xine_t *xine; } stk_driver_t; typedef struct { - video_driver_class_t driver_class; - config_values_t* config; + video_driver_class_t driver_class; + config_values_t* config; + xine_t *xine; } stk_class_t; static uint32_t stk_get_capabilities (vo_driver_t *this_gen) { @@ -127,15 +129,14 @@ static void stk_frame_dispose (vo_frame_t *vo_img) { } static vo_frame_t *stk_alloc_frame(vo_driver_t *this_gen) { + stk_driver_t* this = (stk_driver_t*)this_gen; /* allocate the frame */ stk_frame_t* frame; + //printf("video_out_stk: alloc_frame()\n"); - frame = (stk_frame_t *)malloc(sizeof(stk_frame_t)); - if (frame == NULL) { - printf("stk_alloc_frame: out of memory\n"); - return NULL; - } - memset(frame, 0, sizeof(stk_frame_t)); + frame = (stk_frame_t *) xine_xmalloc(sizeof(stk_frame_t)); + if (!frame) + return NULL; /* populate the frame members*/ pthread_mutex_init (&frame->vo_frame.mutex, NULL); @@ -275,7 +276,7 @@ static void stk_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) ) { - printf("video_out_stk: change frame format\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_stk: change frame format\n"); this->sc.delivered_width = frame->width; this->sc.delivered_height = frame->height; @@ -322,7 +323,8 @@ static int stk_set_property (vo_driver_t* this_gen, int property, int value) { if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - printf("video_out_stk: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_stk: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); stk_compute_ideal_size (this); this->sc.force_redraw = 1; @@ -375,25 +377,24 @@ static void stk_dispose (vo_driver_t * this_gen) { } static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *visual_gen) { + stk_class_t * class = (stk_class_t *) class_gen; /* allocate the video output driver class */ stk_driver_t* this; //printf("video_out_stk: open_plugin()\n"); - this = malloc (sizeof (stk_driver_t)); - if (!this) { - printf ("video_out_stk: open_plugin - malloc failed\n"); - return NULL; - } - memset (this, 0, sizeof(stk_driver_t)); + this = (stk_driver_t *) xine_xmalloc (sizeof (stk_driver_t)); + if (!this) + return NULL; /* populate the video output driver members */ - this->config = ((stk_class_t*)class_gen)->config; + this->config = class->config; + this->xine = class->xine; this->xine_panel = (xine_panel_t*)visual_gen; - this->surface = stk_xine_panel_surface(this->xine_panel); + this->surface = stk_xine_panel_surface(this->xine_panel); /* FIXME: provide a way to get bpp from stk surfaces */ /* this->bpp = stk_surface_bpp(this->surface); */ - this->bpp = 32; + this->bpp = 32; pthread_mutex_init(&this->mutex, NULL); /* FIXME: provide a way to get YUV formats from stk surfaces */ /* this->capabilities = stk_surface_formats(this->surface); */ @@ -424,7 +425,8 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis xine_setenv("SDL_VIDEO_YUV_HWACCEL", "1", 1); xine_setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 1); - printf ("video_out_stk: warning, xine's STK driver is EXPERIMENTAL\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_stk: warning, xine's STK driver is EXPERIMENTAL\n"); return &this->vo_driver; } @@ -453,7 +455,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { //printf("video_out_stk: init_class()\n"); - this = (stk_class_t*)malloc(sizeof(stk_class_t)); + this = (stk_class_t *) xine_xmalloc(sizeof(stk_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -461,6 +463,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->driver_class.dispose = dispose_class; this->config = xine->config; + this->xine = xine; return this; } diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index 4aa89fa69..9e2c1bee6 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.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_syncfb.c,v 1.93 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: video_out_syncfb.c,v 1.94 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine * @@ -90,7 +90,6 @@ struct syncfb_driver_s { GC gc; XColor black; - vo_scale_t sc; int virtual_screen_width; @@ -115,16 +114,17 @@ struct syncfb_driver_s { syncfb_buffer_info_t bufinfo; syncfb_param_t params; - int video_win_visibility; + int video_win_visibility; + xine_t *xine; }; typedef struct { - video_driver_class_t driver_class; - - config_values_t *config; + video_driver_class_t driver_class; - char *device_name; + config_values_t *config; + char *device_name; + xine_t *xine; } syncfb_class_t; /* @@ -135,7 +135,8 @@ typedef struct { static int syncfb_overlay_on(syncfb_driver_t* this) { if(ioctl(this->fd, SYNCFB_ON)) { - printf("video_out_syncfb: error. (on ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (on ioctl failed)\n"); return 0; } else { this->overlay_state = 1; @@ -147,7 +148,8 @@ static int syncfb_overlay_on(syncfb_driver_t* this) static int syncfb_overlay_off(syncfb_driver_t* this) { if(ioctl(this->fd, SYNCFB_OFF)) { - printf("video_out_syncfb: error. (off ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (off ioctl failed)\n"); return 0; } else { this->overlay_state = 0; @@ -275,7 +277,8 @@ static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) write_frame_YUY2(this, frame); else - printf("video_out_syncfb: error. (YUY2 not supported by your graphic card)\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_syncfb: error. (YUY2 not supported by your graphic card)\n")); break; case XINE_IMGFMT_YV12: @@ -290,12 +293,13 @@ static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) write_frame_YUV420P3(this, frame); break; default: - printf("video_out_syncfb: error. (YV12 not supported by your graphic card)\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_syncfb: error. (YV12 not supported by your graphic card)\n")); } break; default: - printf("video_out_syncfb: error. (unknown frame format)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (unknown frame format)\n"); break; } @@ -378,7 +382,8 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) this->cur_frame->format > 0 && this->video_win_visibility) { if(ioctl(this->fd, SYNCFB_GET_CONFIG, &this->syncfb_config)) - printf("video_out_syncfb: error. (get_config ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (get_config ioctl failed)\n"); this->syncfb_config.syncfb_mode = SYNCFB_FEATURE_SCALE | SYNCFB_FEATURE_CROP; @@ -393,7 +398,8 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) this->syncfb_config.src_palette = VIDEO_PALETTE_YUV422; break; default: - printf("video_out_syncfb: error. (unknown frame format)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (unknown frame format)\n"); this->syncfb_config.src_palette = 0; break; } @@ -417,7 +423,7 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) if(this->capabilities.palettes & (1<<this->syncfb_config.src_palette)) { if(ioctl(this->fd,SYNCFB_SET_CONFIG,&this->syncfb_config)) - printf("video_out_syncfb: error. (set_config ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (set_config ioctl failed)\n"); syncfb_overlay_on(this); } @@ -470,30 +476,29 @@ static void syncfb_frame_dispose(vo_frame_t* vo_img) static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) { - syncfb_frame_t* frame; + /* syncfb_driver_t *this = (syncfb_driver_t *) this_gen; */ + syncfb_frame_t *frame; frame = (syncfb_frame_t *) xine_xmalloc(sizeof(syncfb_frame_t)); - - if(frame == NULL) - printf("video_out_syncfb: error. (frame allocation failed: out of memory)\n"); - else { - pthread_mutex_init(&frame->vo_frame.mutex, NULL); - - frame->vo_frame.base[0] = NULL; - frame->vo_frame.base[1] = NULL; - frame->vo_frame.base[2] = NULL; - - /* - * supply required functions - */ - frame->vo_frame.proc_slice = NULL; - frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = syncfb_frame_field; - frame->vo_frame.dispose = syncfb_frame_dispose; - - frame->vo_frame.driver = this_gen; - } - + if(!frame) + return NULL; + + pthread_mutex_init(&frame->vo_frame.mutex, NULL); + + frame->vo_frame.base[0] = NULL; + frame->vo_frame.base[1] = NULL; + frame->vo_frame.base[2] = NULL; + + /* + * supply required functions + */ + frame->vo_frame.proc_slice = NULL; + frame->vo_frame.proc_frame = NULL; + frame->vo_frame.field = syncfb_frame_field; + frame->vo_frame.dispose = syncfb_frame_dispose; + + frame->vo_frame.driver = this_gen; + return (vo_frame_t *) frame; } @@ -502,7 +507,8 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, uint32_t width, uint32_t height, double ratio, int format, int flags) { - syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; + syncfb_driver_t *this = (syncfb_driver_t *) this_gen; + syncfb_frame_t *frame = (syncfb_frame_t *) frame_gen; /* uint32_t frame_size = width*height; */ if((frame->width != width) @@ -538,14 +544,17 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, frame->vo_frame.base[2] = NULL; break; default: - printf("video_out_syncfb: error. (unable to allocate framedata because of unknown frame format: %04x)\n", format); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (unable to allocate " + "framedata because of unknown frame format: %04x)\n", format); } /* if((format == IMGFMT_YV12 && (frame->data_mem[0] == NULL || frame->data_mem[1] == NULL || frame->data_mem[2] == NULL)) || (format == IMGFMT_YUY2 && frame->data_mem[0] == NULL)) {*/ if((format == XINE_IMGFMT_YV12 && (frame->vo_frame.base[0] == NULL || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { - printf("video_out_syncfb: error. (framedata allocation failed: out of memory)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (framedata allocation failed: out of memory)\n"); free_framedata(frame); } @@ -603,17 +612,19 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) /* the rest is only successful and safe, if the overlay is really on */ if(this->overlay_state) { if(this->bufinfo.id != -1) { - printf("video_out_syncfb: error. (invalid syncfb image buffer state)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (invalid syncfb image buffer state)\n"); frame->vo_frame.free(&frame->vo_frame); return; } if(ioctl(this->fd, SYNCFB_REQUEST_BUFFER, &this->bufinfo)) - printf("video_out_syncfb: error. (request ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (request ioctl failed)\n"); if(this->bufinfo.id == -1) { - printf("video_out_syncfb: error. (syncfb module couldn't allocate image buffer)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (syncfb module couldn't allocate image buffer)\n"); frame->vo_frame.free(&frame->vo_frame); /* @@ -632,7 +643,7 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) write_frame_sfb(this, frame); if(ioctl(this->fd, SYNCFB_COMMIT_BUFFER, &this->bufinfo)) - printf("video_out_syncfb: error. (commit ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (commit ioctl failed)\n"); } else frame->vo_frame.free(&frame->vo_frame); @@ -735,7 +746,8 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) this->params.image_yorg = this->syncfb_config.image_yorg; if(ioctl(this->fd,SYNCFB_SET_PARAMS,&this->params)) - printf("video_out_syncfb: error. (setting of contrast value failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (setting of contrast value failed)\n"); break; @@ -755,7 +767,8 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) this->params.image_yorg = this->syncfb_config.image_yorg; if(ioctl(this->fd,SYNCFB_SET_PARAMS,&this->params)) - printf("video_out_syncfb: error. (setting of brightness value failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: error. (setting of brightness value failed)\n"); break; } @@ -843,21 +856,23 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi display = visual->display; - if(!(this = xine_xmalloc(sizeof (syncfb_driver_t)))) { - printf("video_out_syncfb: aborting. (allocation of syncfb_driver_t failed: out of memory)\n"); - return NULL; - } + if(!(this = xine_xmalloc(sizeof (syncfb_driver_t)))) + return NULL; /* check for syncfb device */ if((this->fd = open(class->device_name, O_RDWR)) < 0) { - printf("video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", class->device_name); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", class->device_name); free(this); return NULL; } + this->xine = class->xine; + /* get capabilities from the syncfb module */ if(ioctl(this->fd, SYNCFB_GET_CAPS, &this->capabilities)) { - printf("video_out_syncfb: aborting. (syncfb_get_caps ioctl failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: aborting. (syncfb_get_caps ioctl failed)\n"); close(this->fd); free(this); @@ -869,7 +884,8 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->video_mem = (uint8_t *) mmap(0, this->capabilities.memory_size, PROT_WRITE, MAP_SHARED, this->fd, 0); if(this->video_mem == MAP_FAILED) { - printf("video_out_syncfb: aborting. (mmap of video memory failed)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: aborting. (mmap of video memory failed)\n"); close(this->fd); free(this); @@ -902,30 +918,36 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV420P3)) { this->supported_capabilities |= VO_CAP_YV12; this->yuv_format = VIDEO_PALETTE_YUV420P3; - printf("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (3 plane))\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (3 plane))\n")); } else if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV420P2)) { this->supported_capabilities |= VO_CAP_YV12; this->yuv_format = VIDEO_PALETTE_YUV420P2; - printf("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (2 plane))\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (2 plane))\n")); } else if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) { this->supported_capabilities |= VO_CAP_YV12; this->yuv_format = VIDEO_PALETTE_YUV422; - printf("video_out_syncfb: info. (SyncFB module supports YUV 4:2:2)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:2)\n")); } if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) { this->supported_capabilities |= VO_CAP_YUY2; - printf("video_out_syncfb: info. (SyncFB module supports YUY2)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + _("video_out_syncfb: info. (SyncFB module supports YUY2)\n")); } if(this->capabilities.palettes & (1<<VIDEO_PALETTE_RGB565)) { /* FIXME: no RGB support yet * this->supported_capabilities |= VO_CAP_RGB; */ - printf("video_out_syncfb: info. (SyncFB module supports RGB565)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + _("video_out_syncfb: info. (SyncFB module supports RGB565)\n")); } if(!this->supported_capabilities) { - printf("video_out_syncfb: aborting. (SyncFB module does not support YV12, YUY2 nor RGB565)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + _("video_out_syncfb: aborting. (SyncFB module does not support YV12, YUY2 nor RGB565)\n")); munmap(0, this->capabilities.memory_size); close(this->fd); @@ -943,7 +965,10 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->props[VO_PROP_BRIGHTNESS].min = -128; this->props[VO_PROP_BRIGHTNESS].max = 127; } else { - printf("video_out_syncfb: info. (brightness/contrast control won\'t be available because your SyncFB kernel module seems to be outdated. Please refer to README.syncfb for informations on how to update it.)\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_syncfb: info. (brightness/contrast control won\'t be available because " + "your SyncFB kernel module seems to be outdated. Please refer to README." + "syncfb for informations on how to update it.)\n")); } /* check for virtual screen size and screen depth - this is rather important @@ -1033,7 +1058,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* check for syncfb device */ if((fd = open(device_name, O_RDWR)) < 0) { - printf("video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", device_name); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", device_name); return NULL; } close(fd); @@ -1041,7 +1067,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* * from this point on, nothing should go wrong anymore */ - this = (syncfb_class_t *) malloc (sizeof (syncfb_class_t)); + this = (syncfb_class_t *) xine_xmalloc (sizeof (syncfb_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -1049,6 +1075,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->driver_class.dispose = dispose_class; this->config = xine->config; + this->xine = xine; this->device_name = device_name; return this; diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 1531dcb4d..daa51fdd7 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.55 2003/11/26 23:44:10 f1rmb Exp $ + * $Id: video_out_vidix.c,v 1.56 2003/12/05 15:55:03 f1rmb Exp $ * * video_out_vidix.c * @@ -301,7 +301,8 @@ static void write_frame_sfb(vidix_driver_t* this, vidix_frame_t* frame) break; default: - printf("video_out_vidix: error. (unknown frame format %04x)\n", frame->format); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: error. (unknown frame format %04x)\n", frame->format); break; } } @@ -390,16 +391,12 @@ static void vidix_frame_dispose (vo_frame_t *vo_img) { } static vo_frame_t *vidix_alloc_frame (vo_driver_t *this_gen) { + /* vidix_driver_t *this = (vidix_driver_t *) this_gen; */ + vidix_frame_t *frame ; - vidix_frame_t *frame ; - - frame = (vidix_frame_t *) malloc (sizeof (vidix_frame_t)); - - if (frame==NULL) { - printf ("vidix_alloc_frame: out of memory\n"); + frame = (vidix_frame_t *) xine_xmalloc (sizeof (vidix_frame_t)); + if (!frame) return NULL; - } - memset (frame, 0, sizeof(vidix_frame_t)); pthread_mutex_init (&frame->vo_frame.mutex, NULL); @@ -464,7 +461,8 @@ static void vidix_config_playback (vidix_driver_t *this) { if((err=vdlConfigPlayback(this->vidix_handler,&this->vidix_play))!=0) { - printf("video_out_vidix: Can't configure playback: %s\n",strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: Can't configure playback: %s\n",strerror(err)); this->vidix_started = -1; return; } @@ -516,8 +514,8 @@ static void vidix_config_playback (vidix_driver_t *this) { this->dstrides.y = (this->sc.delivered_width*2 + apitch) & ~apitch; break; default: - printf("video_out_vidix: error. (unknown frame format: %04x)\n", - this->delivered_format); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: error. (unknown frame format: %04x)\n", this->delivered_format); } lprintf("video_out_vidix: overlay on\n"); @@ -529,7 +527,7 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, double ratio, int format, int flags) { - + vidix_driver_t *this = (vidix_driver_t *) this_gen; vidix_frame_t *frame = (vidix_frame_t *) frame_gen; if ((frame->width != width) @@ -562,12 +560,14 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, frame->vo_frame.base[2] = NULL; break; default: - printf("video_out_vidix: error. (unknown frame format: %04x)\n", format); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: error. (unknown frame format: %04x)\n", format); } if((format == XINE_IMGFMT_YV12 && (frame->vo_frame.base[0] == NULL || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { - printf("video_out_vidix: error. (framedata allocation failed: out of memory)\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: error. (framedata allocation failed: out of memory)\n"); free_framedata(frame); } @@ -755,7 +755,7 @@ static int vidix_set_property (vo_driver_t *this_gen, this->vidix_eq.hue = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set hue: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set hue: %s\n", strerror(err)); } if ( property == VO_PROP_SATURATION ) { @@ -763,7 +763,7 @@ static int vidix_set_property (vo_driver_t *this_gen, this->vidix_eq.saturation = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set saturation: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set saturation: %s\n", strerror(err)); } if ( property == VO_PROP_BRIGHTNESS ) { @@ -771,7 +771,7 @@ static int vidix_set_property (vo_driver_t *this_gen, this->vidix_eq.brightness = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set brightness: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set brightness: %s\n", strerror(err)); } if ( property == VO_PROP_CONTRAST ) { @@ -779,7 +779,7 @@ static int vidix_set_property (vo_driver_t *this_gen, this->vidix_eq.contrast = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set contrast: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set contrast: %s\n", strerror(err)); } } @@ -832,7 +832,7 @@ static void vidix_rgb_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) { } if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq))) - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); } @@ -935,13 +935,9 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { vidix_driver_t *this; int err; - this = malloc (sizeof (vidix_driver_t)); - - if (!this) { - printf ("video_out_vidix: malloc failed\n"); + this = (vidix_driver_t *) xine_xmalloc (sizeof (vidix_driver_t)); + if (!this) return NULL; - } - memset (this, 0, sizeof(vidix_driver_t)); pthread_mutex_init (&this->mutex, NULL); @@ -959,7 +955,7 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { /* Find what equalizer flags are supported */ if(this->vidix_cap.flags & FLAG_EQUALIZER) { if((err = vdlPlaybackGetEq(this->vidix_handler, &this->vidix_eq)) != 0) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: couldn't get equalizer capabilities: %s\n", strerror(err)); } else { if(this->vidix_eq.cap & VEQ_CAP_BRIGHTNESS) { @@ -1003,7 +999,7 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { (void*) vidix_rgb_callback, this); if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq))) - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); } } @@ -1055,7 +1051,8 @@ static void query_fourccs (vidix_driver_t *this) { if((err = vdlQueryFourcc(this->vidix_handler, &vidix_fourcc)) == 0) { this->capabilities |= VO_CAP_YUY2; - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: adaptor supports the yuy2 format\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_vidix: adaptor supports the yuy2 format\n")); } /* Detect if YV12 is supported - we always support yv12 but we need @@ -1065,7 +1062,8 @@ static void query_fourccs (vidix_driver_t *this) { if((err = vdlQueryFourcc(this->vidix_handler, &vidix_fourcc)) == 0) { this->supports_yv12 = 1; - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: adaptor supports the yv12 format\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_vidix: adaptor supports the yv12 format\n")); } else this->supports_yv12 = 0; } @@ -1074,37 +1072,35 @@ static void *init_class (xine_t *xine, void *visual_gen) { vidix_class_t *this; int err; - this = malloc (sizeof (vidix_class_t)); - - if (!this) { - printf ("video_out_vidix: malloc failed\n"); + this = (vidix_class_t *) xine_xmalloc (sizeof (vidix_class_t)); + if (!this) return NULL; - } - memset (this, 0, sizeof(vidix_class_t)); - if(vdlGetVersion() != VIDIX_VERSION) { - printf("video_out_vidix: You have wrong version of VIDIX library\n"); + xprintf(xine, XINE_VERBOSITY_LOG, + _("video_out_vidix: You have wrong version of VIDIX library\n")); free(this); return NULL; } this->vidix_handler = vdlOpen((XINE_PLUGINDIR"/vidix/"), NULL, TYPE_OUTPUT, 0); if(this->vidix_handler == NULL) { - printf("video_out_vidix: Couldn't find working VIDIX driver\n"); + xprintf(xine, XINE_VERBOSITY_LOG, + _("video_out_vidix: Couldn't find working VIDIX driver\n")); free(this); return NULL; } if((err=vdlGetCapability(this->vidix_handler,&this->vidix_cap)) != 0) { - printf("video_out_vidix: Couldn't get capability: %s\n",strerror(err)); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: Couldn't get capability: %s\n",strerror(err)); free(this); return NULL; } xprintf(xine, XINE_VERBOSITY_LOG, - "video_out_vidix: using driver: %s by %s\n",this->vidix_cap.name,this->vidix_cap.author); + _("video_out_vidix: using driver: %s by %s\n"), this->vidix_cap.name, this->vidix_cap.author); this->xine = xine; this->config = xine->config; @@ -1168,7 +1164,7 @@ static vo_driver_t *vidix_open_plugin (video_driver_class_t *class_gen, const vo query_fourccs(this); XLockDisplay (this->display); - this->xoverlay = x11osd_create (this->display, this->screen, this->drawable); + this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable); XUnlockDisplay (this->display); if( this->xoverlay ) @@ -1221,14 +1217,15 @@ static vo_driver_t *vidixfb_open_plugin (video_driver_class_t *class_gen, const /* Open fb device for reading */ if((fd = open("/dev/fb0", O_RDONLY)) < 0) { - printf("video_out_vidix: unable to open frame buffer device \"%s\": %s\n", - device, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: unable to open frame buffer device \"%s\": %s\n", device, strerror(errno)); return NULL; } /* Read screen info */ if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_var) != 0) { - perror("video_out_vidix: error in ioctl FBIOGET_VSCREENINFO"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "video_out_vidix: error in ioctl FBIOGET_VSCREENINFO: %s", strerror(errno)); close(fd); return NULL; } diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 86e81593d..02b793d69 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.123 2003/11/26 23:44:10 f1rmb Exp $ + * $Id: video_out_xshm.c,v 1.124 2003/12/05 15:55:04 f1rmb Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -185,8 +185,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, if (myimage == NULL ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xshm: shared memory error when allocating image\n" - "video_out_xshm: => not using MIT Shared Memory extension.\n"); + _("video_out_xshm: shared memory error when allocating image\n" + "video_out_xshm: => not using MIT Shared Memory extension.\n")); this->use_shm = 0; goto finishShmTesting; } @@ -201,8 +201,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, if (shminfo->shmid < 0 ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xshm: %s: allocating image\n" - "video_out_xshm: => not using MIT Shared Memory extension.\n", strerror(errno)); + _("video_out_xshm: %s: allocating image\n" + "video_out_xshm: => not using MIT Shared Memory extension.\n"), strerror(errno)); this->use_shm = 0; goto finishShmTesting; } @@ -211,8 +211,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, if (shminfo->shmaddr == ((char *) -1)) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xshm: shared memory error (address error) when allocating image \n" - "video_out_xshm: => not using MIT Shared Memory extension.\n"); + _("video_out_xshm: shared memory error (address error) when allocating image \n" + "video_out_xshm: => not using MIT Shared Memory extension.\n")); shmctl (shminfo->shmid, IPC_RMID, 0); shminfo->shmid = -1; this->use_shm = 0; @@ -228,8 +228,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, if (gX11Fail) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xshm: x11 error during shared memory XImage creation\n" - "video_out_xshm: => not using MIT Shared Memory extension.\n"); + _("video_out_xshm: x11 error during shared memory XImage creation\n" + "video_out_xshm: => not using MIT Shared Memory extension.\n")); shmdt (shminfo->shmaddr); shmctl (shminfo->shmid, IPC_RMID, 0); shminfo->shmid = -1; @@ -372,13 +372,10 @@ static vo_frame_t *xshm_alloc_frame (vo_driver_t *this_gen) { xshm_frame_t *frame; xshm_driver_t *this = (xshm_driver_t *) this_gen; - frame = (xshm_frame_t *) malloc (sizeof (xshm_frame_t)); - if (frame == NULL) { - printf ("xshm_alloc_frame: out of memory\n"); + frame = (xshm_frame_t *) xine_xmalloc (sizeof (xshm_frame_t)); + if (!frame) return NULL; - } - memset (frame, 0, sizeof(xshm_frame_t)); memcpy (&frame->sc, &this->sc, sizeof(vo_scale_t)); pthread_mutex_init (&frame->vo_frame.mutex, NULL); @@ -658,7 +655,8 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, frame->sc.delivered_width, frame->sc.delivered_height); break; default: - printf("xine-lib:video_out_xshm:xshm_overlay_blend: Cannot blend bpp:%i\n", this->bpp); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, + "xine-lib:video_out_xshm:xshm_overlay_blend: Cannot blend bpp:%i\n", this->bpp); /* it should never get here, unless a user tries to play in bpp:8 */ break; } @@ -782,7 +780,7 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; default: - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: tried to get unsupported property %d\n", property); } @@ -798,7 +796,7 @@ static int xshm_set_property (vo_driver_t *this_gen, if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); } else if (property == VO_PROP_BRIGHTNESS) { @@ -832,7 +830,8 @@ static int xshm_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; } else { - printf ("video_out_xshm: tried to set unsupported property %d\n", property); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xshm: tried to set unsupported property %d\n", property); } return value; @@ -1034,18 +1033,15 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi XColor dummy; if (!XInitThreads()) { - printf ("video_out_xshm: No thread-safe X libraries available.\n"); + xprintf (class->xine, XINE_VERBOSITY_LOG, + _("video_out_xshm: No thread-safe X libraries available.\n")); return NULL; } - this = malloc (sizeof (xshm_driver_t)); + this = (xshm_driver_t *) xine_xmalloc (sizeof (xshm_driver_t)); - if (!this) { - printf ("video_out_xshm: malloc failed\n"); + if (!this) return NULL; - } - - memset (this, 0, sizeof(xshm_driver_t)); this->display = visual->display; this->screen = visual->screen; @@ -1109,8 +1105,8 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi if (this->depth>16) xprintf(this->xine, XINE_VERBOSITY_LOG, - "\n\nWARNING: current display depth is %d. For better performance\n" - "a depth of 16 bpp is recommended!\n\n", this->depth); + _("\n\nWARNING: current display depth is %d. For better performance\n" + "a depth of 16 bpp is recommended!\n\n"), this->depth); /* * check for X shared memory support @@ -1122,7 +1118,7 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi } else { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xshm: MIT shared memory extension not present on display.\n"); + _("video_out_xshm: MIT shared memory extension not present on display.\n")); this->use_shm = 0; } @@ -1142,7 +1138,7 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi cpu_byte_order = htonl(1) == 1 ? MSBFirst : LSBFirst; swapped = cpu_byte_order != this->image_byte_order; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: video mode depth is %d (%d bpp), %s, %sswapped,\n" "\tred: %08lx, green: %08lx, blue: %08lx\n", this->depth, this->bpp, @@ -1203,7 +1199,8 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi } if (!mode) { - printf ("video_out_xshm: your video mode was not recognized, sorry :-(\n"); + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("video_out_xshm: your video mode was not recognized, sorry :-(\n")); return NULL; } @@ -1224,7 +1221,7 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi this->yuv2rgb_saturation); XLockDisplay (this->display); - this->xoverlay = x11osd_create (this->display, this->screen, this->drawable); + this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable); XUnlockDisplay (this->display); return &this->vo_driver; @@ -1249,7 +1246,7 @@ static void xshm_dispose_class (video_driver_class_t *this_gen) { } static void *xshm_init_class (xine_t *xine, void *visual_gen) { - xshm_class_t *this = (xshm_class_t *) malloc (sizeof (xshm_class_t)); + xshm_class_t *this = (xshm_class_t *) xine_xmalloc (sizeof (xshm_class_t)); this->driver_class.open_plugin = xshm_open_plugin; this->driver_class.get_identifier = xshm_get_identifier; diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index 1e3be022a..5d9516297 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.185 2003/11/26 23:44:10 f1rmb Exp $ + * $Id: video_out_xv.c,v 1.186 2003/12/05 15:55:04 f1rmb Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -198,16 +198,13 @@ static void xv_frame_dispose (vo_frame_t *vo_img) { } static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) { - xv_frame_t *frame ; + /* xv_driver_t *this = (xv_driver_t *) this_gen; */ + xv_frame_t *frame ; - frame = (xv_frame_t *) malloc (sizeof (xv_frame_t)); - - if (frame == NULL) { - printf ("xv_alloc_frame: out of memory\n"); + frame = (xv_frame_t *) xine_xmalloc (sizeof (xv_frame_t)); + if (!frame) return NULL; - } - memset (frame, 0, sizeof(xv_frame_t)); - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -263,7 +260,7 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, xv_format = this->xv_format_yuy2; break; default: - fprintf (stderr, "create_ximage: unknown format %08x\n",format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "create_ximage: unknown format %08x\n",format); abort(); } @@ -281,8 +278,8 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, if (image == NULL ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: XvShmCreateImage failed\n" - "video_out_xv: => not using MIT Shared Memory extension.\n"); + _("video_out_xv: XvShmCreateImage failed\n" + "video_out_xv: => not using MIT Shared Memory extension.\n")); this->use_shm = 0; goto finishShmTesting; } @@ -291,16 +288,16 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, if (image->data_size==0) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: XvShmCreateImage returned a zero size\n" - "video_out_xv: => not using MIT Shared Memory extension.\n"); + _("video_out_xv: XvShmCreateImage returned a zero size\n" + "video_out_xv: => not using MIT Shared Memory extension.\n")); this->use_shm = 0; goto finishShmTesting; } if (shminfo->shmid < 0 ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: shared memory error in shmget: %s" - "video_out_xv: => not using MIT Shared Memory extension.\n", strerror(errno)); + _("video_out_xv: shared memory error in shmget: %s" + "video_out_xv: => not using MIT Shared Memory extension.\n"), strerror(errno)); this->use_shm = 0; goto finishShmTesting; } @@ -308,14 +305,14 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); if (shminfo->shmaddr == NULL) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: shared memory error (address error NULL)\n"); this->use_shm = 0; goto finishShmTesting; } if (shminfo->shmaddr == ((char *) -1)) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: shared memory error (address error)\n"); this->use_shm = 0; goto finishShmTesting; @@ -331,8 +328,8 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, if (gX11Fail) { xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: x11 error during shared memory XImage creation\n" - "video_out_xv: => not using MIT Shared Memory extension.\n"); + _("video_out_xv: x11 error during shared memory XImage creation\n" + "video_out_xv: => not using MIT Shared Memory extension.\n")); shmdt (shminfo->shmaddr); shmctl (shminfo->shmid, IPC_RMID, 0); shminfo->shmid = -1; @@ -369,7 +366,7 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, data = malloc (width * height * 2); break; default: - fprintf (stderr, "create_ximage: unknown format %08x\n",format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "create_ximage: unknown format %08x\n",format); abort(); } @@ -1015,7 +1012,7 @@ static void xv_dispose (vo_driver_t *this_gen) { XLockDisplay (this->display); if(XvUngrabPort (this->display, this->xv_port, CurrentTime) != Success) { - printf ("video_out_xv: xv_exit: XvUngrabPort() failed.\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: xv_exit: XvUngrabPort() failed.\n"); } XUnlockDisplay (this->display); @@ -1076,7 +1073,7 @@ static void xv_check_capability (xv_driver_t *this, XvGetPortAttribute (this->display, this->xv_port, this->props[property].atom, &int_default); - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: port attribute %s (%d) value is %d\n", str_prop, property, int_default); if (config_name) { @@ -1135,7 +1132,7 @@ static void xv_update_XV_FILTER(void *this_gen, xine_cfg_entry_t *entry) { XvSetPortAttribute (this->display, this->xv_port, atom, xv_filter); XUnlockDisplay(this->display); - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: bilinear scaling mode (XV_FILTER) = %d\n",xv_filter); } @@ -1151,7 +1148,7 @@ static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) XvSetPortAttribute (this->display, this->xv_port, atom, xv_double_buffer); XUnlockDisplay(this->display); - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: double buffering mode = %d\n", xv_double_buffer); } @@ -1176,14 +1173,9 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XShmSegmentInfo myshminfo; XvPortID xv_port = class->xv_port; - this = malloc (sizeof (xv_driver_t)); - - if (!this) { - printf ("video_out_xv: malloc failed\n"); + this = (xv_driver_t *) xine_xmalloc (sizeof (xv_driver_t)); + if (!this) return NULL; - } - - memset (this, 0, sizeof(xv_driver_t)); this->display = visual->display; this->screen = visual->screen; @@ -1332,11 +1324,13 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if (fo[i].id == XINE_IMGFMT_YV12) { this->xv_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; - xprintf(this->xine, XINE_VERBOSITY_LOG,"video_out_xv: this adaptor supports the yv12 format.\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: this adaptor supports the yv12 format.\n")); } else if (fo[i].id == XINE_IMGFMT_YUY2) { this->xv_format_yuy2 = fo[i].id; this->capabilities |= VO_CAP_YUY2; - xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xv: this adaptor supports the yuy2 format.\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("video_out_xv: this adaptor supports the yuy2 format.\n")); } } @@ -1363,7 +1357,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->deinterlace_enabled = 0; XLockDisplay (this->display); - this->xoverlay = x11osd_create (this->display, this->screen, this->drawable); + this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable); XUnlockDisplay (this->display); if( this->xoverlay ) @@ -1411,13 +1405,13 @@ static void *init_class (xine_t *xine, void *visual_gen) { */ if (!XInitThreads()) { - printf ("video_out_xv: No thread-safe X libraries available.\n"); + xprintf (xine, XINE_VERBOSITY_LOG, _("video_out_xv: No thread-safe X libraries available.\n")); return NULL; } XLockDisplay(display); if (Success != XvQueryExtension(display, &ver,&rel, &req, &ev,&err)) { - printf ("video_out_xv: Xv extension not present.\n"); + xprintf (xine, XINE_VERBOSITY_LOG, _("video_out_xv: Xv extension not present.\n")); XUnlockDisplay(display); return NULL; } @@ -1428,7 +1422,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { if (Success != XvQueryAdaptors(display,DefaultRootWindow(display), &adaptors,&adaptor_info)) { - printf("video_out_xv: XvQueryAdaptors failed.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_xv: XvQueryAdaptors failed.\n"); XUnlockDisplay(display); return NULL; } @@ -1455,8 +1449,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { if (!xv_port) { xprintf(xine, XINE_VERBOSITY_LOG, - "video_out_xv: Xv extension is present but I couldn't find a usable yuv12 port.\n" - " Looks like your graphics hardware driver doesn't support Xv?!\n"); + _("video_out_xv: Xv extension is present but I couldn't find a usable yuv12 port.\n" + " Looks like your graphics hardware driver doesn't support Xv?!\n")); /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ XUnlockDisplay(display); @@ -1464,8 +1458,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { } else xprintf(xine, XINE_VERBOSITY_LOG, - "video_out_xv: using Xv port %ld from adaptor %s for hardware " - "colorspace conversion and scaling.\n", xv_port, + _("video_out_xv: using Xv port %ld from adaptor %s for hardware " + "colorspace conversion and scaling.\n"), xv_port, adaptor_info[adaptor_num].name); XUnlockDisplay(display); @@ -1473,7 +1467,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* * from this point on, nothing should go wrong anymore */ - this = (xv_class_t *) malloc (sizeof (xv_class_t)); + this = (xv_class_t *) xine_xmalloc (sizeof (xv_class_t)); this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c index 04c94ba0b..9708c8179 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.9 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: video_out_xvmc.c,v 1.10 2003/12/05 15:55:04 f1rmb Exp $ * * video_out_xvmc.c, X11 video motion compensation extension interface for xine * @@ -217,6 +217,7 @@ struct xvmc_driver_s { uint32_t colorkey; void *user_data; + xine_t *xine; }; @@ -233,6 +234,7 @@ typedef struct { unsigned int max_surface_width; unsigned int max_surface_height; short acceleration; + xine_t *xine; } xvmc_class_t; static void xvmc_render_macro_blocks(vo_frame_t *current_image, @@ -570,13 +572,10 @@ static vo_frame_t *xvmc_alloc_frame (vo_driver_t *this_gen) { lprintf ("xvmc_alloc_frame\n"); - frame = (xvmc_frame_t *) malloc (sizeof (xvmc_frame_t)); + frame = (xvmc_frame_t *) xine_xmalloc (sizeof (xvmc_frame_t)); - if (frame == NULL) { - printf ("xvmc_alloc_frame: out of memory\n"); + if (!frame) return NULL; - } - memset (frame, 0, sizeof(xvmc_frame_t)); /* keep track of frames and how many frames alocated. */ this->frames[this->num_frame_buffers++] = frame; @@ -610,10 +609,8 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, /* initialize block & macro block pointers first time */ if(macroblocks->blocks == NULL || macroblocks->macro_blocks == NULL) { - macroblocks->blocks = malloc(sizeof(XvMCBlockArray)); - macroblocks->macro_blocks = malloc(sizeof(XvMCMacroBlockArray)); - memset (macroblocks->blocks, 0, sizeof(XvMCBlockArray)); - memset (macroblocks->macro_blocks, 0, sizeof(XvMCMacroBlockArray)); + macroblocks->blocks = xine_xmalloc(sizeof(XvMCBlockArray)); + macroblocks->macro_blocks = xine_xmalloc(sizeof(XvMCMacroBlockArray)); lprintf("macroblocks->blocks %lx ->macro_blocks %lx\n", macroblocks->blocks,macroblocks->macro_blocks); @@ -662,7 +659,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, width, height, XVMC_DIRECT, &this->context); if(result != Success) { - fprintf(stderr, "set_context: couldn't create XvMCContext\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "set_context: couldn't create XvMCContext\n"); macroblocks->xine_mc.xvmc_accel = 0; abort(); } @@ -674,7 +671,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, &this->frames[i]->surface); if(result != Success) { XvMCDestroyContext(this->display, &this->context); - printf("set_context: couldn't create XvMCSurfaces\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "set_context: couldn't create XvMCSurfaces\n"); this->context_id.xid = NULL; macroblocks->xine_mc.xvmc_accel = 0; abort(); @@ -690,14 +687,14 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, result = XvMCCreateBlocks(this->display, &this->context, slices * 6, macroblocks->blocks); if(result != Success) { - fprintf(stderr, "set_context: ERROR XvMCCreateBlocks failed\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "set_context: ERROR XvMCCreateBlocks failed\n"); macroblocks->xine_mc.xvmc_accel = 0; abort(); } result =XvMCCreateMacroBlocks(this->display, &this->context, slices, macroblocks->macro_blocks); if(result != Success) { - fprintf(stderr, "set_context: ERROR XvMCCreateMacroBlocks failed\n"); + printf(this->xine, XINE_VERBOSITY_DEBUG, "set_context: ERROR XvMCCreateMacroBlocks failed\n"); macroblocks->xine_mc.xvmc_accel = 0; abort(); } @@ -734,7 +731,7 @@ static XvImage *create_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, xvmc_format = this->xvmc_format_yuy2; break; default: - fprintf (stderr, "create_ximage: unknown format %08x\n",format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "create_ximage: unknown format %08x\n",format); abort(); } @@ -754,7 +751,7 @@ static XvImage *create_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, data = malloc (width * height * 2); break; default: - fprintf (stderr, "create_ximage: unknown format %08x\n",format); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "create_ximage: unknown format %08x\n",format); abort(); } @@ -1101,8 +1098,8 @@ static int xvmc_set_property (vo_driver_t *this_gen, case VO_PROP_ZOOM_X: if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; - printf ("video_out_xv: VO_PROP_ZOOM_X = %d\n", - this->props[property].value); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xv: VO_PROP_ZOOM_X = %d\n", this->props[property].value); this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; xvmc_compute_ideal_size (this); @@ -1113,8 +1110,8 @@ static int xvmc_set_property (vo_driver_t *this_gen, case VO_PROP_ZOOM_Y: if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; - printf ("video_out_xv: VO_PROP_ZOOM_Y = %d\n", - this->props[property].value); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xv: VO_PROP_ZOOM_Y = %d\n", this->props[property].value); this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; xvmc_compute_ideal_size (this); @@ -1298,8 +1295,8 @@ static void xvmc_check_capability (xvmc_driver_t *this, XvGetPortAttribute (this->display, this->xv_port, this->props[property].atom, &int_default); - printf ("video_out_xvmc: port attribute %s (%d) value is %d\n", - str_prop, property, int_default); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "video_out_xvmc: port attribute %s (%d) value is %d\n", str_prop, property, int_default); if (config_name) { /* is this a boolean property ? */ @@ -1373,20 +1370,17 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi display = visual->display; /* TODO ??? */ - this = malloc (sizeof (xvmc_driver_t)); + this = (xvmc_driver_t *) xine_xmalloc (sizeof (xvmc_driver_t)); - if (!this) { - printf ("video_out_xvmc: malloc failed\n"); + if (!this) return NULL; - } - - memset (this, 0, sizeof(xvmc_driver_t)); this->display = visual->display; this->overlay = NULL; this->screen = visual->screen; this->xv_port = class->xv_port; this->config = config; + this->xine = class->xine; _x_vo_scale_init (&this->sc, 1, 0, config ); @@ -1506,7 +1500,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XFree(attr); } else { - printf("video_out_xvmc: no port attributes defined.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: no port attributes defined.\n"); } @@ -1558,25 +1552,25 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi switch(this->deinterlace_method) { case DEINTERLACE_NONE: - printf("NONE\n"); + lprintf("NONE\n"); break; case DEINTERLACE_BOB: - printf("BOB\n"); + lprintf("BOB\n"); break; case DEINTERLACE_WEAVE: - printf("WEAVE\n"); + lprintf("WEAVE\n"); break; case DEINTERLACE_GREEDY: - printf("GREEDY\n"); + lprintf("GREEDY\n"); break; case DEINTERLACE_ONEFIELD: - printf("ONEFIELD\n"); + lprintf("ONEFIELD\n"); break; case DEINTERLACE_ONEFIELDXV: - printf("ONEFIELDXV\n"); + lprintf("ONEFIELDXV\n"); break; case DEINTERLACE_LINEARBLEND: - printf("LINEARBLEND\n"); + lprintf("LINEARBLEND\n"); break; } @@ -1633,13 +1627,13 @@ static void *init_class (xine_t *xine, void *visual_gen) { XLockDisplay(display); if (Success != XvQueryExtension(display, &ver, &rel, &req, &ev, &err)) { - printf ("video_out_xvmc: Xv extension not present.\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: Xv extension not present.\n"); XUnlockDisplay(display); return NULL; } if(!XvMCQueryExtension(display, &ev, &err)) { - printf ("video_out_xvmc: XvMC extension not present.\n"); + xprintf (xine, XINE_VERBOSITY_LOG, _("video_out_xvmc: XvMC extension not present.\n")); XUnlockDisplay(display); return 0; } @@ -1650,7 +1644,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { if(Success != XvQueryAdaptors(display, DefaultRootWindow(display), &adaptors, &adaptor_info)) { - printf ("video_out_xvmc: XvQueryAdaptors failed.\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: XvQueryAdaptors failed.\n"); XUnlockDisplay(display); return 0; } @@ -1658,7 +1652,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { xv_port = 0; for ( adaptor_num = 0; (adaptor_num < adaptors) && !xv_port; adaptor_num++ ) { - printf ("video_out_xvmc: checking adaptor %d\n",adaptor_num); + xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: checking adaptor %d\n",adaptor_num); if (adaptor_info[adaptor_num].type & XvImageMask) { surfaceInfo = XvMCListSurfaceTypes(display, adaptor_info[adaptor_num].base_id, &types); @@ -1686,13 +1680,13 @@ static void *init_class (xine_t *xine, void *visual_gen) { } if(!xv_port) { /* try for just XVMC_MOCOMP */ - lprintf ("didn't find XVMC_IDCT acceleration trying for MC\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, "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 ("Found XVMC_MOCOMP\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, "Found XVMC_MOCOMP\n"); max_width = surfaceInfo[surface_num].max_width; max_height = surfaceInfo[surface_num].max_height; @@ -1727,7 +1721,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { } else IDCTaccel = 0; - printf ("video_out_xvmc: IDCTaccel %02x\n",IDCTaccel); + xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: IDCTaccel %02x\n",IDCTaccel); break; } XFree(surfaceInfo); @@ -1737,37 +1731,36 @@ static void *init_class (xine_t *xine, void *visual_gen) { if (!xv_port) { - printf ("video_out_xvmc: Xv extension is present but " - "I couldn't find a usable yuv12 port.\n"); - printf (" Looks like your graphics hardware " - "driver doesn't support Xv?!\n"); + xprintf (xine, XINE_VERBOSITY_LOG, + _("video_out_xvmc: Xv extension is present but I couldn't find a usable yuv12 port.\n")); + xprintf (xine, XINE_VERBOSITY_LOG, " Looks like your graphics hardware " + "driver doesn't support Xv?!\n"); /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ XUnlockDisplay(display); return NULL; } else { - printf ("video_out_xvmc: using Xv port %ld from adaptor %s\n" - " for hardware colorspace conversion and scaling\n", xv_port, - adaptor_info[adaptor_num].name); + xprintf (xine, XINE_VERBOSITY_LOG, + _("video_out_xvmc: using Xv port %ld from adaptor %s\n" + " for hardware colorspace conversion and scaling\n"), + xv_port, adaptor_info[adaptor_num].name); if(IDCTaccel&XINE_VO_IDCT_ACCEL) - printf (" idct and motion compensation acceleration \n"); + xprintf (xine, XINE_VERBOSITY_LOG, _(" idct and motion compensation acceleration \n")); else if (IDCTaccel&XINE_VO_MOTION_ACCEL) - printf (" motion compensation acceleration only\n"); + xprintf (xine, XINE_VERBOSITY_LOG, _(" motion compensation acceleration only\n")); else - printf (" no XvMC support \n"); - printf (" With Overlay = %d; UnsignedIntra = %d.\n", useOverlay, - unsignedIntra); + xprintf (xine, XINE_VERBOSITY_LOG, _(" no XvMC support \n")); + xprintf (xine, XINE_VERBOSITY_LOG, _(" With Overlay = %d; UnsignedIntra = %d.\n"), + useOverlay, unsignedIntra); } XUnlockDisplay(display); this = (xvmc_class_t *) malloc (sizeof (xvmc_class_t)); - if (!this) { - printf ("video_out_xvmc: malloc failed\n"); + if (!this) return NULL; - } this->driver_class.open_plugin = open_plugin; this->driver_class.get_identifier = get_identifier; @@ -1784,6 +1777,8 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->max_surface_height = max_height; this->acceleration = IDCTaccel; + this->xine = xine; + lprintf("init_class done\n"); return this; diff --git a/src/video_out/x11osd.c b/src/video_out/x11osd.c index b268024b2..371202f9a 100644 --- a/src/video_out/x11osd.c +++ b/src/video_out/x11osd.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: x11osd.c,v 1.3 2003/11/26 18:36:34 miguelfreitas Exp $ + * $Id: x11osd.c,v 1.4 2003/12/05 15:55:04 f1rmb Exp $ * * x11osd.c, use X11 Nonrectangular Window Shape Extension to draw xine OSD * @@ -70,6 +70,7 @@ struct x11osd int y; int clean; int mapped; + xine_t *xine; }; @@ -174,23 +175,23 @@ static int x11_error_handler(Display *dpy, XErrorEvent *error) } x11osd * -x11osd_create (Display *display, int screen, Window window) +x11osd_create (xine_t *xine, Display *display, int screen, Window window) { x11osd *osd; int event_basep, error_basep; XErrorHandler old_handler = NULL; - osd = malloc (sizeof (x11osd)); - memset (osd, 0, sizeof (x11osd)); - if (osd == NULL) + osd = xine_xmalloc (sizeof (x11osd)); + if (!osd) return NULL; + osd->xine = xine; osd->display = display; osd->screen = screen; osd->parent_window = window; if (!XShapeQueryExtension (osd->display, &event_basep, &error_basep)) { - printf(_("x11osd: XShape extension not available. unscaled overlay disabled.\n")); + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: XShape extension not available. unscaled overlay disabled.\n")); goto error2; } @@ -210,7 +211,7 @@ x11osd_create (Display *display, int screen, Window window) BlackPixel (osd->display, osd->screen)); XSync(osd->display, False); if( x11_error ) { - printf(_("x11osd: error creating window. unscaled overlay disabled.\n")); + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: error creating window. unscaled overlay disabled.\n")); goto error3; } @@ -219,7 +220,7 @@ x11osd_create (Display *display, int screen, Window window) osd->height, 1); XSync(osd->display, False); if( x11_error ) { - printf(_("x11osd: error creating pixmap. unscaled overlay disabled.\n")); + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: error creating pixmap. unscaled overlay disabled.\n")); goto error4; } @@ -228,7 +229,7 @@ x11osd_create (Display *display, int screen, Window window) osd->height, osd->depth); XSync(osd->display, False); if( x11_error ) { - printf(_("x11osd: error creating pixmap. unscaled overlay disabled.\n")); + xprintf(osd->xine, XINE_VERBOSITY_LOG, _("x11osd: error creating pixmap. unscaled overlay disabled.\n")); goto error5; } diff --git a/src/video_out/x11osd.h b/src/video_out/x11osd.h index c38d6a395..23be5df11 100644 --- a/src/video_out/x11osd.h +++ b/src/video_out/x11osd.h @@ -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: x11osd.h,v 1.2 2003/11/26 19:36:13 mroi Exp $ + * $Id: x11osd.h,v 1.3 2003/12/05 15:55:04 f1rmb Exp $ * * x11osd.h, use X11 Nonrectangular Window Shape Extension to draw xine OSD * @@ -30,20 +30,20 @@ #ifndef X11OSD_H #define X11OSD_H - typedef struct x11osd x11osd; +typedef struct x11osd x11osd; - x11osd *x11osd_create (Display *display, int screen, Window window); +x11osd *x11osd_create (xine_t *xine, Display *display, int screen, Window window); - void x11osd_destroy (x11osd * osd); +void x11osd_destroy (x11osd * osd); - void x11osd_expose (x11osd * osd); +void x11osd_expose (x11osd * osd); - void x11osd_resize (x11osd * osd, int width, int height); +void x11osd_resize (x11osd * osd, int width, int height); - void x11osd_drawable_changed (x11osd * osd, Window window); +void x11osd_drawable_changed (x11osd * osd, Window window); - void x11osd_clear(x11osd *osd); +void x11osd_clear(x11osd *osd); - void x11osd_blend(x11osd *osd, vo_overlay_t *overlay); +void x11osd_blend(x11osd *osd, vo_overlay_t *overlay); #endif diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c index 174d1414e..57b76867c 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.46 2003/11/26 19:43:38 f1rmb Exp $ + * $Id: yuv2rgb.c,v 1.47 2003/12/05 15:55:04 f1rmb Exp $ */ #include "config.h" @@ -2397,7 +2397,7 @@ static void yuv2rgb_set_csc_levels (yuv2rgb_factory_t *this, default: - printf ("yuv2rgb: mode %d not supported by yuv2rgb\n", mode); + lprintf ("yuv2rgb: mode %d not supported by yuv2rgb\n", mode); abort(); } @@ -2529,7 +2529,7 @@ static void yuv2rgb_c_init (yuv2rgb_factory_t *this) break; default: - printf ("yuv2rgb: mode %d not supported by yuv2rgb\n", this->mode); + lprintf ("yuv2rgb: mode %d not supported by yuv2rgb\n", this->mode); abort(); } @@ -2572,7 +2572,7 @@ static void yuv2rgb_single_pixel_init (yuv2rgb_factory_t *this) { break; default: - printf ("yuv2rgb: mode %d not supported by yuv2rgb\n", this->mode); + lprintf ("yuv2rgb: mode %d not supported by yuv2rgb\n", this->mode); abort(); } } @@ -3114,7 +3114,7 @@ static void yuy22rgb_c_init (yuv2rgb_factory_t *this) break; default: - printf ("yuv2rgb: mode %d not supported for yuy2\n", this->mode); + lprintf ("yuv2rgb: mode %d not supported for yuy2\n", this->mode); } } |