From: Daniel Caujolle-B. <f1...@us...> - 2003-11-26 23:44:14
|
Update of /cvsroot/xine/xine-lib/src/video_out In directory sc8-pr-cvs1:/tmp/cvs-serv30244/src/video_out Modified Files: video_out_vidix.c video_out_xshm.c video_out_xv.c Log Message: xprintf clean pass. xprintf now log into new XINE_LOG_TRACE log buffer. scratch buffer enhancement (thanks Thibaut for the malloc tips), enlarge log buffer from 25 lines (very useless), to 150 (better). Index: video_out_vidix.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_vidix.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -r1.54 -r1.55 --- video_out_vidix.c 26 Nov 2003 19:43:37 -0000 1.54 +++ video_out_vidix.c 26 Nov 2003 23:44:10 -0000 1.55 @@ -755,8 +755,7 @@ this->vidix_eq.hue = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - if(this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_vidix: can't set hue: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set hue: %s\n", strerror(err)); } if ( property == VO_PROP_SATURATION ) { @@ -764,8 +763,7 @@ this->vidix_eq.saturation = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - if(this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_vidix: can't set saturation: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set saturation: %s\n", strerror(err)); } if ( property == VO_PROP_BRIGHTNESS ) { @@ -773,8 +771,7 @@ this->vidix_eq.brightness = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - if(this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_vidix: can't set brightness: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set brightness: %s\n", strerror(err)); } if ( property == VO_PROP_CONTRAST ) { @@ -782,8 +779,7 @@ this->vidix_eq.contrast = value; if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) - if(this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_vidix: can't set contrast: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set contrast: %s\n", strerror(err)); } } @@ -836,8 +832,7 @@ } if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq))) - if(this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); } @@ -964,8 +959,8 @@ /* Find what equalizer flags are supported */ if(this->vidix_cap.flags & FLAG_EQUALIZER) { if((err = vdlPlaybackGetEq(this->vidix_handler, &this->vidix_eq)) != 0) { - if(this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_vidix: couldn't get equalizer capabilities: %s\n", strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_vidix: couldn't get equalizer capabilities: %s\n", strerror(err)); } else { if(this->vidix_eq.cap & VEQ_CAP_BRIGHTNESS) { this->props[VO_PROP_BRIGHTNESS].value = 0; @@ -1008,9 +1003,8 @@ (void*) vidix_rgb_callback, this); if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq))) - if(this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_vidix: can't set rgb intensity: %s\n", - strerror(err)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); } } } @@ -1061,8 +1055,7 @@ if((err = vdlQueryFourcc(this->vidix_handler, &vidix_fourcc)) == 0) { this->capabilities |= VO_CAP_YUY2; - if(this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("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 @@ -1072,8 +1065,7 @@ if((err = vdlQueryFourcc(this->vidix_handler, &vidix_fourcc)) == 0) { this->supports_yv12 = 1; - if(this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("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; } @@ -1110,9 +1102,9 @@ free(this); return NULL; } - if(xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_vidix: using driver: %s by %s\n",this->vidix_cap.name,this->vidix_cap.author); + xprintf(xine, XINE_VERBOSITY_LOG, + "video_out_vidix: using driver: %s by %s\n",this->vidix_cap.name,this->vidix_cap.author); this->xine = xine; this->config = xine->config; Index: video_out_xshm.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_xshm.c,v retrieving revision 1.122 retrieving revision 1.123 diff -u -r1.122 -r1.123 --- video_out_xshm.c 26 Nov 2003 19:43:37 -0000 1.122 +++ video_out_xshm.c 26 Nov 2003 23:44:10 -0000 1.123 @@ -184,10 +184,9 @@ height); if (myimage == NULL ) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("video_out_xshm: shared memory error when allocating image\n"); - printf ("video_out_xshm: => not using MIT Shared Memory extension.\n"); - } + 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"); this->use_shm = 0; goto finishShmTesting; } @@ -201,10 +200,9 @@ IPC_CREAT | 0777); if (shminfo->shmid < 0 ) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("video_out_xshm: %s: allocating image\n",strerror(errno)); - printf ("video_out_xshm: => not using MIT Shared Memory extension.\n"); - } + 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)); this->use_shm = 0; goto finishShmTesting; } @@ -212,10 +210,9 @@ shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); if (shminfo->shmaddr == ((char *) -1)) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("video_out_xshm: shared memory error (address error) when allocating image \n"); - printf ("video_out_xshm: => not using MIT Shared Memory extension.\n"); - } + 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"); shmctl (shminfo->shmid, IPC_RMID, 0); shminfo->shmid = -1; this->use_shm = 0; @@ -230,10 +227,9 @@ XSync(this->display, False); if (gX11Fail) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("video_out_xshm: x11 error during shared memory XImage creation\n"); - printf ("video_out_xshm: => not using MIT Shared Memory extension.\n"); - } + 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"); shmdt (shminfo->shmaddr); shmctl (shminfo->shmid, IPC_RMID, 0); shminfo->shmid = -1; @@ -786,10 +782,8 @@ case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; default: - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("video_out_xshm: tried to get unsupported property %d\n", - property); - } + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xshm: tried to get unsupported property %d\n", property); } return 0; @@ -804,10 +798,8 @@ if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("video_out_xshm: aspect ratio changed to %s\n", - _x_vo_scale_aspect_ratio_name(value)); - } + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xshm: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); } else if (property == VO_PROP_BRIGHTNESS) { @@ -1115,13 +1107,10 @@ this->visual = attribs.visual; this->depth = attribs.depth; - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - if (this->depth>16) - printf ("\n\n" - "WARNING: current display depth is %d. For better performance\n" - "a depth of 16 bpp is recommended!\n\n", - this->depth); - } + 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); /* * check for X shared memory support @@ -1132,8 +1121,8 @@ this->use_shm = 1; } else { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("video_out_xshm: MIT shared memory extension not present on display.\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xshm: MIT shared memory extension not present on display.\n"); this->use_shm = 0; } @@ -1153,14 +1142,13 @@ cpu_byte_order = htonl(1) == 1 ? MSBFirst : LSBFirst; swapped = cpu_byte_order != this->image_byte_order; - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("video_out_xshm: video mode depth is %d (%d bpp), %s, %sswapped,\n" - "\tred: %08lx, green: %08lx, blue: %08lx\n", - this->depth, this->bpp, - visual_class_name(this->visual), - swapped ? "" : "not ", - this->visual->red_mask, this->visual->green_mask, this->visual->blue_mask); - } + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xshm: video mode depth is %d (%d bpp), %s, %sswapped,\n" + "\tred: %08lx, green: %08lx, blue: %08lx\n", + this->depth, this->bpp, + visual_class_name(this->visual), + swapped ? "" : "not ", + this->visual->red_mask, this->visual->green_mask, this->visual->blue_mask); mode = 0; Index: video_out_xv.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_xv.c,v retrieving revision 1.184 retrieving revision 1.185 diff -u -r1.184 -r1.185 --- video_out_xv.c 26 Nov 2003 19:43:37 -0000 1.184 +++ video_out_xv.c 26 Nov 2003 23:44:10 -0000 1.185 @@ -41,6 +41,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <errno.h> #include <math.h> #if defined (__SVR4) && defined (__sun) @@ -279,10 +280,9 @@ width, height, shminfo); if (image == NULL ) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf("video_out_xv: XvShmCreateImage failed\n"); - printf("video_out_xv: => not using MIT Shared Memory extension.\n"); - } + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: XvShmCreateImage failed\n" + "video_out_xv: => not using MIT Shared Memory extension.\n"); this->use_shm = 0; goto finishShmTesting; } @@ -290,19 +290,17 @@ shminfo->shmid = shmget(IPC_PRIVATE, image->data_size, IPC_CREAT | 0777); if (image->data_size==0) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf("video_out_xv: XvShmCreateImage returned a zero size\n"); - printf("video_out_xv: => not using MIT Shared Memory extension.\n"); - } + 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"); this->use_shm = 0; goto finishShmTesting; } if (shminfo->shmid < 0 ) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - perror("video_out_xv: shared memory error in shmget: "); - printf("video_out_xv: => not using MIT Shared Memory extension.\n"); - } + 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)); this->use_shm = 0; goto finishShmTesting; } @@ -310,15 +308,15 @@ shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); if (shminfo->shmaddr == NULL) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_xv: shared memory error (address error NULL)\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: shared memory error (address error NULL)\n"); this->use_shm = 0; goto finishShmTesting; } if (shminfo->shmaddr == ((char *) -1)) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_xv: shared memory error (address error)\n"); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: shared memory error (address error)\n"); this->use_shm = 0; goto finishShmTesting; } @@ -332,10 +330,9 @@ shmctl(shminfo->shmid, IPC_RMID, 0); if (gX11Fail) { - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("video_out_xv: x11 error during shared memory XImage creation\n"); - printf ("video_out_xv: => not using MIT Shared Memory extension.\n"); - } + 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"); shmdt (shminfo->shmaddr); shmctl (shminfo->shmid, IPC_RMID, 0); shminfo->shmid = -1; @@ -798,9 +795,8 @@ break; } - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("video_out_xv: property #%d = %d\n", property, - this->props[property].value); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: property #%d = %d\n", property, this->props[property].value); return this->props[property].value; } @@ -844,10 +840,8 @@ case VO_PROP_INTERLACED: this->props[property].value = value; - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf("video_out_xv: VO_PROP_INTERLACED(%d)\n", - this->props[property].value); - } + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: VO_PROP_INTERLACED(%d)\n", this->props[property].value); this->deinterlace_enabled = value; if (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) { xv_compute_ideal_size (this); @@ -860,10 +854,8 @@ value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) { - printf("video_out_xv: VO_PROP_ASPECT_RATIO(%d)\n", - this->props[property].value); - } + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); this->sc.user_ratio = value; xv_compute_ideal_size (this); @@ -874,10 +866,9 @@ case VO_PROP_ZOOM_X: if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("video_out_xv: VO_PROP_ZOOM_X = %d\n", - this->props[property].value); - + xprintf(this->xine, XINE_VERBOSITY_LOG, + "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; xv_compute_ideal_size (this); @@ -889,9 +880,8 @@ case VO_PROP_ZOOM_Y: if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("video_out_xv: VO_PROP_ZOOM_Y = %d\n", - this->props[property].value); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "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; @@ -1086,10 +1076,9 @@ XvGetPortAttribute (this->display, this->xv_port, this->props[property].atom, &int_default); - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("video_out_xv: port attribute %s (%d) value is %d\n", - str_prop, property, int_default); - + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: port attribute %s (%d) value is %d\n", str_prop, property, int_default); + if (config_name) { /* is this a boolean property ? */ if ((attr.min_value == 0) && (attr.max_value == 1)) { @@ -1146,8 +1135,8 @@ XvSetPortAttribute (this->display, this->xv_port, atom, xv_filter); XUnlockDisplay(this->display); - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_xv: bilinear scaling mode (XV_FILTER) = %d\n",xv_filter); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: bilinear scaling mode (XV_FILTER) = %d\n",xv_filter); } static void xv_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry) { @@ -1162,8 +1151,8 @@ XvSetPortAttribute (this->display, this->xv_port, atom, xv_double_buffer); XUnlockDisplay(this->display); - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("video_out_xv: double buffering mode = %d\n",xv_double_buffer); + xprintf(this->xine, XINE_VERBOSITY_LOG, + "video_out_xv: double buffering mode = %d\n", xv_double_buffer); } static void xv_update_xv_pitch_alignment(void *this_gen, xine_cfg_entry_t *entry) { @@ -1322,9 +1311,8 @@ } XFree(attr); } - else if (this->xine->verbosity >= XINE_VERBOSITY_DEBUG) { - printf("video_out_xv: no port attributes defined.\n"); - } + else + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: no port attributes defined.\n"); /* * check supported image formats @@ -1344,13 +1332,11 @@ if (fo[i].id == XINE_IMGFMT_YV12) { this->xv_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("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; - if (this->xine->verbosity >= XINE_VERBOSITY_LOG) - printf("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"); } } @@ -1468,18 +1454,17 @@ } if (!xv_port) { - if (xine->verbosity >= XINE_VERBOSITY_LOG) { - printf ("video_out_xv: 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_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); return NULL; } - else if (xine->verbosity >= XINE_VERBOSITY_LOG) - printf ("video_out_xv: using Xv port %ld from adaptor %s for hardware " + 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, adaptor_info[adaptor_num].name); |