diff options
Diffstat (limited to 'src/video_out')
40 files changed, 1912 insertions, 1912 deletions
diff --git a/src/video_out/deinterlace.c b/src/video_out/deinterlace.c index 712e9a83e..6d90caca0 100644 --- a/src/video_out/deinterlace.c +++ b/src/video_out/deinterlace.c @@ -42,7 +42,7 @@ const char *deinterlace_methods[] = { - "none", + "none", "bob", "weave", "greedy", @@ -201,7 +201,7 @@ static void deinterlace_bob_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], /* Deinterlace the latest field, with a tendency to weave rather than bob. Good for high detail on low-movement scenes. Seems to produce bad output in general case, need to check if this - is normal or if the code is broken. + is normal or if the code is broken. */ static int deinterlace_weave_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], int width, int height ) @@ -656,7 +656,7 @@ static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], uint64_t *YVal3; uint64_t *Dest; int LineLength = width; - + int n; /* Copy first line */ @@ -676,7 +676,7 @@ static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], movq_m2r (*YVal1++, mm0); movq_m2r (*YVal2++, mm1); movq_m2r (*YVal3++, mm2); - + /* expand bytes to words */ punpckhbw_r2r (mm0, mm3); punpckhbw_r2r (mm1, mm4); @@ -684,8 +684,8 @@ static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], punpcklbw_r2r (mm0, mm0); punpcklbw_r2r (mm1, mm1); punpcklbw_r2r (mm2, mm2); - - /* + + /* * deinterlacing: * deint_line = (line0 + 2*line1 + line2) / 4 */ @@ -704,15 +704,15 @@ static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], /* pack 8 words to 8 bytes in mm0 */ packuswb_r2r (mm3, mm0); - + movq_r2m ( mm0, *Dest++ ); } } /* Copy last line */ - xine_fast_memcpy(pdst + Line * LineLength, + xine_fast_memcpy(pdst + Line * LineLength, psrc[0] + Line * LineLength, LineLength); - + /* clear out the MMX registers ready for doing floating point * again */ @@ -734,7 +734,7 @@ static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[], * each line on pdst doesn't depend on previous lines; * due to the way the algorithm is defined, the first & last lines of the screen aren't deinterlaced. - + */ static void deinterlace_linearblend_yuv( uint8_t *pdst, uint8_t *psrc[], int width, int height ) @@ -751,7 +751,7 @@ static void deinterlace_linearblend_yuv( uint8_t *pdst, uint8_t *psrc[], xine_fast_memcpy(l0, l1, width); l0 += width; - for (y = 1; y < height-1; ++y) { + for (y = 1; y < height-1; ++y) { /* computes avg of: l1 + 2*l2 + l3 */ for (x = 0; x < width; ++x) { diff --git a/src/video_out/libdha/Makefile.am b/src/video_out/libdha/Makefile.am index 8d94347d1..9412bcd50 100644 --- a/src/video_out/libdha/Makefile.am +++ b/src/video_out/libdha/Makefile.am @@ -16,7 +16,7 @@ CLEANFILES = $(awk_generated) noinst_LTLIBRARIES = $(dha_lib) libdha_la_SOURCES = libdha.c mtrr.c pci.c mmi.c ports.c irq.c cpu_flush.c -nodist_libdha_la_SOURCES = pci_names.c +nodist_libdha_la_SOURCES = pci_names.c EXTRA_PROGRAMS = test diff --git a/src/video_out/libdha/sysdep/Makefile.am b/src/video_out/libdha/sysdep/Makefile.am index 807572c39..0896a8ded 100644 --- a/src/video_out/libdha/sysdep/Makefile.am +++ b/src/video_out/libdha/sysdep/Makefile.am @@ -24,7 +24,7 @@ EXTRA_DIST = \ pci_svr4.c \ pci_win32.c \ pci_x86.c - + noinst_HEADERS = \ AsmMacros_alpha.h \ AsmMacros_arm32.h \ diff --git a/src/video_out/macosx/video_window.h b/src/video_out/macosx/video_window.h index b46ac43fe..0a3655c0c 100644 --- a/src/video_out/macosx/video_window.h +++ b/src/video_out/macosx/video_window.h @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * Written by Daniel Mack <xine@zonque.org> - * + * * Most parts of this code were taken from VLC, http://www.videolan.org * Thanks for the good research! */ diff --git a/src/video_out/myglext.h b/src/video_out/myglext.h index 1a55a4f87..643b31c3d 100644 --- a/src/video_out/myglext.h +++ b/src/video_out/myglext.h @@ -13,21 +13,21 @@ extern "C" { ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: This software was created using the ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has ** not been independently verified as being compliant with the OpenGL(R) diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index 770b75a10..2f20bd7c0 100644 --- a/src/video_out/video_out_aa.c +++ b/src/video_out/video_out_aa.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -86,7 +86,7 @@ static uint32_t aa_get_capabilities (vo_driver_t *this) { static void aa_dispose_frame (vo_frame_t *vo_img) { aa_frame_t *frame = (aa_frame_t *)vo_img; - + if (frame->mem[0]) free (frame->mem[0]); if (frame->mem[1]) @@ -117,19 +117,19 @@ static vo_frame_t *aa_alloc_frame(vo_driver_t *this_gen) { frame->vo_frame.field = aa_frame_field; frame->vo_frame.dispose = aa_dispose_frame; frame->vo_frame.driver = this_gen; - + return (vo_frame_t*) frame; } static void aa_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, - uint32_t width, uint32_t height, + uint32_t width, uint32_t height, double ratio, int format, int flags) { aa_driver_t *this = (aa_driver_t*) this_gen; aa_frame_t *frame = (aa_frame_t *) img; /* printf ("aa_update_format...\n"); */ - if ((frame->width != width) || (frame->height != height) + if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { if (frame->mem[0]) { @@ -140,7 +140,7 @@ static void aa_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, free (frame->mem[1]); frame->mem[1] = NULL; } - + if (frame->mem[2]) { free (frame->mem[2]); frame->mem[2] = NULL; @@ -202,27 +202,27 @@ static void aa_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if (frame->format == XINE_IMGFMT_YV12) { for (y = 0; y<aa_imgheight (this->context); y++) { for (x = 0; x<aa_imgwidth (this->context); x++) { - + *img++ = src_image[((int)((double) x * x_fact) + frame->width * (int)((double) y * y_fact))]; - + } } } else { for (y = 0; y<aa_imgheight (this->context); y++) { for (x = 0; x<aa_imgwidth (this->context); x++) { - + *img++ = src_image[((int)((double) x * x_fact) * 2 + frame->width * 2 * (int)((double) y * y_fact))]; - + } } } frame->vo_frame.free (&frame->vo_frame); - aa_fastrender(this->context, 0, 0, - aa_imgwidth (this->context), + aa_fastrender(this->context, 0, 0, + aa_imgwidth (this->context), aa_imgheight (this->context)); aa_flush (this->context); @@ -231,7 +231,7 @@ static void aa_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int aa_get_property (vo_driver_t *this_gen, int property) { aa_driver_t *this = (aa_driver_t*) this_gen; - + if ( property == VO_PROP_ASPECT_RATIO) { return this->user_ratio ; } else { @@ -242,7 +242,7 @@ static int aa_get_property (vo_driver_t *this_gen, int property) { return 0; } -static int aa_set_property (vo_driver_t *this_gen, +static int aa_set_property (vo_driver_t *this_gen, int property, int value) { aa_driver_t *this = (aa_driver_t*) this_gen; @@ -259,7 +259,7 @@ static int aa_set_property (vo_driver_t *this_gen, return value; } -static void aa_get_property_min_max (vo_driver_t *this_gen, +static void aa_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { *min = 0; *max = 0; @@ -277,9 +277,9 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi aa_driver_t *this; this = (aa_driver_t*) calloc(1, sizeof(aa_driver_t)); - + this->context = (aa_context*) visual_gen; - + this->config = class->config; this->xine = class->xine; @@ -298,7 +298,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->vo_driver.dispose = aa_dispose; return &this->vo_driver; -} +} static char* get_identifier (video_driver_class_t *this_gen) { return "AA"; @@ -315,14 +315,14 @@ static void dispose_class (video_driver_class_t *this_gen) { static void *init_class (xine_t *xine, void *visual_gen) { /* aa_context *context = (aa_context*) visual_gen; */ aa_class_t *this; - + this = calloc(1, sizeof(aa_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->xine = xine; @@ -335,7 +335,7 @@ static const vo_info_t vo_info_aa = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "aa", XINE_VERSION_CODE, &vo_info_aa, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_caca.c b/src/video_out/video_out_caca.c index 65ebf707e..5a060151e 100644 --- a/src/video_out/video_out_caca.c +++ b/src/video_out/video_out_caca.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2003, 2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -93,7 +93,7 @@ static uint32_t caca_get_capabilities (vo_driver_t *this) { static void caca_dispose_frame (vo_frame_t *vo_img) { caca_frame_t *frame = (caca_frame_t *)vo_img; - + if (frame->mem[0]) free (frame->mem[0]); if (frame->mem[1]) @@ -135,17 +135,17 @@ static vo_frame_t *caca_alloc_frame(vo_driver_t *this_gen) { /* colorspace converter for this frame */ frame->yuv2rgb = this->yuv2rgb_factory->create_converter (this->yuv2rgb_factory); - + return (vo_frame_t*) frame; } static void caca_update_frame_format (vo_driver_t *this_gen, vo_frame_t *img, - uint32_t width, uint32_t height, + uint32_t width, uint32_t height, double ratio, int format, int flags) { caca_driver_t *this = (caca_driver_t*) this_gen; caca_frame_t *frame = (caca_frame_t *) img; - if ((frame->width != width) || (frame->height != height) + if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { if (frame->mem[0]) { @@ -228,7 +228,7 @@ static void caca_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int caca_get_property (vo_driver_t *this_gen, int property) { caca_driver_t *this = (caca_driver_t*) this_gen; - + if ( property == VO_PROP_ASPECT_RATIO) { return this->user_ratio; } else { @@ -239,7 +239,7 @@ static int caca_get_property (vo_driver_t *this_gen, int property) { return 0; } -static int caca_set_property (vo_driver_t *this_gen, +static int caca_set_property (vo_driver_t *this_gen, int property, int value) { caca_driver_t *this = (caca_driver_t*) this_gen; @@ -256,7 +256,7 @@ static int caca_set_property (vo_driver_t *this_gen, return value; } -static void caca_get_property_min_max (vo_driver_t *this_gen, +static void caca_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { *min = 0; *max = 0; @@ -280,7 +280,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi caca_driver_t *this; this = calloc(1, sizeof (caca_driver_t)); - + this->config = class->config; this->xine = class->xine; @@ -311,7 +311,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi caca_refresh_display(this->dp); return &this->vo_driver; -} +} static char* get_identifier (video_driver_class_t *this_gen) { return "CACA"; @@ -327,14 +327,14 @@ static void dispose_class (video_driver_class_t *this_gen) { } static void *init_class (xine_t *xine, void *visual_gen) { caca_class_t *this; - + this = calloc(1, sizeof(caca_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->xine = xine; @@ -347,7 +347,7 @@ static const vo_info_t vo_info_caca = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "caca", XINE_VERSION_CODE, &vo_info_caca, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c index 2e9874cc0..77f20a367 100644 --- a/src/video_out/video_out_directfb.c +++ b/src/video_out/video_out_directfb.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2006 the xine project and Claudio Ciccani - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -19,7 +19,7 @@ * * * DirectFB based output plugin by Claudio Ciccani <klan@directfb.org> - * + * * Based on video_out_xv.c and video_out_vidix.c. */ @@ -71,18 +71,18 @@ typedef struct directfb_frame_s { typedef struct directfb_driver_s { vo_driver_t vo_driver; - + int visual_type; uint32_t capabilities; xine_t *xine; - + directfb_frame_t *cur_frame; /* DirectFB related stuff */ IDirectFB *dfb; IDirectFBDisplayLayer *underlay; - + /* Video Layer */ IDirectFBDisplayLayer *layer; IDirectFBSurface *surface; @@ -93,23 +93,23 @@ typedef struct directfb_driver_s { DFBColorAdjustment default_cadj; int default_level; int visible; - + /* Subpicture layer */ IDirectFBDisplayLayer *spic_layer; IDirectFBSurface *spic_surface; - + /* for hardware scaling */ IDirectFBSurface *temp; int temp_frame_width; int temp_frame_height; DFBSurfacePixelFormat temp_frame_format; - + /* wheter card supports stretchblit with deinterlacing */ int hw_deinterlace; - + /* wheter to enable deinterlacing */ int deinterlace; - + /* configurable options */ int buffermode; int vsync; @@ -117,7 +117,7 @@ typedef struct directfb_driver_s { uint32_t colorkey; int flicker_filtering; int field_parity; - + #ifdef DIRECTFB_X11 /* X11 related stuff */ Display *display; @@ -126,18 +126,18 @@ typedef struct directfb_driver_s { GC gc; int depth; x11osd *xoverlay; - + void *user_data; void (*lock_display) (void *user_data); void (*unlock_display) (void *user_data); #endif int ovl_changed; - + /* screen size */ int screen_width; int screen_height; - + /* size / aspect ratio calculations */ vo_scale_t sc; @@ -162,7 +162,7 @@ typedef struct { "no-deinit-check,"\ "disable-module=linux_input,"\ "disable-module=keyboard" - + #define XDIRECTFB_OPTIONS "no-banner,"\ "no-sighandler,"\ "no-deinit-check" @@ -189,7 +189,7 @@ typedef struct { else \ XLockDisplay (this->display); \ } while (0) - + #define UNLOCK_DISPLAY() \ do { \ if (this->unlock_display) \ @@ -197,7 +197,7 @@ typedef struct { else \ XUnlockDisplay (this->display); \ } while (0) - + /*** driver functions ***/ @@ -215,11 +215,11 @@ static void directfb_frame_dispose (vo_frame_t *vo_img) { if (frame) { if (frame->surface) { - if (frame->locked) + if (frame->locked) frame->surface->Unlock (frame->surface); frame->surface->Release (frame->surface); } - + free (frame); } } @@ -230,19 +230,19 @@ static vo_frame_t *directfb_alloc_frame (vo_driver_t *this_gen) { frame = (directfb_frame_t *) calloc(1, sizeof(directfb_frame_t)); if (!frame) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_directfb: directfb_alloc_frame: out of memory\n"); return NULL; } pthread_mutex_init (&frame->vo_frame.mutex, NULL); - - frame->vo_frame.proc_slice = NULL; + + frame->vo_frame.proc_slice = NULL; frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = directfb_frame_field; + frame->vo_frame.field = directfb_frame_field; frame->vo_frame.dispose = directfb_frame_dispose; frame->vo_frame.driver = this_gen; - + return &frame->vo_frame; } @@ -253,18 +253,18 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame = (directfb_frame_t *) frame_gen; DFBSurfacePixelFormat format = (fmt == XINE_IMGFMT_YUY2) ? DSPF_YUY2 : DSPF_YV12; - + if (frame->surface == NULL || frame->width != width || frame->height != height || - frame->format != format) + frame->format != format) { DFBSurfaceDescription dsc; DFBResult ret; - + lprintf ("frame %p: format changed to %dx%d %s.\n", frame, width, height, (format == DSPF_YUY2) ? "YUY2" : "YV12"); - + if (frame->surface) { if (frame->locked) frame->surface->Unlock (frame->surface); @@ -272,26 +272,26 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, frame->surface = NULL; frame->locked = 0; } - + dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT; dsc.caps = DSCAPS_SYSTEMONLY | DSCAPS_INTERLACED; dsc.width = (width + 7) & ~7; dsc.height = (height + 1) & ~1; dsc.pixelformat = format; - + ret = this->dfb->CreateSurface (this->dfb, &dsc, &frame->surface); if (ret != DFB_OK) { DirectFBError ("IDirectFB::CreateSurface()", ret); return; } - + frame->width = width; frame->height = height; frame->format = format; - - ret = frame->surface->Lock (frame->surface, - DSLF_READ | DSLF_WRITE, + + ret = frame->surface->Lock (frame->surface, + DSLF_READ | DSLF_WRITE, (void**)&frame->vo_frame.base[0], (int *)&frame->vo_frame.pitches[0]); if (ret != DFB_OK) { @@ -299,17 +299,17 @@ static void directfb_update_frame_format (vo_driver_t *this_gen, return; } frame->locked = 1; - + if (frame->format == DSPF_YV12) { frame->vo_frame.pitches[1] = frame->vo_frame.pitches[0]/2; frame->vo_frame.pitches[2] = frame->vo_frame.pitches[0]/2; - frame->vo_frame.base[2] = frame->vo_frame.base[0] + + frame->vo_frame.base[2] = frame->vo_frame.base[0] + dsc.height * frame->vo_frame.pitches[0]; frame->vo_frame.base[1] = frame->vo_frame.base[2] + dsc.height/2 * frame->vo_frame.pitches[2]; } } - + frame->ratio = ratio; } @@ -331,7 +331,7 @@ static uint32_t directfb_colorkey_to_pixel (directfb_driver_t *this) { default: break; } - + return this->colorkey; } #endif @@ -342,11 +342,11 @@ static void directfb_clean_output_area (directfb_driver_t *this) { #ifdef DIRECTFB_X11 if (this->config.options & DLOP_DST_COLORKEY) { int i; - + LOCK_DISPLAY(); - + XSetForeground (this->display, this->gc, BlackPixel(this->display, this->screen)); - + for (i = 0; i < 4; i++) { if (this->sc.border[i].w && this->sc.border[i].h) { XFillRectangle (this->display, this->drawable, this->gc, @@ -354,18 +354,18 @@ static void directfb_clean_output_area (directfb_driver_t *this) { this->sc.border[i].w, this->sc.border[i].h); } } - + XSetForeground (this->display, this->gc, directfb_colorkey_to_pixel(this)); - XFillRectangle (this->display, this->drawable, this->gc, + XFillRectangle (this->display, this->drawable, this->gc, this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); - - + + if (this->xoverlay) { x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + XFlush (this->display); UNLOCK_DISPLAY(); @@ -384,7 +384,7 @@ static void directfb_clean_output_area (directfb_driver_t *this) { rect[i].w = MAX(this->sc.border[i].w, 0); rect[i].h = MAX(this->sc.border[i].h, 0); } - + this->surface->GetCapabilities (this->surface, &caps); if (caps & DSCAPS_DOUBLE) bufs++; @@ -392,7 +392,7 @@ static void directfb_clean_output_area (directfb_driver_t *this) { bufs++; this->surface->SetColor (this->surface, 0x00, 0x00, 0x00, 0xff); - for (i = 0; i < bufs; i++) { + for (i = 0; i < bufs; i++) { this->surface->FillRectangles (this->surface, &rect[0], 4); this->surface->Flip (this->surface, NULL, 0); } @@ -409,7 +409,7 @@ static void directfb_overlay_begin (vo_driver_t *this_gen, #ifdef DIRECTFB_X11 if (this->xoverlay) { LOCK_DISPLAY(); - x11osd_clear (this->xoverlay); + x11osd_clear (this->xoverlay); UNLOCK_DISPLAY(); } #endif @@ -419,7 +419,7 @@ static void directfb_overlay_begin (vo_driver_t *this_gen, this->spic_surface->Clear (this->spic_surface, 0, 0, 0, 0); } } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -435,28 +435,28 @@ static void directfb_subpicture_paint (directfb_driver_t *this, int xoffset; int yoffset; int x, y, i; - + memset (colors, 0, sizeof(colors)); - + xoffset = this->sc.gui_win_x+overlay->x; yoffset = this->sc.gui_win_y+overlay->y; - + clip.x1 = xoffset; clip.y1 = yoffset; clip.x2 = xoffset + overlay->width - 1; clip.y2 = yoffset + overlay->height - 1; this->spic_surface->SetClip (this->spic_surface, &clip); - + for (x = 0, y= 0, i = 0; i < overlay->num_rle; i++) { int idx = overlay->rle[i].color; int len = overlay->rle[i].len; - + while (len > 0) { clut_t color = ((clut_t *)overlay->color)[idx]; uint8_t alpha = overlay->trans[idx]; int index = idx; int width; - + if ((len+x) > overlay->width) { width = overlay->width - x; len -= width; @@ -465,7 +465,7 @@ static void directfb_subpicture_paint (directfb_driver_t *this, width = len; len = 0; } - + if ((y >= overlay->hili_top) && (y <= overlay->hili_bottom) && (x <= overlay->hili_right)) @@ -478,28 +478,28 @@ static void directfb_subpicture_paint (directfb_driver_t *this, color = ((clut_t *)overlay->hili_color)[idx]; alpha = overlay->hili_trans[idx]; index += OVL_PALETTE_SIZE; - + if (x+width-1 > overlay->hili_right) { width -= overlay->hili_right - x; len += overlay->hili_right - x; } } } - + if (alpha) { if (n_rects == MAX_RECTS || (p_index != -1 && p_index != index)) { lprintf ("flushing %d rect(s).\n", n_rects); this->spic_surface->FillRectangles (this->spic_surface, rects, n_rects); n_rects = 0; } - + if (p_index != index) { if (!colors[index].a) { YCBCR_TO_RGB (color.y, color.cb, color.cr, colors[index].r, colors[index].g, colors[index].b); colors[index].a = alpha | (alpha << 4); } - + lprintf ("color change to %02x%02x%02x%02x.\n", colors[index].a, colors[index].r, colors[index].g, colors[index].b); @@ -508,7 +508,7 @@ static void directfb_subpicture_paint (directfb_driver_t *this, colors[index].b, colors[index].a); p_index = index; } - + rects[n_rects].x = x + xoffset; rects[n_rects].y = y + yoffset; rects[n_rects].w = width; @@ -520,10 +520,10 @@ static void directfb_subpicture_paint (directfb_driver_t *this, n_rects--; rects[n_rects].h++; } - } + } n_rects++; } - + x += width; if (x == overlay->width) { if (++y == overlay->height) @@ -532,7 +532,7 @@ static void directfb_subpicture_paint (directfb_driver_t *this, } } } - + if (n_rects) { lprintf ("flushing %d remaining rect(s).\n", n_rects); this->spic_surface->FillRectangles (this->spic_surface, rects, n_rects); @@ -543,17 +543,17 @@ static void directfb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame = (directfb_frame_t *) frame_gen; - + if (!overlay->rle) return; - + if (overlay->unscaled) { if (!this->ovl_changed) return; #ifdef DIRECTFB_X11 if (this->xoverlay) { LOCK_DISPLAY(); - x11osd_blend (this->xoverlay, overlay); + x11osd_blend (this->xoverlay, overlay); UNLOCK_DISPLAY(); } #endif @@ -570,7 +570,7 @@ static void directfb_overlay_blend (vo_driver_t *this_gen, &this->alphablend_extra_data); } else { - _x_blend_yuv (frame->vo_frame.base, overlay, + _x_blend_yuv (frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); @@ -602,20 +602,20 @@ static void directfb_overlay_end (vo_driver_t *this_gen, vo_frame_t *frame_gen) static int directfb_redraw_needed (vo_driver_t *this_gen) { directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame = this->cur_frame; - + if (!frame) return 1; - - this->sc.delivered_width = frame->width; - this->sc.delivered_height = frame->height; - this->sc.delivered_ratio = frame->ratio; + + this->sc.delivered_width = frame->width; + this->sc.delivered_height = frame->height; + this->sc.delivered_ratio = frame->ratio; this->sc.crop_left = frame->vo_frame.crop_left; this->sc.crop_right = frame->vo_frame.crop_right; this->sc.crop_top = frame->vo_frame.crop_top; this->sc.crop_bottom = frame->vo_frame.crop_bottom; - + _x_vo_scale_compute_ideal_size (&this->sc); - + if (_x_vo_scale_redraw_needed (&this->sc)) { lprintf ("redraw needed.\n"); _x_vo_scale_compute_output_size (&this->sc); @@ -624,20 +624,20 @@ static int directfb_redraw_needed (vo_driver_t *this_gen) { this->layer->SetSourceRectangle (this->layer, this->sc.displayed_xoffset, this->sc.displayed_yoffset, - this->sc.displayed_width, + this->sc.displayed_width, this->sc.displayed_height ); this->layer->SetScreenRectangle (this->layer, - this->sc.gui_win_x+this->sc.output_xoffset, + this->sc.gui_win_x+this->sc.output_xoffset, this->sc.gui_win_y+this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); } - + directfb_clean_output_area (this); - + return 1; } - + return 0; } @@ -645,30 +645,30 @@ static int directfb_redraw_needed (vo_driver_t *this_gen) { static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { directfb_driver_t *this = (directfb_driver_t *) this_gen; directfb_frame_t *frame = (directfb_frame_t *) frame_gen; - + if (this->cur_frame) this->cur_frame->vo_frame.free (&this->cur_frame->vo_frame); this->cur_frame = frame; - + this->config.flags = DLCONF_NONE; - + if (frame->width != this->config.width) { this->config.flags |= DLCONF_WIDTH; this->config.width = frame->width; } - + if (frame->height != this->config.height) { this->config.flags |= DLCONF_HEIGHT; this->config.height = frame->height; } - - if (this->type & DLTF_VIDEO) { + + if (this->type & DLTF_VIDEO) { if (frame->format != this->config.pixelformat) { this->config.flags |= DLCONF_PIXELFORMAT; this->config.pixelformat = frame->format; } } - + if (this->caps & DLCAPS_DEINTERLACING) { if (this->deinterlace && !(this->config.options & DLOP_DEINTERLACING)) { @@ -681,14 +681,14 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen this->config.options &= ~DLOP_DEINTERLACING; } } - + if (this->config.flags) { DFBDisplayLayerConfigFlags failed = 0; - + lprintf ("changing layer configuration to %dx%d %s.\n", this->config.width, this->config.height, (this->config.pixelformat == DSPF_YUY2) ? "YUY2" : "YV12"); - + this->layer->TestConfiguration (this->layer, &this->config, &failed); this->config.flags &= ~failed; if (this->config.flags) { @@ -700,7 +700,7 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen lprintf ("failed=0x%08x.\n", failed); } - + if (this->sc.delivered_width != frame->width || this->sc.delivered_height != frame->height || this->sc.delivered_ratio != frame->ratio) @@ -708,9 +708,9 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen lprintf ("forcing redraw.\n"); this->sc.force_redraw = 1; } - + directfb_redraw_needed (&this->vo_driver); - + if (!this->visible) { this->layer->SetOpacity (this->layer, 0xff); this->visible = 1; @@ -720,13 +720,13 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen frame->surface->Unlock (frame->surface); frame->locked = 0; } - + if (this->deinterlace) { if (!(this->config.options & DLOP_DEINTERLACING)) { - frame->surface->SetField (frame->surface, + frame->surface->SetField (frame->surface, frame->vo_frame.top_field_first ? 0 : 1); this->surface->SetBlittingFlags (this->surface, DSBLIT_DEINTERLACE); - } + } else { this->surface->SetField (this->surface, frame->vo_frame.top_field_first ? 0 : 1); @@ -734,13 +734,13 @@ static void directfb_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen } else { this->surface->SetBlittingFlags (this->surface, DSBLIT_NOFX); } - + this->surface->Blit (this->surface, frame->surface, NULL, 0, 0); this->surface->Flip (this->surface, NULL, (this->vsync) ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC); - - frame->surface->Lock (frame->surface, - DSLF_READ | DSLF_WRITE, + + frame->surface->Lock (frame->surface, + DSLF_READ | DSLF_WRITE, (void**)&frame->vo_frame.base[0], (int *)&frame->vo_frame.pitches[0]); frame->locked = 1; @@ -753,28 +753,28 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge DFBSurfaceBlittingFlags flags; DFBRectangle s, d; DFBResult ret; - + if (this->cur_frame) this->cur_frame->vo_frame.free (&this->cur_frame->vo_frame); this->cur_frame = frame; - + /* TODO: try to change video mode when frame size changes */ - + if (this->type & DLTF_VIDEO) { if (frame->format != this->config.pixelformat) { this->config.flags = DLCONF_PIXELFORMAT; this->config.pixelformat = frame->format; - + lprintf ("changing layer pixelformat to %s.\n", (this->config.pixelformat == DSPF_YUY2) ? "YUY2" : "YV12"); - + ret = this->layer->SetConfiguration (this->layer, &this->config); this->layer->GetConfiguration (this->layer, &this->config); lprintf ("%s.\n", ret ? "failed" : "ok"); } - } - + } + if (this->temp) { /* try to reduce video memory fragmentation */ if (this->temp_frame_width < frame->width || @@ -784,27 +784,27 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge DFBSurfaceDescription dsc; lprintf ("reallocating temporary surface.\n"); - + this->temp->Release (this->temp); this->temp = NULL; - + dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT; dsc.caps = DSCAPS_INTERLACED; dsc.width = frame->width; dsc.height = frame->height; dsc.pixelformat = this->config.pixelformat; - + ret = this->dfb->CreateSurface (this->dfb, &dsc, &this->temp); if (ret != DFB_OK) DirectFBError ("IDirectFB::CreateSurface()", ret); - + this->temp_frame_width = frame->width; this->temp_frame_height = frame->height; this->temp_frame_format = this->config.pixelformat; } } - + if (this->sc.delivered_width != frame->width || this->sc.delivered_height != frame->height || this->sc.delivered_ratio != frame->ratio) @@ -812,7 +812,7 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge lprintf ("forcing redraw.\n"); this->sc.force_redraw = 1; } - + directfb_redraw_needed (&this->vo_driver); if (!this->visible) { @@ -824,24 +824,24 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge frame->surface->Unlock (frame->surface); frame->locked = 0; } - + /* source rectangle */ s.x = this->sc.displayed_xoffset; s.y = this->sc.displayed_yoffset; s.w = this->sc.displayed_width; s.h = this->sc.displayed_height; - + /* destination rectangle */ d.x = this->sc.gui_win_x+this->sc.output_xoffset; d.y = this->sc.gui_win_y+this->sc.output_yoffset; d.w = this->sc.output_width; d.h = this->sc.output_height; - + flags = (this->deinterlace) ? DSBLIT_DEINTERLACE : DSBLIT_NOFX; - + if (this->temp) { if (this->hw_deinterlace) { - this->temp->SetField (this->temp, + this->temp->SetField (this->temp, frame->vo_frame.top_field_first ? 0 : 1); this->surface->SetBlittingFlags (this->surface, flags); } @@ -850,23 +850,23 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge frame->vo_frame.top_field_first ? 0 : 1); this->temp->SetBlittingFlags (this->temp, flags); } - + this->temp->Blit (this->temp, frame->surface, &s, 0, 0); s.x = 0; s.y = 0; this->surface->StretchBlit (this->surface, this->temp, &s, &d); - } + } else { frame->surface->SetField (frame->surface, frame->vo_frame.top_field_first ? 0 : 1); this->surface->SetBlittingFlags (this->surface, flags); this->surface->StretchBlit (this->surface, frame->surface, &s, &d); } - + this->surface->Flip (this->surface, NULL, (this->vsync) ? DSFLIP_WAITFORSYNC : DSFLIP_ONSYNC); - - frame->surface->Lock (frame->surface, - DSLF_READ | DSLF_WRITE, + + frame->surface->Lock (frame->surface, + DSLF_READ | DSLF_WRITE, (void**)&frame->vo_frame.base[0], (int *)&frame->vo_frame.pitches[0]); frame->locked = 1; @@ -874,48 +874,48 @@ static void directfb_display_frame2 (vo_driver_t *this_gen, vo_frame_t *frame_ge static int directfb_get_property (vo_driver_t *this_gen, int property) { directfb_driver_t *this = (directfb_driver_t *) this_gen; - + switch (property) { case VO_PROP_INTERLACED: return this->deinterlace; - + case VO_PROP_ASPECT_RATIO: return this->sc.user_ratio; - + case VO_PROP_HUE: if (this->caps & DLCAPS_HUE) return this->cadj.hue; break; - + case VO_PROP_SATURATION: if (this->caps & DLCAPS_SATURATION) return this->cadj.saturation; break; - + case VO_PROP_CONTRAST: if (this->caps & DLCAPS_CONTRAST) return this->cadj.contrast; break; - + case VO_PROP_BRIGHTNESS: if (this->caps & DLCAPS_BRIGHTNESS) return this->cadj.brightness; break; - + case VO_PROP_COLORKEY: if (this->caps & DLCAPS_DST_COLORKEY) return this->colorkey; break; - + case VO_PROP_ZOOM_X: return this->sc.zoom_factor_x * XINE_VO_ZOOM_STEP; - + case VO_PROP_ZOOM_Y: return this->sc.zoom_factor_y * XINE_VO_ZOOM_STEP; - + case VO_PROP_WINDOW_WIDTH: return this->sc.gui_width; - + case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; @@ -925,21 +925,21 @@ static int directfb_get_property (vo_driver_t *this_gen, int property) { default: break; } - + return 0; } -static int directfb_set_property (vo_driver_t *this_gen, +static int directfb_set_property (vo_driver_t *this_gen, int property, int value) { directfb_driver_t *this = (directfb_driver_t *) this_gen; - + switch (property) { case VO_PROP_INTERLACED: xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_directfb: deinterlacing set to %d.\n", value); this->deinterlace = value; break; - + case VO_PROP_ASPECT_RATIO: if (value >= XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_NUM_RATIOS-1; @@ -950,7 +950,7 @@ static int directfb_set_property (vo_driver_t *this_gen, _x_vo_scale_compute_ideal_size (&this->sc); this->sc.force_redraw = 1; break; - + case VO_PROP_HUE: if (this->caps & DLCAPS_HUE) { if (value > 0xffff) @@ -962,7 +962,7 @@ static int directfb_set_property (vo_driver_t *this_gen, this->layer->SetColorAdjustment (this->layer, &this->cadj); } break; - + case VO_PROP_SATURATION: if (this->caps & DLCAPS_SATURATION) { if (value > 0xffff) @@ -974,7 +974,7 @@ static int directfb_set_property (vo_driver_t *this_gen, this->layer->SetColorAdjustment (this->layer, &this->cadj); } break; - + case VO_PROP_CONTRAST: if (this->caps & DLCAPS_CONTRAST) { if (value > 0xffff) @@ -986,7 +986,7 @@ static int directfb_set_property (vo_driver_t *this_gen, this->layer->SetColorAdjustment (this->layer, &this->cadj); } break; - + case VO_PROP_BRIGHTNESS: if (this->caps & DLCAPS_BRIGHTNESS) { if (value > 0xffff) @@ -998,7 +998,7 @@ static int directfb_set_property (vo_driver_t *this_gen, this->layer->SetColorAdjustment (this->layer, &this->cadj); } break; - + case VO_PROP_COLORKEY: if (this->caps & DLCAPS_DST_COLORKEY) { if (value > 0xffffff) @@ -1012,7 +1012,7 @@ static int directfb_set_property (vo_driver_t *this_gen, directfb_clean_output_area (this); } break; - + case VO_PROP_ZOOM_X: if (value >= XINE_VO_ZOOM_MIN && value <= XINE_VO_ZOOM_MAX) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, @@ -1022,7 +1022,7 @@ static int directfb_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; } break; - + case VO_PROP_ZOOM_Y: if (value >= XINE_VO_ZOOM_MIN && value <= XINE_VO_ZOOM_MAX) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, @@ -1032,29 +1032,29 @@ static int directfb_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; } break; - + default: break; - } - + } + return value; } static void directfb_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { directfb_driver_t *this = (directfb_driver_t *) this_gen; - + switch (property) { case VO_PROP_INTERLACED: *min = 0; *max = 1; return; - + case VO_PROP_ASPECT_RATIO: - *min = 0; + *min = 0; *max = XINE_VO_ASPECT_NUM_RATIOS-1; return; - + case VO_PROP_HUE: if (this->caps & DLCAPS_HUE) { *min = 0x0000; @@ -1062,7 +1062,7 @@ static void directfb_get_property_min_max (vo_driver_t *this_gen, return; } break; - + case VO_PROP_SATURATION: if (this->caps & DLCAPS_SATURATION) { *min = 0x0000; @@ -1070,7 +1070,7 @@ static void directfb_get_property_min_max (vo_driver_t *this_gen, return; } break; - + case VO_PROP_CONTRAST: if (this->caps & DLCAPS_CONTRAST) { *min = 0x0000; @@ -1078,7 +1078,7 @@ static void directfb_get_property_min_max (vo_driver_t *this_gen, return; } break; - + case VO_PROP_BRIGHTNESS: if (this->caps & DLCAPS_BRIGHTNESS) { *min = 0x0000; @@ -1086,7 +1086,7 @@ static void directfb_get_property_min_max (vo_driver_t *this_gen, return; } break; - + case VO_PROP_COLORKEY: if (this->caps & DLCAPS_DST_COLORKEY) { *min = 0x000000; @@ -1094,25 +1094,25 @@ static void directfb_get_property_min_max (vo_driver_t *this_gen, return; } break; - + case VO_PROP_ZOOM_X: case VO_PROP_ZOOM_Y: *min = XINE_VO_ZOOM_MIN; *max = XINE_VO_ZOOM_MAX; return; - + default: break; } - + *min = 0; *max = 0; } -static int directfb_gui_data_exchange (vo_driver_t *this_gen, +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; - + switch (data_type) { case XINE_GUI_SEND_DRAWABLE_CHANGED: lprintf ("drawable changed.\n"); @@ -1126,11 +1126,11 @@ static int directfb_gui_data_exchange (vo_driver_t *this_gen, if (this->xoverlay) { x11osd_drawable_changed (this->xoverlay, this->drawable); this->ovl_changed = 1; - } + } UNLOCK_DISPLAY(); this->sc.force_redraw = 1; } -#endif +#endif directfb_clean_output_area (this); break; @@ -1148,13 +1148,13 @@ static int directfb_gui_data_exchange (vo_driver_t *this_gen, #endif directfb_clean_output_area (this); break; - + case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: { int x1, y1, x2, y2; x11_rectangle_t *rect = data; - + _x_vo_scale_translate_gui2video (&this->sc, - rect->x, rect->y, + rect->x, rect->y, &x1, &y1); _x_vo_scale_translate_gui2video (&this->sc, rect->x + rect->w, rect->y + rect->h, @@ -1164,11 +1164,11 @@ static int directfb_gui_data_exchange (vo_driver_t *this_gen, rect->w = x2-x1; rect->h = y2-y1; } break; - + default: return -1; } - + return 0; } @@ -1177,7 +1177,7 @@ static void directfb_dispose (vo_driver_t *this_gen) { if (this->cur_frame) this->cur_frame->vo_frame.dispose (&this->cur_frame->vo_frame); - + #ifdef DIRECTFB_X11 if (this->visual_type == XINE_VISUAL_TYPE_X11 || this->visual_type == XINE_VISUAL_TYPE_X11_2) { @@ -1191,25 +1191,25 @@ static void directfb_dispose (vo_driver_t *this_gen) { if (this->temp) this->temp->Release (this->temp); - + if (this->spic_surface) this->spic_surface->Release (this->spic_surface); - + if (this->spic_layer) this->spic_layer->Release (this->spic_layer); - + if (this->surface) this->surface->Release (this->surface); - + if (this->layer) { this->layer->SetColorAdjustment (this->layer, &this->default_cadj); this->layer->SetLevel (this->layer, this->default_level); this->layer->Release (this->layer); } - + if (this->underlay) this->underlay->Release (this->underlay); - + if (this->dfb) this->dfb->Release (this->dfb); @@ -1222,12 +1222,12 @@ static void directfb_dispose (vo_driver_t *this_gen) { static void update_config_cb (void *data, xine_cfg_entry_t *entry) { directfb_driver_t *this = (directfb_driver_t *) data; - + lprintf ("update_config_cb(%s).\n", entry->key); - + if (strcmp (entry->key, "video.device.directfb_buffermode") == 0) { DFBDisplayLayerConfig config = { .flags = DLCONF_BUFFERMODE }; - + switch (entry->num_value) { case 0: config.buffermode = DLBM_FRONTONLY; @@ -1239,46 +1239,46 @@ static void update_config_cb (void *data, xine_cfg_entry_t *entry) { config.buffermode = DLBM_BACKVIDEO; break; } - + if (config.buffermode != this->config.buffermode) { if (this->layer->SetConfiguration (this->layer, &config ) != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, - "video_out_directfb: failed to set buffermode to %d!\n", + "video_out_directfb: failed to set buffermode to %d!\n", entry->num_value); return; } - + this->layer->GetConfiguration (this->layer, &this->config); } } else if (strcmp (entry->key, "video.device.directfb_colorkeying") == 0) { DFBDisplayLayerConfig config = { .flags = DLCONF_OPTIONS }; - + if (entry->num_value) config.options = this->config.options | DLOP_DST_COLORKEY; else config.options = this->config.options & ~DLOP_DST_COLORKEY; - + if (config.options != this->config.options) { if (this->layer->SetConfiguration (this->layer, &config) != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, - "video_out_directfb: failed to set colour keying to %d!\n", + "video_out_directfb: failed to set colour keying to %d!\n", entry->num_value); return; } - + this->layer->GetConfiguration (this->layer, &this->config); directfb_clean_output_area (this); } - } + } else if (strcmp (entry->key, "video.device.directfb_colorkey") == 0) { this->colorkey = entry->num_value; this->layer->SetDstColorKey (this->layer, (this->colorkey & 0xff0000) >> 16, (this->colorkey & 0x00ff00) >> 8, - (this->colorkey & 0x0000ff) >> 0); + (this->colorkey & 0x0000ff) >> 0); #ifdef DIRECTFB_X11 if (this->xoverlay) { - x11osd_colorkey (this->xoverlay, + x11osd_colorkey (this->xoverlay, directfb_colorkey_to_pixel(this), &this->sc); } #endif @@ -1286,52 +1286,52 @@ static void update_config_cb (void *data, xine_cfg_entry_t *entry) { } else if (strcmp (entry->key, "video.device.directfb_flicker_filtering") == 0) { DFBDisplayLayerConfig config = { .flags = DLCONF_OPTIONS }; - + if (entry->num_value) config.options = this->config.options | DLOP_FLICKER_FILTERING; else config.options = this->config.options & ~DLOP_FLICKER_FILTERING; - + if (config.options != this->config.options) { if (this->layer->SetConfiguration (this->layer, &config) != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, - "video_out_directfb: failed to set flicker_filtering to %d!\n", + "video_out_directfb: failed to set flicker_filtering to %d!\n", entry->num_value); return; } - + this->layer->GetConfiguration (this->layer, &this->config); } } else if (strcmp (entry->key, "video.device.directfb_field_parity") == 0) { DFBDisplayLayerConfig config = { .flags = DLCONF_OPTIONS }; - + if (entry->num_value) config.options = this->config.options | DLOP_FIELD_PARITY; else config.options = this->config.options & ~DLOP_FIELD_PARITY; - + if (config.options != this->config.options) { if (this->layer->SetConfiguration (this->layer, &config) != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, - "video_out_directfb: failed to set field_parity to %d!\n", + "video_out_directfb: failed to set field_parity to %d!\n", entry->num_value); return; } - + this->layer->GetConfiguration (this->layer, &this->config); - } + } } else if (strcmp (entry->key, "video.device.directfb_vsync") == 0) { this->vsync = entry->num_value; } } - + static void init_config (directfb_driver_t *this) { config_values_t *config = this->xine->config; static const char *buffermode_enum[] = {"single", "double", "triple", 0}; static const char *fieldparity_enum[] = {"none", "top", "bottom", 0}; - + this->buffermode = config->register_enum (config, "video.device.directfb_buffermode", this->buffermode, (char**)buffermode_enum, _("video layer buffering mode"), @@ -1339,14 +1339,14 @@ static void init_config (directfb_driver_t *this) { "Double or triple buffering give a smoother playback, " "but consume more video memory."), 10, update_config_cb, (void *)this); - + this->vsync = config->register_bool (config, "video.device.directfb_vsync", this->vsync, _("wait for vertical retrace"), _("Enable synchronizing the update of the video image to the " "repainting of the entire screen (\"vertical retrace\")."), 10, update_config_cb, (void *)this); - + if (this->caps & DLCAPS_DST_COLORKEY) { this->colorkeying = config->register_bool (config, "video.device.directfb_colorkeying", this->colorkeying, @@ -1354,7 +1354,7 @@ static void init_config (directfb_driver_t *this) { _("Enable using a colour key to tell the graphics card " "where to overlay the video image."), 20, update_config_cb, (void *)this); - + this->colorkey = config->register_range (config, "video.device.directfb_colorkey", this->colorkey, 0, 0xffffff, _("video colour key"), @@ -1363,7 +1363,7 @@ static void init_config (directfb_driver_t *this) { "if you experience windows becoming transparent."), 10, update_config_cb, (void *)this); } - + if (this->caps & DLCAPS_FLICKER_FILTERING) { this->flicker_filtering = config->register_bool( config, "video.device.directfb_flicker_filtering", this->flicker_filtering, @@ -1371,7 +1371,7 @@ static void init_config (directfb_driver_t *this) { _("Enable Flicker Filetring for a smooth output on an interlaced display."), 10, update_config_cb, (void *)this); } - + if (this->caps & DLCAPS_FIELD_PARITY) { this->field_parity = config->register_enum( config, "video.device.directfb_field_parity", this->field_parity, (char**)fieldparity_enum, @@ -1385,7 +1385,7 @@ static void init_config (directfb_driver_t *this) { static DFBEnumerationResult find_overlay (DFBDisplayLayerID id, DFBDisplayLayerDescription dsc, void *ctx) { DFBDisplayLayerID *ret_id = (DFBDisplayLayerID *) ctx; - + if (dsc.type & DLTF_VIDEO && dsc.caps & DLCAPS_SURFACE && dsc.caps & DLCAPS_SCREEN_LOCATION) { @@ -1393,27 +1393,27 @@ static DFBEnumerationResult find_overlay (DFBDisplayLayerID id, *ret_id = id; return DFENUM_CANCEL; } - + return DFENUM_OK; } static DFBEnumerationResult find_underlay (DFBDisplayLayerID id, DFBDisplayLayerDescription dsc, void *ctx) { DFBDisplayLayerID *ret_id = (DFBDisplayLayerID *) ctx; - + if (dsc.caps & DLCAPS_SURFACE) { lprintf ("underlay's id = %d.\n", id); *ret_id = id; return DFENUM_CANCEL; } - + return DFENUM_OK; } static DFBEnumerationResult find_subpicture (DFBDisplayLayerID id, DFBDisplayLayerDescription dsc, void *ctx) { DFBDisplayLayerID *ret_id = (DFBDisplayLayerID *) ctx; - + if (id != DLID_PRIMARY && dsc.caps & DLCAPS_SURFACE && dsc.caps & DLCAPS_ALPHACHANNEL) { @@ -1421,33 +1421,33 @@ static DFBEnumerationResult find_subpicture (DFBDisplayLayerID id, *ret_id = id; return DFENUM_CANCEL; } - + return DFENUM_OK; } static void init_subpicture (directfb_driver_t *this) { DFBResult ret; - + /* subpicture layer supported by Unichrome and Radeon */ if (this->caps & DLCAPS_LEVELS && this->underlay) { DFBDisplayLayerDescription dsc; - + this->underlay->GetDescription (this->underlay, &dsc); if (dsc.caps & DLCAPS_ALPHACHANNEL) { DFBDisplayLayerConfig config; - - /* enable alphachannel on the underlay */ + + /* enable alphachannel on the underlay */ config.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS; config.pixelformat = DSPF_ARGB; config.options = DLOP_ALPHACHANNEL; - + ret = this->underlay->SetConfiguration (this->underlay, &config); if (ret) { /* try AiRGB if the previous failed */ - config.pixelformat = DSPF_AiRGB; + config.pixelformat = DSPF_AiRGB; ret = this->underlay->SetConfiguration (this->underlay, &config); } - + if (ret == DFB_OK) { this->underlay->AddRef (this->underlay); this->spic_layer = this->underlay; @@ -1456,33 +1456,33 @@ static void init_subpicture (directfb_driver_t *this) { } } } -#if 0 +#if 0 /* most common type of supicture layer */ if (!this->spic_layer) { IDirectFBScreen *screen; DFBDisplayLayerID video_id, id = -1; - + this->layer->GetID (this->layer, &video_id); - + if (this->layer->GetScreen (this->layer, &screen) == DFB_OK) { screen->EnumDisplayLayers (screen, find_subpicture, (void *)&id); screen->Release (screen); } - - if (id != -1 && id != video_id) { + + if (id != -1 && id != video_id) { ret = this->dfb->GetDisplayLayer (this->dfb, id, &this->spic_layer); if (ret == DFB_OK) { DFBDisplayLayerConfig config; - + this->spic_layer->GetConfiguration (this->spic_layer, &config); - + config.flags = DLCONF_OPTIONS; config.options = DLOP_ALPHACHANNEL; if (!DFB_PIXELFORMAT_HAS_ALPHA(config.pixelformat)) { config.flags |= DLCONF_PIXELFORMAT; config.pixelformat = DSPF_ALUT44; } - + ret = this->spic_layer->SetConfiguration (this->spic_layer, &config); if (ret) { lprintf ("failed to set subpicture layer configuration!\n"); @@ -1495,7 +1495,7 @@ static void init_subpicture (directfb_driver_t *this) { } } } -#endif +#endif if (this->spic_layer) { ret = this->spic_layer->GetSurface (this->spic_layer, &this->spic_surface); if (ret) { @@ -1504,10 +1504,10 @@ static void init_subpicture (directfb_driver_t *this) { this->spic_layer = NULL; return; } - + this->spic_surface->Clear (this->spic_surface, 0, 0, 0, 0); this->spic_surface->Flip (this->spic_surface, NULL, 0); - + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: using hardware subpicture acceleration.\n")); } @@ -1520,18 +1520,18 @@ static DFBResult init_device (directfb_driver_t *this) { DFBResult ret; config.flags = DLCONF_NONE; - + if (this->type & DLTF_VIDEO) { xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: layer supports video output.\n")); config.flags |= DLCONF_PIXELFORMAT; - + /* test for YV12 support */ config.pixelformat = DSPF_YV12; ret = this->layer->TestConfiguration (this->layer, &config, NULL); if (ret) { - xprintf (this->xine, XINE_VERBOSITY_LOG, + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: layer doesn't support YV12!\n")); /* test for YUY2 support */ @@ -1546,7 +1546,7 @@ static DFBResult init_device (directfb_driver_t *this) { } } } - + #if DIRECTFB_VERSION_CODE < VERSION_CODE(0,9,25) if (!(this->type & DLTF_VIDEO)) { xprintf (this->xine, XINE_VERBOSITY_LOG, @@ -1554,12 +1554,12 @@ static DFBResult init_device (directfb_driver_t *this) { "need at least DirectFB 0.9.25 to play on this layer!\n")); return DFB_UNSUPPORTED; } -#endif - +#endif + /* set layer configuration */ config.flags |= DLCONF_BUFFERMODE | DLCONF_OPTIONS; config.options = DLOP_NONE; - + switch (this->buffermode) { case 0: config.buffermode = DLBM_FRONTONLY; @@ -1571,22 +1571,22 @@ static DFBResult init_device (directfb_driver_t *this) { config.buffermode = DLBM_BACKVIDEO; break; } - + if (this->colorkeying) config.options |= DLOP_DST_COLORKEY; - + if (this->flicker_filtering) config.options |= DLOP_FLICKER_FILTERING; - + if (this->field_parity) config.options |= DLOP_FIELD_PARITY; - + /* test current configuration */ ret = this->layer->TestConfiguration (this->layer, &config, &failed); if (failed & DLCONF_BUFFERMODE) { xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: layer doesn't support buffermode %d!\n"), - this->buffermode); + this->buffermode); config.flags &= ~DLCONF_BUFFERMODE; } if (failed & DLCONF_OPTIONS) { @@ -1595,7 +1595,7 @@ static DFBResult init_device (directfb_driver_t *this) { config.options); config.flags &= ~DLCONF_OPTIONS; } - + ret = this->layer->SetConfiguration (this->layer, &config); /* this should never happen */ if (ret) { @@ -1603,31 +1603,31 @@ static DFBResult init_device (directfb_driver_t *this) { return ret; } - this->layer->GetConfiguration (this->layer, &this->config); - + this->layer->GetConfiguration (this->layer, &this->config); + if (this->caps & DLCAPS_DST_COLORKEY) { this->layer->SetDstColorKey (this->layer, (this->colorkey & 0xff0000) >> 16, (this->colorkey & 0x00ff00) >> 8, (this->colorkey & 0x0000ff) >> 0); } - + if (this->field_parity) this->layer->SetFieldParity (this->layer, this->field_parity-1); - + /* get current color cadjustment */ this->layer->GetColorAdjustment (this->layer, &this->default_cadj); this->cadj = this->default_cadj; - + /* get current level */ this->layer->GetLevel (this->layer, &this->default_level); - + /* retrieve layer's surface */ ret = this->layer->GetSurface (this->layer, &surface); if (ret != DFB_OK) { DirectFBError ("IDirectFBDisplayLayer::GetSurface()", ret); return ret; } - + /* clear surface buffers */ surface->Clear (surface, 0x00, 0x00, 0x00, 0xff); surface->Flip (surface, NULL, 0); @@ -1635,33 +1635,33 @@ static DFBResult init_device (directfb_driver_t *this) { surface->Flip (surface, NULL, 0); surface->Clear (surface, 0x00, 0x00, 0x00, 0xff); surface->Flip (surface, NULL, 0); - + this->surface = surface; - - if (this->caps & DLCAPS_SCREEN_LOCATION) { + + if (this->caps & DLCAPS_SCREEN_LOCATION) { IDirectFBScreen *screen = NULL; DFBDisplayLayerID id = -1; this->screen_width = 640; this->screen_height = 480; - + this->layer->GetScreen (this->layer, &screen); if (screen) { screen->EnumDisplayLayers (screen, find_underlay, (void *)&id); screen->Release (screen); } - + this->dfb->GetDisplayLayer (this->dfb, id, &this->underlay); - if (this->underlay) { + if (this->underlay) { this->underlay->GetConfiguration (this->underlay, &config); this->screen_width = config.width; this->screen_height = config.height; - + if (this->visual_type == XINE_VISUAL_TYPE_FB) { this->underlay->SetCooperativeLevel (this->underlay, DLSCL_EXCLUSIVE); this->underlay->SetConfiguration (this->underlay, &config); } - } + } } else { /* playing to underlay, @@ -1669,42 +1669,42 @@ static DFBResult init_device (directfb_driver_t *this) { IDirectFBSurface *temp; DFBSurfaceDescription dsc; DFBAccelerationMask mask = DFXL_NONE; - + this->layer->AddRef (this->layer); this->underlay = this->layer; - + dsc.flags = DSDESC_CAPS | DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT; dsc.caps = DSCAPS_INTERLACED; dsc.width = 320; dsc.height = 240; dsc.pixelformat = this->config.pixelformat; - + if (this->dfb->CreateSurface (this->dfb, &dsc, &temp) == DFB_OK) { this->surface->GetAccelerationMask (this->surface, temp, &mask); - + if (mask & DFXL_STRETCHBLIT) { xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: " "using hardware accelerated image scaling.\n")); this->temp = temp; - + /* check if stretchblit with deinterlacing is supported */ this->surface->SetBlittingFlags (this->surface, DSBLIT_DEINTERLACE); this->surface->GetAccelerationMask (this->surface, temp, &mask); this->surface->SetBlittingFlags (this->surface, DSBLIT_NOFX); - + this->hw_deinterlace = (mask & DFXL_STRETCHBLIT) ? 1 : 0; if (this->hw_deinterlace) { xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: " "image scaling with deinterlacing is hardware accelerated.\n")); } - + /* used to decide reallocation */ temp->GetSize (temp, &this->temp_frame_width, &this->temp_frame_height); temp->GetPixelFormat (temp, &this->temp_frame_format); - } + } else temp->Release (temp); } @@ -1714,11 +1714,11 @@ static DFBResult init_device (directfb_driver_t *this) { } xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "video_out_directfb: screen size is %dx%d.\n", + "video_out_directfb: screen size is %dx%d.\n", this->screen_width, this->screen_height); - + return DFB_OK; -} +} static void directfb_frame_output_cb (void *user_data, int video_width, int video_height, double video_pixel_aspect, int *dest_x, int *dest_y, @@ -1736,7 +1736,7 @@ static void directfb_frame_output_cb (void *user_data, int video_width, int vide *win_y = 0; } -/*** DirectFB plugin functions ***/ +/*** DirectFB plugin functions ***/ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void *visual_gen) { directfb_class_t *class = (directfb_class_t *) class_gen; @@ -1752,18 +1752,18 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void this = calloc(1, sizeof(directfb_driver_t)); if (!this) return NULL; - + this->visual_type = XINE_VISUAL_TYPE_FB; this->xine = class->xine; - - /* initialize DirectFB */ + + /* initialize DirectFB */ ret = DirectFBInit (&argn, &argp); if (ret != DFB_OK) { DirectFBError ("DirectFBInit()", ret); free (this); return NULL; } - + /* create the main interface or retrieve an already existing one */ ret = DirectFBCreate (&this->dfb); if (ret != DFB_OK) { @@ -1771,7 +1771,7 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void free (this); return NULL; } - + /* allow user/application to select a different layer */ id = config->register_num (config, "video.device.directfb_layer_id", -1, @@ -1780,7 +1780,7 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void 20, NULL, 0); if (id == -1) { IDirectFBScreen *screen; - + /* retrieve an interface to the current screen */ ret = this->dfb->GetScreen (this->dfb, DSCID_PRIMARY, &screen); if (ret != DFB_OK) { @@ -1789,7 +1789,7 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void free (this); return NULL; } - + /* find an overlay layer on the current screen */ id = DLID_PRIMARY; screen->EnumDisplayLayers (screen, find_overlay, (void*)&id); @@ -1798,11 +1798,11 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: using display layer #%d.\n"), id); - + ret = this->dfb->GetDisplayLayer (this->dfb, id, &this->layer); if (ret == DFB_OK) { DFBDisplayLayerDescription dsc; - this->layer->SetCooperativeLevel (this->layer, DLSCL_EXCLUSIVE); + this->layer->SetCooperativeLevel (this->layer, DLSCL_EXCLUSIVE); this->layer->SetOpacity (this->layer, 0x00); this->layer->GetDescription (this->layer, &dsc); this->type = dsc.type; @@ -1816,7 +1816,7 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void free (this); return NULL; } - + this->capabilities = VO_CAP_YV12 | VO_CAP_YUY2 | VO_CAP_CROP; /* set default configuration */ this->buffermode = 1; // double @@ -1825,7 +1825,7 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void this->colorkey = DEFAULT_COLORKEY; this->flicker_filtering = 0; this->field_parity = 0; - + /* get user configuration */ init_config (this); @@ -1836,19 +1836,19 @@ static vo_driver_t *open_plugin_fb (video_driver_class_t *class_gen, const void free (this); return NULL; } - + /* initialize subpicture layer (if available) */ init_subpicture (this); if (this->spic_layer) this->capabilities |= VO_CAP_UNSCALED_OVERLAY; _x_alphablend_init (&this->alphablend_extra_data, this->xine); - + _x_vo_scale_init (&this->sc, 1, 0, this->xine->config); this->sc.user_ratio = XINE_VO_ASPECT_AUTO; this->sc.gui_width = this->screen_width; - this->sc.gui_height = this->screen_height; - + this->sc.gui_height = this->screen_height; + if (visual) { this->sc.frame_output_cb = visual->frame_output_cb; this->sc.user_data = visual->user_data; @@ -1938,18 +1938,18 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void this = calloc(1, sizeof(directfb_driver_t)); if (!this) return NULL; - + this->visual_type = class->visual_type; this->xine = class->xine; - - /* initialize DirectFB */ + + /* initialize DirectFB */ ret = DirectFBInit (&argn, &argp); if (ret != DFB_OK) { DirectFBError ("DirectFBInit()", ret); free (this); return NULL; } - + /* create the main interface or retrieve an already existing one */ ret = DirectFBCreate (&this->dfb); if (ret != DFB_OK) { @@ -1957,7 +1957,7 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void free (this); return NULL; } - + /* retrieve an interface to the current screen */ ret = this->dfb->GetScreen (this->dfb, DSCID_PRIMARY, &screen); if (ret != DFB_OK) { @@ -1966,7 +1966,7 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void free (this); return NULL; } - + /* find an overlay layer on the current screen */ ret = screen->EnumDisplayLayers (screen, find_overlay, (void*)&id); screen->Release (screen); @@ -1976,7 +1976,7 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void free (this); return NULL; } - + if (id != DLID_PRIMARY) { DFBDisplayLayerDescription dsc; /* get overlay access */ @@ -1997,7 +1997,7 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void this->layer = NULL; } } - + if (!this->layer) { xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: no usable display layer was found!\n")); @@ -2005,10 +2005,10 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void free (this); return NULL; } - + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_directfb: using display layer #%d.\n"), id); - + this->capabilities = VO_CAP_YV12 | VO_CAP_YUY2 | VO_CAP_CROP; /* set default configuration */ this->buffermode = 1; // double @@ -2017,7 +2017,7 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void this->colorkey = DEFAULT_COLORKEY; this->flicker_filtering = 0; this->field_parity = 0; - + /* get user configuration */ init_config (this); @@ -2028,42 +2028,42 @@ static vo_driver_t *open_plugin_x11 (video_driver_class_t *class_gen, const void free (this); return NULL; } - + this->display = visual->display; this->screen = visual->screen; this->drawable = visual->d; this->gc = XCreateGC (this->display, this->drawable, 0, NULL); - + XGetWindowAttributes (this->display, this->drawable, &attrs); this->depth = attrs.depth; _x_alphablend_init (&this->alphablend_extra_data, this->xine); - + _x_vo_scale_init (&this->sc, 1, 0, this->xine->config); this->sc.user_ratio = XINE_VO_ASPECT_AUTO; this->sc.gui_width = attrs.width; this->sc.gui_height = attrs.height; this->sc.frame_output_cb = visual->frame_output_cb; this->sc.user_data = visual->user_data; - + if (this->visual_type == XINE_VISUAL_TYPE_X11_2) { this->user_data = visual->user_data; this->lock_display = visual->lock_display; this->unlock_display = visual->unlock_display; - } - + } + if (this->colorkeying) { this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable, X11OSD_COLORKEY); if (this->xoverlay) { - x11osd_colorkey (this->xoverlay, + x11osd_colorkey (this->xoverlay, directfb_colorkey_to_pixel(this), &this->sc); } } else { this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable, X11OSD_SHAPED); } - + if (this->xoverlay) this->capabilities |= VO_CAP_UNSCALED_OVERLAY; @@ -2112,13 +2112,13 @@ static void *init_class_x11 (xine_t *xine, void *visual_gen) { "video_out_directfb: %s!\n", error); return NULL; } - + if (!visual) { xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_directfb: x11 visual is required!\n"); return NULL; } - + /* check if we are running under XDirectFB */ if (strcmp (XServerVendor (visual->display), "Denis Oliver Kropp")) return NULL; @@ -2141,7 +2141,7 @@ static void *init_class_x11_2 (xine_t *xine, void *visual_gen) { this = init_class_x11( xine, visual_gen ); if (this) this->visual_type = XINE_VISUAL_TYPE_X11_2; - + return this; } diff --git a/src/video_out/video_out_directfb_fb.c b/src/video_out/video_out_directfb_fb.c index b904407c3..bb01c187b 100644 --- a/src/video_out/video_out_directfb_fb.c +++ b/src/video_out/video_out_directfb_fb.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2007 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/video_out/video_out_directfb_x.c b/src/video_out/video_out_directfb_x.c index 48f709eae..78aaa9588 100644 --- a/src/video_out/video_out_directfb_x.c +++ b/src/video_out/video_out_directfb_x.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2007 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index 3c6f6e784..8cb72238a 100644 --- a/src/video_out/video_out_directx.c +++ b/src/video_out/video_out_directx.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2005 the xine project - * + * * This file is part of xine, a unix video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -118,7 +118,7 @@ typedef struct { LPDIRECTDRAW ddobj; /* direct draw object */ LPDIRECTDRAWSURFACE primary; /* primary dd surface */ - LPDIRECTDRAWSURFACE secondary; /* secondary dd surface */ + LPDIRECTDRAWSURFACE secondary; /* secondary dd surface */ LPDIRECTDRAWCLIPPER ddclipper; /* dd clipper object */ uint8_t * contents; /* secondary contents */ win32_frame_t *current; /* current frame */ @@ -151,7 +151,7 @@ typedef struct { * * ----------------------------------------- */ -/* Display formatted error message in +/* Display formatted error message in * popup message box.*/ static void Error( HWND hwnd, LPSTR szfmt, ... ) @@ -169,7 +169,7 @@ static void UpdateRect( win32_visual_t * win32_visual ) { if( win32_visual->FullScreen ) { - SetRect( &win32_visual->WndRect, 0, 0, + SetRect( &win32_visual->WndRect, 0, 0, GetSystemMetrics( SM_CXSCREEN ), GetSystemMetrics( SM_CYSCREEN ) ); } @@ -181,12 +181,12 @@ static void UpdateRect( win32_visual_t * win32_visual ) } } -/* Create our direct draw object, primary +/* Create our direct draw object, primary * surface and clipper object. * - * NOTE : The primary surface is more or + * NOTE : The primary surface is more or * less a viewport into the parent desktop - * window and will always have a pixel format + * window and will always have a pixel format * identical to the current display mode. */ static boolean CreatePrimary( win32_driver_t * win32_driver ) @@ -276,7 +276,7 @@ static boolean CreatePrimary( win32_driver_t * win32_driver ) } /* Create our secondary ( off screen ) buffer. - * The optimal secondary buffer is a h/w + * The optimal secondary buffer is a h/w * overlay with the same pixel format as the * xine frame type. However, since this is * not always supported by the host h/w, @@ -327,7 +327,7 @@ static boolean CreateSecondary( win32_driver_t * win32_driver, int width, int he /* the requested format is XINE_IMGFMT_YV12 */ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; ddsd.ddpfPixelFormat.dwYUVBitCount = 16; @@ -343,7 +343,7 @@ static boolean CreateSecondary( win32_driver_t * win32_driver, int width, int he /* the requested format is XINE_IMGFMT_YUY2 */ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; ddsd.ddpfPixelFormat.dwYUVBitCount = 16; @@ -360,7 +360,7 @@ static boolean CreateSecondary( win32_driver_t * win32_driver, int width, int he /* the requested format is IMGFMT_RGB */ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; ddsd.ddpfPixelFormat.dwYUVBitCount = 24; @@ -371,7 +371,7 @@ static boolean CreateSecondary( win32_driver_t * win32_driver, int width, int he lprintf("CreateSecondary() - act_format = (RGB) %d\n", IMGFMT_RGB); win32_driver->act_format = IMGFMT_RGB; - } + } #endif /* RGB_SUPPORT */ lprintf("CreateSecondary() - IDirectDraw_CreateSurface()\n"); @@ -423,7 +423,7 @@ static void Destroy( win32_driver_t * win32_driver ) IDirectDraw_Release( win32_driver->ddobj ); _x_alphablend_free(&win32_driver->alphablend_extra_data); - + free( win32_driver ); } @@ -447,7 +447,7 @@ static boolean CheckPixelFormat( win32_driver_t * win32_driver ) Error( 0, "IDirectDrawSurface_GetPixelFormat ( CheckPixelFormat ) : error 0x%lx", result ); return 0; } - + /* store pixel format for CreateSecondary */ win32_driver->primary_pixel_format = ddpf; @@ -508,7 +508,7 @@ static boolean CheckPixelFormat( win32_driver_t * win32_driver ) /* Create a Direct draw surface from * a bitmap resource.. * - * NOTE : This is not really useful + * NOTE : This is not really useful * anymore since the xine logo code is * being pushed to the backend. */ @@ -547,7 +547,7 @@ static LPDIRECTDRAWSURFACE CreateBMP( win32_driver_t * win32_driver, int resourc Error( 0, "CreateSurface ( bitmap ) : could not create dd surface" ); return 0; } - + /* get a handle to our surface dc, * create a compat dc and load * our bitmap into the compat dc */ @@ -572,7 +572,7 @@ static LPDIRECTDRAWSURFACE CreateBMP( win32_driver_t * win32_driver, int resourc } #endif -/* Merge overlay with the current primary +/* Merge overlay with the current primary * surface. This funtion is only used when * a h/w overlay of the current frame type * is supported. */ @@ -583,7 +583,7 @@ static boolean Overlay( LPDIRECTDRAWSURFACE src_surface, RECT * src_rect, { DWORD dw_color_key; DDPIXELFORMAT ddpf; - DDOVERLAYFX ddofx; + DDOVERLAYFX ddofx; int flags; HRESULT result; @@ -903,7 +903,7 @@ static vo_frame_t * win32_alloc_frame( vo_driver_t * vo_driver ) } -static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_frame, uint32_t width, +static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_frame, uint32_t width, uint32_t height, double ratio, int format, int flags ) { win32_driver_t *win32_driver = ( win32_driver_t * ) vo_driver; @@ -953,7 +953,7 @@ static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_ #endif else { - xprintf (win32_driver->xine, XINE_VERBOSITY_DEBUG, + xprintf (win32_driver->xine, XINE_VERBOSITY_DEBUG, "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); exit (1); } @@ -1015,13 +1015,13 @@ static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame #if NEW_YUV win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, win32_driver->width, win32_driver->height, - win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[1], + win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[1], win32_driver->width, win32_driver->height, win32_driver->width * win32_driver->bytespp); #else yuv2rgb_setup( win32_driver->yuv2rgb, win32_driver->width, win32_driver->height, - win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[1], + win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[1], win32_driver->width, win32_driver->height, win32_driver->width * win32_driver->bytespp ); @@ -1041,7 +1041,7 @@ static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame #if NEW_YUV win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, win32_driver->width, win32_driver->height, - win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[0] / 2, + win32_frame->vo_frame.pitches[0], win32_frame->vo_frame.pitches[0] / 2, win32_driver->width, win32_driver->height, win32_driver->width * win32_driver->bytespp ); #else @@ -1087,14 +1087,14 @@ static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame src += vo_frame->pitches[0]; dst += win32_driver->ddsd.lPitch; } - + src = frame->base[2]; for (line = 0; line < frame->height/2 ; line++){ xine_fast_memcpy( dst, src, frame->width/2); src += vo_frame->pitches[2]; dst += win32_driver->ddsd.lPitch/2; } - + src = frame->base[1]; for (line = 0; line < frame->height/2 ; line++){ xine_fast_memcpy( dst, src, frame->width/2); @@ -1102,10 +1102,10 @@ static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame dst += win32_driver->ddsd.lPitch/2; } break; - + case XINE_IMGFMT_YUY2: default: - src = frame->base[0]; + src = frame->base[0]; for (line = 0; line < frame->height ; line++){ xine_fast_memcpy( dst, src, frame->width*2); src += vo_frame->pitches[0]; @@ -1184,7 +1184,7 @@ static int win32_gui_data_exchange( vo_driver_t * vo_driver, int data_type, void { HRESULT result; HWND newWndHnd = (HWND) data; - + /* set cooperative level */ result = IDirectDraw_SetCooperativeLevel( win32_driver->ddobj, newWndHnd, DDSCL_NORMAL ); if( result != DD_OK ) @@ -1217,15 +1217,15 @@ static int win32_redraw_needed(vo_driver_t* this_gen) int ret = 0; /* TC - May need to revisit this! */ -#ifdef TC +#ifdef TC win32_driver_t *win32_driver = (win32_driver_t *) this_gen; if( _x_vo_scale_redraw_needed( &win32_driver->sc ) ) { - win32_gui_data_exchange(this_gen, GUI_WIN32_MOVED_OR_RESIZED, 0); + win32_gui_data_exchange(this_gen, GUI_WIN32_MOVED_OR_RESIZED, 0); ret = 1; } #endif - + return ret; } @@ -1246,7 +1246,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *wi _x_alphablend_init(&win32_driver->alphablend_extra_data, class->xine); - + win32_driver->xine = class->xine; /* Make sure that the DirectX drivers are available and present! */ @@ -1317,7 +1317,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { directx->xine = xine; directx->config = xine->config; - + return directx; } diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index d67b0870d..315e77e66 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2003 the xine project and Fredrik Noring - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -52,8 +52,8 @@ #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> -#include <fcntl.h> - +#include <fcntl.h> + #include "xine.h" #include "video_out.h" @@ -89,7 +89,7 @@ typedef struct fb_frame_s int format; int flags; - + vo_scale_t sc; uint8_t *chunk[3]; /* mem alloc by xmalloc_aligned */ @@ -97,7 +97,7 @@ typedef struct fb_frame_s yuv2rgb_t *yuv2rgb; /* yuv2rgb converter for this frame */ uint8_t *rgb_dst; int yuv_stride; - + int bytes_per_line; uint8_t* video_mem; /* mmapped video memory */ @@ -114,12 +114,12 @@ typedef struct fb_driver_s int fd; int mem_size; uint8_t* video_mem_base; /* mmapped video memory */ - + int depth, bpp, bytes_per_pixel; - + int total_num_native_buffers; int used_num_buffers; - + int yuv2rgb_mode; int yuv2rgb_swap; int yuv2rgb_brightness; @@ -132,11 +132,11 @@ typedef struct fb_driver_s /* size / aspect ratio calculations */ vo_scale_t sc; - + int fb_bytes_per_line; fb_frame_t *cur_frame, *old_frame; - + struct fb_var_screeninfo fb_var; struct fb_fix_screeninfo fb_fix; @@ -161,10 +161,10 @@ static uint32_t fb_get_capabilities(vo_driver_t *this_gen) static void fb_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src) { fb_frame_t *frame = (fb_frame_t *)vo_img ; - + vo_img->proc_called = 1; - - if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || + + if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || frame->vo_frame.crop_right || frame->vo_frame.crop_bottom ) { /* we don't support crop, so don't even waste cpu cycles. @@ -184,18 +184,18 @@ static void fb_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src) static void fb_frame_field(vo_frame_t *vo_img, int which_field) { fb_frame_t *frame = (fb_frame_t *)vo_img ; - + switch(which_field) { case VO_TOP_FIELD: frame->rgb_dst = frame->data; break; - + case VO_BOTTOM_FIELD: frame->rgb_dst = frame->data + frame->bytes_per_line ; break; - + case VO_BOTH_FIELDS: frame->rgb_dst = frame->data; break; @@ -228,16 +228,16 @@ static vo_frame_t *fb_alloc_frame(vo_driver_t *this_gen) memcpy(&frame->sc, &this->sc, sizeof(vo_scale_t)); pthread_mutex_init(&frame->vo_frame.mutex, NULL); - + /* supply required functions */ frame->vo_frame.proc_slice = fb_frame_proc_slice; frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = fb_frame_field; + frame->vo_frame.field = fb_frame_field; frame->vo_frame.dispose = fb_frame_dispose; frame->vo_frame.driver = this_gen; - + frame->this = this; - + /* colorspace converter for this frame */ frame->yuv2rgb = this->yuv2rgb_factory->create_converter(this->yuv2rgb_factory); @@ -268,7 +268,7 @@ static void fb_compute_ideal_size(fb_driver_t *this, fb_frame_t *frame) static void fb_compute_rgb_size(fb_driver_t *this, fb_frame_t *frame) { _x_vo_scale_compute_output_size(&frame->sc); - + /* avoid problems in yuv2rgb */ if(frame->sc.output_height < (frame->sc.delivered_height+15) >> 4) frame->sc.output_height = (frame->sc.delivered_height+15) >> 4; @@ -277,7 +277,7 @@ static void fb_compute_rgb_size(fb_driver_t *this, fb_frame_t *frame) frame->sc.output_width = 8; /* yuv2rgb_mlib needs an even YUV2 width */ - if (frame->sc.output_width & 1) + if (frame->sc.output_width & 1) frame->sc.output_width++; lprintf("frame source %d x %d => screen output %d x %d%s\n", @@ -305,7 +305,7 @@ static void setup_colorspace_converter(fb_frame_t *frame, int flags) frame->bytes_per_line * 2); frame->yuv_stride = frame->bytes_per_line * 2; break; - + case VO_BOTH_FIELDS: frame->yuv2rgb-> configure(frame->yuv2rgb, @@ -328,7 +328,7 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, free(frame->chunk[1]); free(frame->chunk[2]); memset(frame->chunk, 0, sizeof(frame->chunk[0])*3); - + if(this->use_zero_copy) { frame->data = frame->video_mem + @@ -348,19 +348,19 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - + frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[0] * height, (void **)&frame->chunk[0]); - + frame->vo_frame.base[1] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[1] * ((height+1)/2), (void **)&frame->chunk[1]); - + frame->vo_frame.base[2] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[2] * @@ -370,7 +370,7 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, else { frame->vo_frame.pitches[0] = 8 * ((width + 3) / 4); - + frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame->vo_frame.pitches[0] * @@ -380,7 +380,7 @@ static void frame_reallocate(fb_driver_t *this, fb_frame_t *frame, frame->chunk[2] = NULL; } } - + static void fb_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_gen, uint32_t width, uint32_t height, @@ -388,7 +388,7 @@ static void fb_update_frame_format(vo_driver_t *this_gen, { fb_driver_t *this = (fb_driver_t *)this_gen; fb_frame_t *frame = (fb_frame_t *)frame_gen; - + flags &= VO_BOTH_FIELDS; /* Find out if we need to adapt this frame. */ @@ -418,7 +418,7 @@ static void fb_update_frame_format(vo_driver_t *this_gen, else frame->bytes_per_line = frame->sc.output_width * this->bytes_per_pixel; - + setup_colorspace_converter(frame, flags); } @@ -430,7 +430,7 @@ static void fb_overlay_clut_yuv2rgb(fb_driver_t *this, { int i; clut_t* clut = (clut_t*)overlay->color; - + if(!overlay->rgb_clut) { for(i = 0; @@ -446,11 +446,11 @@ static void fb_overlay_clut_yuv2rgb(fb_driver_t *this, } overlay->rgb_clut++; } - + if(!overlay->hili_rgb_clut) { clut = (clut_t*) overlay->hili_color; - + for(i = 0; i < sizeof(overlay->color)/sizeof(overlay->color[0]); i++) @@ -492,7 +492,7 @@ static void fb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, frame->sc.delivered_height, &this->alphablend_extra_data); break; - + case 24: _x_blend_rgb24(frame->data, overlay, @@ -502,7 +502,7 @@ static void fb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, frame->sc.delivered_height, &this->alphablend_extra_data); break; - + case 32: _x_blend_rgb32(frame->data, overlay, @@ -512,7 +512,7 @@ static void fb_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, frame->sc.delivered_height, &this->alphablend_extra_data); break; - } + } } } @@ -534,11 +534,11 @@ 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; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + 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); - + memset(this->video_mem_base, 0, this->mem_size); } @@ -555,10 +555,10 @@ static void fb_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) (&this->old_frame->vo_frame); this->old_frame = this->cur_frame; this->cur_frame = frame; - + this->fb_var.yoffset = frame->yoffset; if(ioctl(this->fd, FBIOPAN_DISPLAY, &this->fb_var) == -1) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: ioctl FBIOPAN_DISPLAY failed: %s\n", strerror(errno)); } else @@ -567,14 +567,14 @@ static void fb_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) frame->sc.output_yoffset * this->fb_bytes_per_line + frame->sc.output_xoffset * this->bytes_per_pixel; src = frame->data; - + for(y = 0; y < frame->sc.output_height; y++) { xine_fast_memcpy(dst, src, frame->bytes_per_line); src += frame->bytes_per_line; dst += this->fb_bytes_per_line; - } - + } + frame->vo_frame.free(&frame->vo_frame); } } @@ -597,7 +597,7 @@ static int fb_get_property(vo_driver_t *this_gen, int property) case VO_PROP_WINDOW_WIDTH: return this->sc.gui_width; - + case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; @@ -614,7 +614,7 @@ static int fb_get_property(vo_driver_t *this_gen, int property) return this->cur_frame->sc.output_yoffset; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: tried to get unsupported property %d\n", property); } @@ -631,7 +631,7 @@ static int fb_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; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); break; @@ -660,7 +660,7 @@ static int fb_set_property(vo_driver_t *this_gen, int property, int value) break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: tried to set unsupported property %d\n", property); } @@ -698,8 +698,8 @@ static int fb_gui_data_exchange(vo_driver_t *this_gen, static void fb_dispose(vo_driver_t *this_gen) { fb_driver_t *this = (fb_driver_t *)this_gen; - - munmap(0, this->mem_size); + + munmap(0, this->mem_size); close(this->fd); _x_alphablend_free(&this->alphablend_extra_data); @@ -710,7 +710,7 @@ static void fb_dispose(vo_driver_t *this_gen) static int get_fb_var_screeninfo(int fd, struct fb_var_screeninfo *var, xine_t *xine) { int i; - + if(ioctl(fd, FBIOGET_VSCREENINFO, var)) { xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_fb: ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); @@ -731,7 +731,7 @@ static int get_fb_var_screeninfo(int fd, struct fb_var_screeninfo *var, xine_t * continue; break; } - + /* Get proper value for maximized var->yres_virtual. */ if(ioctl(fd, FBIOGET_VSCREENINFO, var) == -1) { @@ -831,26 +831,26 @@ static int open_fb_device(config_values_t *config, xine_t *xine) { device_name = "/dev/fb1"; fd = open(device_name, O_RDWR); - + if(fd < 0) - { + { device_name = "/dev/fb0"; fd = open(device_name, O_RDWR); } } - + if(fd < 0) { - xprintf(xine, XINE_VERBOSITY_DEBUG, + xprintf(xine, XINE_VERBOSITY_DEBUG, "video_out_fb: Unable to open device \"%s\", aborting: %s\n", device_name, strerror(errno)); return -1; } - + config->update_string(config, devkey, device_name); return fd; } - + static int mode_visual(fb_driver_t *this, config_values_t *config, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix) @@ -876,7 +876,7 @@ static int mode_visual(fb_driver_t *this, config_values_t *config, if(!var->blue.offset) return MODE_16_RGB; return MODE_16_BGR; - + case 15: if(!var->blue.offset) return MODE_15_RGB; @@ -884,16 +884,16 @@ static int mode_visual(fb_driver_t *this, config_values_t *config, case 8: if(!var->blue.offset) - return MODE_8_RGB; - return MODE_8_BGR; + return MODE_8_RGB; + return MODE_8_BGR; } } - + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_fb: Your video mode was not recognized, sorry.\n")); return 0; } - + static int setup_yuv2rgb(fb_driver_t *this, config_values_t *config, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix) @@ -907,13 +907,13 @@ static int setup_yuv2rgb(fb_driver_t *this, config_values_t *config, this->yuv2rgb_contrast = this->yuv2rgb_saturation = 128; this->yuv2rgb_factory = yuv2rgb_factory_init(this->yuv2rgb_mode, - this->yuv2rgb_swap, + this->yuv2rgb_swap, this->yuv2rgb_cmap); this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, this->yuv2rgb_contrast, this->yuv2rgb_saturation); - + return 1; } @@ -934,7 +934,7 @@ static void setup_buffers(fb_driver_t *this, * bpp <= 32 * msb_right = 0 */ - + this->bytes_per_pixel = (this->fb_var.bits_per_pixel + 7)/8; this->bpp = this->bytes_per_pixel * 8; this->depth = this->fb_var.red.length + @@ -943,9 +943,9 @@ static void setup_buffers(fb_driver_t *this, this->total_num_native_buffers = var->yres_virtual / var->yres; this->used_num_buffers = 0; - + this->cur_frame = this->old_frame = 0; - + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_fb: %d video RAM buffers are available.\n"), this->total_num_native_buffers); @@ -955,7 +955,7 @@ static void setup_buffers(fb_driver_t *this, 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"), + " the frame buffer resolution might help.\n"), this->total_num_native_buffers, RECOMMENDED_NUM_BUFFERS); } else @@ -983,11 +983,11 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, fb_driver_t *this; fb_class_t *class; fb_visual_t *visual = NULL; - + if (visual_gen) { visual = (fb_visual_t *) visual_gen; } - + class = (fb_class_t *)class_gen; config = class->config; @@ -997,7 +997,7 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + register_callbacks(this); this->fd = open_fb_device(config, class->xine); @@ -1009,7 +1009,7 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, goto error; if (!set_fb_palette (this->fd, &this->fb_var)) goto error; - + this->xine = class->xine; if(this->fb_fix.line_length) @@ -1018,7 +1018,7 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, this->fb_bytes_per_line = (this->fb_var.xres_virtual * this->fb_var.bits_per_pixel)/8; - + _x_vo_scale_init(&this->sc, 0, 0, config); this->sc.gui_width = this->fb_var.xres; this->sc.gui_height = this->fb_var.yres; @@ -1043,10 +1043,10 @@ static vo_driver_t *fb_open_plugin(video_driver_class_t *class_gen, 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; - + /* mmap whole video memory */ this->mem_size = this->fb_fix.smem_len; this->video_mem_base = mmap(0, this->mem_size, PROT_READ | PROT_WRITE, @@ -1100,7 +1100,7 @@ static const vo_info_t vo_info_fb = /* exported plugin catalog entry */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "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 0de6e34e8..15bc52abe 100644 --- a/src/video_out/video_out_none.c +++ b/src/video_out/video_out_none.c @@ -72,7 +72,7 @@ static void free_framedata(none_frame_t* frame) { static void none_frame_dispose(vo_frame_t *vo_frame) { none_frame_t *frame = (none_frame_t *)vo_frame; - free_framedata(frame); + free_framedata(frame); free (frame); } @@ -87,7 +87,7 @@ 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 = calloc(1, sizeof(none_frame_t)); if(!frame) return NULL; @@ -97,43 +97,43 @@ static vo_frame_t *none_alloc_frame(vo_driver_t *vo_driver) { frame->vo_frame.base[0] = NULL; frame->vo_frame.base[1] = NULL; frame->vo_frame.base[2] = NULL; - + frame->vo_frame.proc_slice = NULL; frame->vo_frame.proc_frame = NULL; frame->vo_frame.field = none_frame_field; frame->vo_frame.dispose = none_frame_dispose; frame->vo_frame.driver = vo_driver; - + return (vo_frame_t *)frame; } static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_frame, - uint32_t width, uint32_t height, + uint32_t width, uint32_t height, double ratio, int format, int flags) { 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)) { - + free_framedata(frame); - + frame->width = width; frame->height = height; frame->format = format; - + switch(format) { - case XINE_IMGFMT_YV12: + case XINE_IMGFMT_YV12: { int y_size, uv_size; - + frame->vo_frame.pitches[0] = 8*((width + 7) / 8); frame->vo_frame.pitches[1] = 8*((width + 15) / 16); frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - + y_size = frame->vo_frame.pitches[0] * height; uv_size = frame->vo_frame.pitches[1] * ((height+1)/2); - + frame->vo_frame.base[0] = malloc (y_size + 2*uv_size); frame->vo_frame.base[1] = frame->vo_frame.base[0]+y_size+uv_size; frame->vo_frame.base[2] = frame->vo_frame.base[0]+y_size; @@ -152,14 +152,14 @@ static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_fram break; } - - if((format == XINE_IMGFMT_YV12 - && (frame->vo_frame.base[0] == NULL - || frame->vo_frame.base[1] == 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)) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "video_out_none: error. (framedata allocation failed: out of memory)\n"); + "video_out_none: error. (framedata allocation failed: out of memory)\n"); free_framedata(frame); } } @@ -170,19 +170,19 @@ static void none_update_frame_format(vo_driver_t *vo_driver, vo_frame_t *vo_fram static void none_display_frame(vo_driver_t *vo_driver, vo_frame_t *vo_frame) { /* none_driver_t *driver = (none_driver_t *)vo_driver; */ none_frame_t *frame = (none_frame_t *)vo_frame; - + frame->vo_frame.free(&frame->vo_frame); } static int none_get_property(vo_driver_t *vo_driver, int property) { none_driver_t *driver = (none_driver_t *)vo_driver; - + switch(property) { case VO_PROP_ASPECT_RATIO: return driver->ratio; break; - + default: break; } @@ -192,7 +192,7 @@ static int none_get_property(vo_driver_t *vo_driver, int property) { static int none_set_property(vo_driver_t *vo_driver, int property, int value) { none_driver_t *driver = (none_driver_t *)vo_driver; - + switch(property) { case VO_PROP_ASPECT_RATIO: @@ -208,7 +208,7 @@ static int none_set_property(vo_driver_t *vo_driver, int property, int value) { return value; } -static void none_get_property_min_max(vo_driver_t *vo_driver, +static void none_get_property_min_max(vo_driver_t *vo_driver, int property, int *min, int *max) { *min = 0; *max = 0; @@ -242,13 +242,13 @@ static int none_redraw_needed(vo_driver_t *vo_driver) { static vo_driver_t *open_plugin(video_driver_class_t *driver_class, const void *visual) { none_class_t *class = (none_class_t *) driver_class; none_driver_t *driver; - + driver = calloc(1, 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; driver->vo_driver.alloc_frame = none_alloc_frame ; driver->vo_driver.update_frame_format = none_update_frame_format; @@ -262,9 +262,9 @@ static vo_driver_t *open_plugin(video_driver_class_t *driver_class, const void * driver->vo_driver.gui_data_exchange = none_gui_data_exchange; driver->vo_driver.dispose = none_dispose; driver->vo_driver.redraw_needed = none_redraw_needed; - + return &driver->vo_driver; -} +} /* * Class related functions. @@ -279,13 +279,13 @@ static char* get_description (video_driver_class_t *driver_class) { static void dispose_class (video_driver_class_t *driver_class) { none_class_t *this = (none_class_t *) driver_class; - + free (this); } static void *init_class (xine_t *xine, void *visual) { none_class_t *this; - + this = calloc(1, sizeof(none_class_t)); this->driver_class.open_plugin = open_plugin; @@ -305,7 +305,7 @@ static const vo_info_t vo_info_none = { }; const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "none", XINE_VERSION_CODE, &vo_info_none, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index a8f11db2f..1904fe6af 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -142,7 +142,7 @@ typedef struct { uint8_t *chunk[4]; /* mem alloc by xmalloc_aligned */ uint8_t *rgb, *rgb_dst; - + yuv2rgb_t *yuv2rgb; /* yuv2rgb converter set up for this frame */ } opengl_frame_t; @@ -198,7 +198,7 @@ typedef struct { PFNMYGLPROGRAMENVPARAMETER4FARBPROC glProgramEnvParameter4fARB; PFNMYGLGENTEXTURESEXTPROC glGenTexturesEXT; PFNMYGLBINDTEXTUREEXTPROC glBindTextureEXT; - + int yuv2rgb_brightness; int yuv2rgb_contrast; int yuv2rgb_saturation; @@ -233,7 +233,7 @@ typedef struct { int (*setup)(opengl_driver_t *); /* Flag: needs output converted to rgb (is able to do YUV otherwise) */ int needsrgb; - /* Default action: what to do if there's no new image + /* Default action: what to do if there's no new image * typically either RENDER_NONE or RENDER_DRAW (for animated render's) */ enum render_e defaction; /* Fallback: change to following render backend if this one doesn't work */ @@ -327,7 +327,7 @@ static void render_cyl (opengl_driver_t *this, opengl_frame_t *frame) { float off; float tx, ty; struct timeval curtime; - + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); /* Calc timing + texture coords */ @@ -341,10 +341,10 @@ static void render_cyl (opengl_driver_t *this, opengl_frame_t *frame) { glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glTranslatef (0, 0, -10); - glRotatef (off * CYCLE_FACTOR1, 1, 0, 0); - glRotatef (off, 0, 0, 1); - glRotatef (off * CYCLE_FACTOR2, 0, 1, 0); - + glRotatef (off * CYCLE_FACTOR1, 1, 0, 0); + glRotatef (off, 0, 0, 1); + glRotatef (off * CYCLE_FACTOR2, 0, 1, 0); + /* Note that this is not aspect ratio corrected */ glBegin (GL_QUADS); for (i = 0; i < CYL_TESSELATION; i++) { @@ -363,7 +363,7 @@ static void render_cyl (opengl_driver_t *this, opengl_frame_t *frame) { } /* Animated spinning environment mapped torus */ -#define DIST_FACTOR 16.568542 /* 2 * (sqrt(2)-1) * 20 */ +#define DIST_FACTOR 16.568542 /* 2 * (sqrt(2)-1) * 20 */ static void render_env_tor (opengl_driver_t *this, opengl_frame_t *frame) { float off; float x1, y1, x2, y2, tx, ty; @@ -397,7 +397,7 @@ static void render_env_tor (opengl_driver_t *this, opengl_frame_t *frame) { glLoadIdentity (); glDepthFunc (GL_ALWAYS); glDepthMask (GL_FALSE); - + glBegin (GL_QUADS); glColor3f (1, 1, 1); glTexCoord2f (tx, 0); glVertex3f (x2, y2, -20); @@ -405,7 +405,7 @@ static void render_env_tor (opengl_driver_t *this, opengl_frame_t *frame) { glTexCoord2f (0, ty); glVertex3f (x1, y1, -20); glTexCoord2f (tx, ty); glVertex3f (x2, y1, -20); glEnd (); - + glPopMatrix (); glDepthFunc (GL_LEQUAL); glDepthMask (GL_TRUE); @@ -442,7 +442,7 @@ static int render_help_image_tex (opengl_driver_t *this, int new_w, int new_h, tex_w <<= 1; while (tex_h < new_h) tex_h <<= 1; - + if (tex_w != this->tex_width || tex_h != this->tex_height) { char *tmp = calloc (tex_w * tex_h, 4); /* 4 enough until RGBA */ if (this->glBindTextureEXT) @@ -458,7 +458,7 @@ static int render_help_image_tex (opengl_driver_t *this, int new_w, int new_h, this->tex_width = tex_w; this->tex_height = tex_h; lprintf ("* new texsize: %dx%d\n", tex_w, tex_h); - } + } this->last_width = new_w; this->last_height = new_h; return 1; @@ -481,7 +481,7 @@ static int render_help_image_tiledtex (opengl_driver_t *this, tex_w <<= 1; while (tex_h < new_h) tex_h <<= 1; - + if (tex_w != this->tex_width || tex_h != this->tex_height) { char *tmp = calloc (tex_w * tex_h, 4); /* 4 enough until RGBA */ if (this->glBindTextureEXT) @@ -521,7 +521,7 @@ static int render_help_image_tiledtex (opengl_driver_t *this, this->tex_width = tex_w; this->tex_height = tex_h; lprintf ("* new texsize: %dx%d on %d tiles\n", tex_w, tex_h, num); - } + } this->last_width = new_w; this->last_height = new_h; return 1; @@ -710,7 +710,7 @@ static void *getdladdr (const GLubyte *_funcName) { handle = dlopen (NULL, RTLD_LAZY); } return dlsym (handle, funcName); - + #else /* all other Un*xes */ return dlsym (0, funcName); @@ -883,7 +883,7 @@ static int render_setup_cyl (opengl_driver_t *this) { static int render_setup_torus (opengl_driver_t *this) { int i, j, k; int ret; - + ret = render_setup_3d (this); ret &= render_help_setup_tex (this); @@ -937,7 +937,7 @@ static int render_setup_fp_yuv (opengl_driver_t *this) { "MAD res, { 0, -.391, 2.018 }, tmp.xxxw, res;" "MAD result.color, { 1.596, -.813, 0 }, tmp.yyyw, res;" "END"; - + ret = render_setup_tex2d (this); if (! this->has_fragprog) return 0; @@ -963,7 +963,7 @@ static int render_setup_fp_yuv (opengl_driver_t *this) { */ /* name, display, image, setup, needsrgb, defaction, fallback */ static const opengl_render_t opengl_rb[] = { - { "2D_Tex_Fragprog", render_tex2d, render_image_fp_yuv, + { "2D_Tex_Fragprog", render_tex2d, render_image_fp_yuv, render_setup_fp_yuv, 0, RENDER_NONE, 1 }, { "2D_Tex", render_tex2d, render_image_tex, render_setup_tex2d, 1, RENDER_NONE, 2 }, @@ -1004,10 +1004,10 @@ static void *render_run (opengl_driver_t *this) { struct timeval curtime; struct timespec timeout; const opengl_render_t *render; - + lprintf ("* render thread created\n"); while (1) { - + /* Wait for render action */ pthread_mutex_lock (&this->render_action_mutex); if (! this->render_action) { @@ -1211,28 +1211,28 @@ static uint32_t opengl_get_capabilities (vo_driver_t *this_gen) { static void opengl_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { opengl_frame_t *frame = (opengl_frame_t *) vo_img ; /* opengl_driver_t *this = (opengl_driver_t *) vo_img->driver; */ - + vo_img->proc_called = 1; if (! frame->rgb_dst) return; /* lprintf ("%p: frame_copy src %p=%p to %p\n", frame, src[0], frame->chunk[0], frame->rgb_dst); */ - if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || + if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || frame->vo_frame.crop_right || frame->vo_frame.crop_bottom ) { /* TODO: opengl *could* support this?!? */ /* cropping will be performed by video_out.c */ return; } - + if (frame->format == XINE_IMGFMT_YV12) frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0], src[1], src[2]); else frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0]); - + /* lprintf ("frame_copy...done\n"); */ } @@ -1243,7 +1243,7 @@ static void opengl_frame_field (vo_frame_t *vo_img, int which_field) { /* lprintf ("%p: frame_field rgb %p which_field %x\n", frame, frame->rgb, which_field); */ if (! opengl_rb[this->render_fun_id].needsrgb) { - frame->rgb_dst = NULL; + frame->rgb_dst = NULL; return; } @@ -1291,7 +1291,7 @@ static vo_frame_t *opengl_alloc_frame (vo_driver_t *this_gen) { */ frame->vo_frame.proc_slice = opengl_frame_proc_slice; frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = opengl_frame_field; + frame->vo_frame.field = opengl_frame_field; frame->vo_frame.dispose = opengl_frame_dispose; frame->vo_frame.driver = this_gen; @@ -1345,7 +1345,7 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, /* lprintf ("updating frame to %d x %d (ratio=%g, format=%08x)\n", width, height, ratio, format); */ flags &= VO_BOTH_FIELDS; - + XLockDisplay (this->display); /* (re-) allocate render space */ @@ -1399,7 +1399,7 @@ static void opengl_update_frame_format (vo_driver_t *this_gen, frame->height = height; frame->format = format; - XUnlockDisplay (this->display); + XUnlockDisplay (this->display); opengl_frame_field ((vo_frame_t *)frame, flags); } @@ -1433,7 +1433,7 @@ static void opengl_overlay_clut_yuv2rgb(opengl_driver_t *this, vo_overlay_t *ov } } -static void opengl_overlay_begin (vo_driver_t *this_gen, +static void opengl_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { opengl_driver_t *this = (opengl_driver_t *) this_gen; @@ -1441,10 +1441,10 @@ static void opengl_overlay_begin (vo_driver_t *this_gen, if (this->ovl_changed && this->xoverlay) { XLockDisplay (this->display); - x11osd_clear(this->xoverlay); + x11osd_clear(this->xoverlay); XUnlockDisplay (this->display); } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -1461,7 +1461,7 @@ static void opengl_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { this->ovl_changed = 0; } -static void opengl_overlay_blend (vo_driver_t *this_gen, +static void opengl_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { opengl_driver_t *this = (opengl_driver_t *) this_gen; opengl_frame_t *frame = (opengl_frame_t *) frame_gen; @@ -1471,7 +1471,7 @@ static void opengl_overlay_blend (vo_driver_t *this_gen, if (overlay->unscaled) { if (this->ovl_changed && this->xoverlay) { XLockDisplay (this->display); - x11osd_blend (this->xoverlay, overlay); + x11osd_blend (this->xoverlay, overlay); XUnlockDisplay (this->display); } } else { @@ -1512,7 +1512,7 @@ static int opengl_redraw_needed (vo_driver_t *this_gen) { opengl_compute_ideal_size(this); - if( _x_vo_scale_redraw_needed( &this->sc ) ) { + if( _x_vo_scale_redraw_needed( &this->sc ) ) { opengl_compute_rgb_size(this); pthread_mutex_lock (&this->render_action_mutex); if (this->render_action <= RENDER_CLEAN) { @@ -1522,10 +1522,10 @@ static int opengl_redraw_needed (vo_driver_t *this_gen) { pthread_mutex_unlock (&this->render_action_mutex); ret = 1; } - } + } else ret = 1; - + /* lprintf ("done...redraw_needed: %d\n", ret); */ return ret; } @@ -1545,7 +1545,7 @@ static void opengl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) this->frame[0] = frame; this->render_frame_changed = 1; /* lprintf ("video_out_opengl: cur_frame updated to %d\n", frame->vo_frame.id); */ - + /* * let's see if this frame is different in size / aspect * ratio from the previous one @@ -1556,7 +1556,7 @@ static void opengl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) /* lprintf("frame format changed\n"); */ this->sc.force_redraw = 1; /* trigger re-calc of output size */ } - + /* * tell gui that we are about to display a frame, * ask for offset and output size @@ -1592,14 +1592,14 @@ static int opengl_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_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_opengl: tried to get unsupported property %d\n", property); } return 0; } -static int opengl_set_property (vo_driver_t *this_gen, +static int opengl_set_property (vo_driver_t *this_gen, int property, int value) { opengl_driver_t *this = (opengl_driver_t *) this_gen; @@ -1611,7 +1611,7 @@ static int opengl_set_property (vo_driver_t *this_gen, opengl_compute_ideal_size (this); this->sc.force_redraw = 1; /* trigger re-calc of output size */ - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_opengl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); break; case VO_PROP_BRIGHTNESS: @@ -1639,7 +1639,7 @@ static int opengl_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; break; default: - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_opengl: tried to set unsupported property %d\n", property); } @@ -1662,7 +1662,7 @@ static void opengl_get_property_min_max (vo_driver_t *this_gen, } } -static int opengl_gui_data_exchange (vo_driver_t *this_gen, +static int opengl_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { opengl_driver_t *this = (opengl_driver_t *) this_gen; @@ -1677,7 +1677,7 @@ static int opengl_gui_data_exchange (vo_driver_t *this_gen, /* lprintf ("expose event\n"); */ if (this->frame[0]) { XExposeEvent * xev = (XExposeEvent *) data; - + if (xev && xev->count == 0) { pthread_mutex_lock (&this->render_action_mutex); if (this->render_action <= RENDER_CLEAN) { @@ -1714,9 +1714,9 @@ static int opengl_gui_data_exchange (vo_driver_t *this_gen, &this->render_action_mutex); pthread_mutex_unlock (&this->render_action_mutex); break; - + case XINE_GUI_SEND_DRAWABLE_CHANGED: - + pthread_mutex_lock (&this->render_action_mutex); this->render_action = RENDER_RELEASE; pthread_cond_signal (&this->render_action_cond); @@ -1744,7 +1744,7 @@ static int opengl_gui_data_exchange (vo_driver_t *this_gen, if (this->frame[0]) { x11_rectangle_t *rect = data; int x1, y1, x2, y2; - + _x_vo_scale_translate_gui2video(&this->sc, rect->x, rect->y, &x1, &y1); @@ -1773,7 +1773,7 @@ static void opengl_dispose (vo_driver_t *this_gen) { this->render_action = RENDER_EXIT; pthread_cond_signal (&this->render_action_cond); pthread_mutex_unlock (&this->render_action_mutex); - pthread_join (this->render_thread, NULL); + pthread_join (this->render_thread, NULL); pthread_mutex_destroy (&this->render_action_mutex); pthread_cond_destroy (&this->render_action_cond); pthread_cond_destroy (&this->render_return_cond); @@ -1791,7 +1791,7 @@ static void opengl_dispose (vo_driver_t *this_gen) { } _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -1818,7 +1818,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v opengl_driver_t *this; char **render_fun_names; int i; - + this = (opengl_driver_t *) calloc(1, sizeof(opengl_driver_t)); if (!this) @@ -1832,9 +1832,9 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v this->sc.dest_size_cb = visual->dest_size_cb; this->sc.user_data = visual->user_data; this->sc.user_ratio = XINE_VO_ASPECT_AUTO; - + _x_alphablend_init (&this->alphablend_extra_data, class->xine); - + this->drawable = visual->d; this->gui_width = this->gui_height = -1; this->last_width = this->last_height = -1; @@ -1844,7 +1844,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v this->ovl_changed = 0; this->xine = class->xine; this->config = config; - + this->vo_driver.get_capabilities = opengl_get_capabilities; this->vo_driver.alloc_frame = opengl_alloc_frame; this->vo_driver.update_frame_format = opengl_update_frame_format; @@ -1862,8 +1862,8 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v this->yuv2rgb_brightness = 0; this->yuv2rgb_contrast = 128; this->yuv2rgb_saturation = 128; - - this->yuv2rgb_factory = yuv2rgb_factory_init (YUV_FORMAT, YUV_SWAP_MODE, + + this->yuv2rgb_factory = yuv2rgb_factory_init (YUV_FORMAT, YUV_SWAP_MODE, NULL); this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, @@ -1915,7 +1915,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v "it also reduces flickering a lot.\n" "It should not have any performance impact."), 20, NULL, NULL); - + pthread_mutex_init (&this->render_action_mutex, NULL); pthread_cond_init (&this->render_action_cond, NULL); pthread_cond_init (&this->render_return_cond, NULL); @@ -1945,7 +1945,7 @@ static vo_driver_t *opengl_open_plugin (video_driver_class_t *class_gen, const v xprintf (this->xine, XINE_VERBOSITY_LOG, "video_out_opengl: default visual not OpenGL capable\n" " plugin will only work with clients supporting XINE_GUI_SEND_SELECT_VISUAL.\n"); - + return &this->vo_driver; } @@ -2048,7 +2048,7 @@ static const vo_info_t vo_info_opengl = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "opengl", XINE_VERSION_CODE, &vo_info_opengl, opengl_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_pgx32.c b/src/video_out/video_out_pgx32.c index 45a54cc76..fa1b0ef99 100644 --- a/src/video_out/video_out_pgx32.c +++ b/src/video_out/video_out_pgx32.c @@ -1,18 +1,18 @@ -/* +/* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -149,7 +149,7 @@ typedef struct { double ratio; } pgx32_frame_t; -typedef struct { +typedef struct { vo_driver_t vo_driver; vo_scale_t vo_scale; @@ -210,7 +210,7 @@ static int setup_dga(pgx32_driver_t *this) } if (strcmp("TSIgfxp", ident.name) != 0) { - xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx32: Error: '%s' is not a pgx32 framebuffer device\n"), devname); + xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx32: Error: '%s' is not a pgx32 framebuffer device\n"), devname); XDgaUnGrabDrawable(this->dgadraw); XUnlockDisplay(this->display); return 0; @@ -485,7 +485,7 @@ static void pgx32_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) _x_vo_scale_compute_ideal_size(&this->vo_scale); } - if (_x_vo_scale_redraw_needed(&this->vo_scale)) { + if (_x_vo_scale_redraw_needed(&this->vo_scale)) { int i; _x_vo_scale_compute_output_size(&this->vo_scale); @@ -589,7 +589,7 @@ static void pgx32_overlay_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen, vo { /*pgx32_driver_t *this = (pgx32_driver_t *)(void *)this_gen;*/ pgx32_frame_t *frame = (pgx32_frame_t *)frame_gen; - + if (overlay->rle) { int i, j, x, y, len, width; int use_clip_palette; @@ -757,7 +757,7 @@ static int pgx32_redraw_needed(vo_driver_t *this_gen) { pgx32_driver_t *this = (pgx32_driver_t *)(void *)this_gen; - if (_x_vo_scale_redraw_needed(&this->vo_scale)) { + if (_x_vo_scale_redraw_needed(&this->vo_scale)) { this->vo_scale.force_redraw = 1; return 1; } @@ -775,7 +775,7 @@ static void pgx32_dispose(vo_driver_t *this_gen) munmap((void *)this->vregs, GFXP_REGS_MMAPLEN); _x_alphablend_free(&this->alphablend_extra_data); - + free(this); } @@ -806,7 +806,7 @@ static vo_driver_t *pgx32_init_driver(video_driver_class_t *class_gen, const voi } _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->vo_driver.get_capabilities = pgx32_get_capabilities; this->vo_driver.alloc_frame = pgx32_alloc_frame; this->vo_driver.update_frame_format = pgx32_update_frame_format; diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c index abda51e2b..c9ec38aa8 100644 --- a/src/video_out/video_out_pgx64.c +++ b/src/video_out/video_out_pgx64.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2000-2004 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA @@ -213,7 +213,7 @@ typedef struct { uint8_t *buffer_ptrs[3]; } pgx64_frame_t; -typedef struct { +typedef struct { vo_driver_t vo_driver; vo_scale_t vo_scale; @@ -671,7 +671,7 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen) DGA_DRAW_UNLOCK(this->dgadraw); XUnlockDisplay(this->display); - if (_x_vo_scale_redraw_needed(&this->vo_scale)) { + if (_x_vo_scale_redraw_needed(&this->vo_scale)) { short int *cliprects, wx0, wy0, wx1, wy1, cx0, cy0, cx1, cy1; int dgavis; @@ -991,7 +991,7 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen if (x + width - 1 > overlay->hili_right) { width -= overlay->hili_right - x; len += overlay->hili_right - x; - } + } } } @@ -999,7 +999,7 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen int j; clut_t *src_clut; uint8_t *src_trans; - + if (use_clip_palette) { src_clut = (clut_t *)&overlay->hili_color; src_trans = (uint8_t *)&overlay->hili_trans; @@ -1035,7 +1035,7 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen else { palette[use_clip_palette][j] = BlackPixel(this->display, this->screen); } - } + } } else { palette[use_clip_palette][j] = this->colour_key; @@ -1273,7 +1273,7 @@ static int pgx64_redraw_needed(vo_driver_t *this_gen) DGA_DRAW_UNLOCK(this->dgadraw); XUnlockDisplay(this->display); - if (modif || _x_vo_scale_redraw_needed(&this->vo_scale)) { + if (modif || _x_vo_scale_redraw_needed(&this->vo_scale)) { this->vo_scale.force_redraw = 1; this->chromakey_regen_needed = 1; return 1; @@ -1320,7 +1320,7 @@ static void pgx64_config_changed(void *user_data, xine_cfg_entry_t *entry) if (strcmp(entry->key, "video.device.pgx64_colour_key") == 0) { pgx64_set_property(this_gen, VO_PROP_COLORKEY, entry->num_value); update_colour_key_rgb(this); - } + } else if (strcmp(entry->key, "video.device.pgx64_chromakey_en") == 0) { this->chromakey_en = entry->num_value; } diff --git a/src/video_out/video_out_raw.c b/src/video_out/video_out_raw.c index 99e2c0004..860efdfb7 100644 --- a/src/video_out/video_out_raw.c +++ b/src/video_out/video_out_raw.c @@ -152,23 +152,23 @@ static int raw_process_ovl( raw_driver_t *this_gen, vo_overlay_t *overlay ) x = pos%ovl->ovl_w; y = pos/ovl->ovl_w; if ( (x>=overlay->hili_left && x<=overlay->hili_right) && (y>=overlay->hili_top && y<=overlay->hili_bottom) ) { - colors = hili_colors; - trans = hili_trans; + colors = hili_colors; + trans = hili_trans; } else { - colors = low_colors; - trans = low_trans; + colors = low_colors; + trans = low_trans; } rlelen = rle->len; clr = rle->color; alpha = trans[clr]; for ( i=0; i<rlelen; ++i ) { - rgba[0] = colors[clr].y; - rgba[1] = colors[clr].cr; - rgba[2] = colors[clr].cb; - rgba[3] = alpha*255/15; - rgba+= 4; - ++pos; + rgba[0] = colors[clr].y; + rgba[1] = colors[clr].cr; + rgba[2] = colors[clr].cb; + rgba[3] = alpha*255/15; + rgba+= 4; + ++pos; } ++rle; --num_rle; @@ -182,7 +182,7 @@ static void raw_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int raw_driver_t *this = (raw_driver_t *) this_gen; if ( !changed ) - return; + return; ++this->ovl_changed; } diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c index 89150f5d0..36d66cd86 100644 --- a/src/video_out/video_out_sdl.c +++ b/src/video_out/video_out_sdl.c @@ -83,7 +83,7 @@ struct sdl_driver_s { vo_driver_t vo_driver; config_values_t *config; - + int hw_accel; SDL_Surface *surface; @@ -100,7 +100,7 @@ struct sdl_driver_s { int screen; Drawable drawable; #endif - + vo_scale_t sc; xine_t *xine; @@ -142,7 +142,7 @@ static vo_frame_t *sdl_alloc_frame (vo_driver_t *this_gen) { if (!frame) return NULL; - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -207,8 +207,8 @@ static void sdl_update_frame_format (vo_driver_t *this_gen, if (frame->overlay == NULL) return; - /* - * This needs to be done becuase I have found that + /* + * This needs to be done becuase I have found that * pixels isn't setup until this is called. */ SDL_LockYUVOverlay (frame->overlay); @@ -242,7 +242,7 @@ static void sdl_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_ this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; - + if (overlay->rle) { if( frame->format == XINE_IMGFMT_YV12 ) _x_blend_yuv( frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); @@ -354,7 +354,7 @@ static void sdl_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int sdl_get_property (vo_driver_t *this_gen, int property) { sdl_driver_t *this = (sdl_driver_t *) this_gen; - + switch (property) { case VO_PROP_WINDOW_WIDTH: return this->sc.gui_width; @@ -383,7 +383,7 @@ 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; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + 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); @@ -458,7 +458,7 @@ static void sdl_dispose (vo_driver_t * this_gen) { SDL_QuitSubSystem (SDL_INIT_VIDEO); _x_alphablend_free(&this->alphablend_extra_data); - + free(this); } @@ -476,16 +476,16 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi #ifdef HAVE_X11 XWindowAttributes window_attributes; #endif - + this = (sdl_driver_t *) calloc(1, sizeof(sdl_driver_t)); if (!this) return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->sdlflags = SDL_HWSURFACE | SDL_RESIZABLE; - - this->hw_accel = class->config->register_bool(class->config, + + this->hw_accel = class->config->register_bool(class->config, "video.device.sdl_hw_accel", 1, _("use hardware acceleration if available"), _("When your system supports it, hardware acceleration provided by your " @@ -525,7 +525,7 @@ 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)) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_sdl: open_plugin - sdl couldn't get any acceptable video mode\n"); return NULL; } @@ -533,7 +533,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->bpp = vidInfo->vfmt->BitsPerPixel; if (this->bpp < 16) { - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("sdl has to emulate a 16 bit surfaces, that will slow things down.\n")); this->bpp = 16; } @@ -593,17 +593,17 @@ static void dispose_class (video_driver_class_t *this_gen) { static void *init_class (xine_t *xine, void *visual_gen) { /* x11_visual_t *visual = (x11_visual_t *) visual_gen; */ sdl_class_t *this; - + /* check if we have SDL */ if ((SDL_Init (SDL_INIT_VIDEO)) < 0) { - xprintf (xine, XINE_VERBOSITY_DEBUG, + 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*) calloc(1, 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; diff --git a/src/video_out/video_out_stk.c b/src/video_out/video_out_stk.c index 00dd80251..647760fd2 100644 --- a/src/video_out/video_out_stk.c +++ b/src/video_out/video_out_stk.c @@ -22,7 +22,7 @@ * * based on video_out_sdl from * Miguel Freitas - * + * * based on mpeg2dec code from * Ryan C. Gordon <icculus@lokigames.com> and * Dominik Schnitzer <aeneas@linuxvideo.org> @@ -82,9 +82,9 @@ typedef struct stk_driver_s { vo_driver_t vo_driver; /* stk private data */ - config_values_t* config; - surface_t* surface; - xine_panel_t* xine_panel; + config_values_t* config; + surface_t* surface; + xine_panel_t* xine_panel; uint8_t bpp; /* do we need this ? */ pthread_mutex_t mutex; uint32_t capabilities; @@ -171,25 +171,25 @@ static void stk_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge //printf("video_out_stk: update_frame_format()\n"); if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { - lprintf("update_frame_format - %d=%d, %d=%d, %d=%d\n", + lprintf("update_frame_format - %d=%d, %d=%d, %d=%d\n", frame->width, width, frame->height, height, frame->format, format); - lprintf("vo_frame data - width, height, format: %d, %d, %d\n", + lprintf("vo_frame data - width, height, format: %d, %d, %d\n", frame->vo_frame.width, frame->vo_frame.height, frame->vo_frame.format); - + /* (re-) allocate image */ if (frame->overlay) { - stk_overlay_free(frame->overlay); + stk_overlay_free(frame->overlay); frame->overlay = NULL; } if (format == XINE_IMGFMT_YV12) { lprintf ("format YV12\n"); - frame->overlay = stk_surface_create_overlay(this->surface, width, height, + frame->overlay = stk_surface_create_overlay(this->surface, width, height, STK_FORMAT_YV12); } else if (format == XINE_IMGFMT_YUY2) { lprintf("format YUY2\n"); - frame->overlay = stk_surface_create_overlay(this->surface, width, height, + frame->overlay = stk_surface_create_overlay(this->surface, width, height, STK_FORMAT_YUY2); } @@ -197,7 +197,7 @@ static void stk_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge return; /* From the SDL driver: - * This needs to be done becuase I have found that + * This needs to be done becuase I have found that * pixels isn't setup until this is called. */ stk_overlay_lock(frame->overlay); @@ -224,7 +224,7 @@ static void stk_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_ stk_driver_t* this = (stk_driver_t*)this_gen; stk_frame_t* frame = (stk_frame_t*)frame_gen; //printf("video_out_stk: overlay_blend()\n"); - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; @@ -238,7 +238,7 @@ static void stk_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_ } static void stk_check_events (stk_driver_t* this) { - /* SDL checks for a resize, our video panels aren't resizeable... */ + /* SDL checks for a resize, our video panels aren't resizeable... */ //printf("video_out_stk: check_events()\n"); } @@ -247,7 +247,7 @@ static int stk_redraw_needed (vo_driver_t* this_gen) { stk_driver_t* this = (stk_driver_t*)this_gen; int ret = 0; static int last_gui_width, last_gui_height; - + //printf("video_out_stk: redraw_needed()\n"); if( last_gui_width != this->sc.gui_width || @@ -273,7 +273,7 @@ static void stk_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { stk_frame_t* frame = (stk_frame_t*)frame_gen; //printf("video_out_stk: display_frame()\n"); - + pthread_mutex_lock(&this->mutex); if ( (frame->width != this->sc.delivered_width) @@ -308,7 +308,7 @@ static void stk_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int stk_get_property (vo_driver_t* this_gen, int property) { stk_driver_t* this = (stk_driver_t *)this_gen; - + //printf("video_out_stk: get_property()\n"); if (property == VO_PROP_ASPECT_RATIO) @@ -321,7 +321,7 @@ static int stk_set_property (vo_driver_t* this_gen, int property, int value) { stk_driver_t* this = (stk_driver_t*)this_gen; //printf("video_out_stk: set_property()\n"); - + if ( property == VO_PROP_ASPECT_RATIO) { if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; @@ -341,7 +341,7 @@ static void stk_get_property_min_max (vo_driver_t *this_gen, int property, int * //printf("video_out_stk: get_property_min_max()\n"); } -static int stk_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { +static int stk_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { stk_driver_t *this = (stk_driver_t*)this_gen; switch (data_type) @@ -349,9 +349,9 @@ static int stk_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *da case XINE_GUI_SEND_COMPLETION_EVENT: break; - case XINE_GUI_SEND_EXPOSE_EVENT: + case XINE_GUI_SEND_EXPOSE_EVENT: break; - + case XINE_GUI_SEND_DRAWABLE_CHANGED: this->xine_panel = (xine_panel_t*)data; this->surface = stk_xine_panel_surface(this->xine_panel); @@ -365,18 +365,18 @@ static int stk_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *da case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: break; } - + return 0; } static void stk_dispose (vo_driver_t * this_gen) { stk_driver_t* this = (stk_driver_t*)this_gen; - + //printf("video_out_stk: dispose()\n"); - - /* FIXME: any libstk deleting must be done in the app or library + + /* FIXME: any libstk deleting must be done in the app or library * since we didn't create the surface */ - + _x_alphablend_free(&this->alphablend_extra_data); free(this); @@ -386,9 +386,9 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis 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 = calloc(1, sizeof (stk_driver_t)); if (!this) return NULL; @@ -432,7 +432,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis /* FIXME: move this to the stk SDL driver code */ xine_setenv("SDL_VIDEO_YUV_HWACCEL", "1", 1); xine_setenv("SDL_VIDEO_X11_NODIRECTCOLOR", "1", 1); - + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_stk: warning, xine's STK driver is EXPERIMENTAL\n"); return &this->vo_driver; @@ -460,7 +460,7 @@ static void dispose_class (video_driver_class_t *this_gen) { static void *init_class (xine_t *xine, void *visual_gen) { stk_class_t* this; - + //printf("video_out_stk: init_class()\n"); this = calloc(1, sizeof(stk_class_t)); @@ -469,7 +469,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { 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->xine = xine; diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c index f66817f36..aaf7d43c7 100644 --- a/src/video_out/video_out_syncfb.c +++ b/src/video_out/video_out_syncfb.c @@ -7,7 +7,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -18,14 +18,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine - * + * * based on video_out_xv.c by (see file for original authors) - * + * * with lot's of code from: * video_out_syncfb.c by Joachim Koenig <joachim.koenig@gmx.net> * and by Matthias Oelmann <mao@well.com> * video_out_mga by Aaron Holtzman <aholtzma@ess.engr.uvic.ca> - * + * * glued together for xine by Matthias Dahl <matthew2k@web.de> */ @@ -133,7 +133,7 @@ typedef struct { /* returns boolean value (1 success, 0 failure) */ static int syncfb_overlay_on(syncfb_driver_t* this) { - if(ioctl(this->fd, SYNCFB_ON)) { + if(ioctl(this->fd, SYNCFB_ON)) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (on ioctl failed)\n"); return 0; @@ -145,7 +145,7 @@ static int syncfb_overlay_on(syncfb_driver_t* this) /* returns boolean value (1 success, 0 failure) */ static int syncfb_overlay_off(syncfb_driver_t* this) -{ +{ if(ioctl(this->fd, SYNCFB_OFF)) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (off ioctl failed)\n"); @@ -169,7 +169,7 @@ static void write_frame_YUV422(syncfb_driver_t* this, syncfb_frame_t* frame) for(h = 0; h < (frame->height / 2); h++) { cbp = cb; crp = cr; - + for(w = 0; w < (frame->width / 2); w++) { *dst32++ = (*y) + ((*cb)<<8) + ((*(y+1))<<16) + ((*cr)<<24); y++; y++; cb++; cr++; @@ -181,33 +181,33 @@ static void write_frame_YUV422(syncfb_driver_t* this, syncfb_frame_t* frame) *dst32++ = (*y) + ((*cbp)<<8) + ((*(y+1))<<16) + ((*crp)<<24); y++; y++; cbp++; crp++; } - + dst32 += (this->syncfb_config.src_pitch - frame->width) / 2; } } static void write_frame_YUV420P2(syncfb_driver_t* this, syncfb_frame_t* frame) -{ +{ uint8_t* y = (uint8_t *)frame->vo_frame.base[0]; uint8_t* cb = (uint8_t *)frame->vo_frame.base[1]; uint8_t* cr = (uint8_t *)frame->vo_frame.base[2]; uint8_t* dst8 = this->video_mem + this->bufinfo.offset_p2; - int h, w; - + int h, w; + register uint32_t* tmp32; register uint8_t* rcr; register uint8_t* rcb; rcr = cr; rcb = cb; - + for(h = 0; h < (frame->height / 2); h++) { tmp32 = (uint32_t *)dst8; w = (frame->width / 8) * 2; - + while(w--) { register uint32_t temp; - + temp = (*rcb) | (*rcr << 8); rcr++; rcb++; @@ -217,7 +217,7 @@ static void write_frame_YUV420P2(syncfb_driver_t* this, syncfb_frame_t* frame) *tmp32 = temp; tmp32++; } - + dst8 += this->syncfb_config.src_pitch; } @@ -230,13 +230,13 @@ static void write_frame_YUV420P2(syncfb_driver_t* this, syncfb_frame_t* frame) } static void write_frame_YUV420P3(syncfb_driver_t* this, syncfb_frame_t* frame) -{ +{ uint8_t* y = (uint8_t *)frame->vo_frame.base[0]; uint8_t* cb = (uint8_t *)frame->vo_frame.base[1]; uint8_t* cr = (uint8_t *)frame->vo_frame.base[2]; uint8_t* dst8 = this->video_mem + this->bufinfo.offset; int h, half_width = (frame->width/2); - + for(h = 0; h < frame->height; h++) { xine_fast_memcpy(dst8, y, frame->width); y += frame->width; @@ -247,16 +247,16 @@ static void write_frame_YUV420P3(syncfb_driver_t* this, syncfb_frame_t* frame) for(h = 0; h < (frame->height / 2); h++) { xine_fast_memcpy((dst8 + this->bufinfo.offset_p2), cb, half_width); xine_fast_memcpy((dst8 + this->bufinfo.offset_p3), cr, half_width); - + cb += half_width; cr += half_width; - + dst8 += (this->syncfb_config.src_pitch / 2); } } static void write_frame_YUY2(syncfb_driver_t* this, syncfb_frame_t* frame) -{ +{ uint8_t* src8 = (uint8_t *)frame->vo_frame.base[0]; uint8_t* dst8 = (uint8_t *)(this->video_mem + this->bufinfo.offset); int h, double_width = (frame->width * 2); @@ -271,7 +271,7 @@ static void write_frame_YUY2(syncfb_driver_t* this, syncfb_frame_t* frame) static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) { - switch(frame->format) { + switch(frame->format) { case XINE_IMGFMT_YUY2: if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) write_frame_YUY2(this, frame); @@ -279,7 +279,7 @@ static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_syncfb: error. (YUY2 not supported by your graphic card)\n")); break; - + case XINE_IMGFMT_YV12: switch(this->yuv_format) { case VIDEO_PALETTE_YUV422: @@ -294,14 +294,14 @@ static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) default: xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_syncfb: error. (YV12 not supported by your graphic card)\n")); - } + } break; - + default: xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (unknown frame format)\n"); break; } - + frame->vo_frame.free(&frame->vo_frame); } @@ -321,7 +321,7 @@ static void free_framedata(syncfb_frame_t* frame) free(frame->data_mem[2]); frame->data_mem[2] = NULL; }*/ - + if(frame->vo_frame.base[0]) { free(frame->vo_frame.base[0]); frame->vo_frame.base[0] = NULL; @@ -371,24 +371,24 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) * configuring SyncFB module from this point on. */ syncfb_overlay_off(this); - + /* sanity checking - certain situations *may* crash the SyncFB module, so * take care that we always have valid numbers. */ - if(this->sc.output_xoffset >= 0 && this->sc.output_yoffset >= 0 && - this->cur_frame->width > 0 && this->cur_frame->height > 0 && - this->sc.output_width > 0 && this->sc.output_height > 0 && + if(this->sc.output_xoffset >= 0 && this->sc.output_yoffset >= 0 && + this->cur_frame->width > 0 && this->cur_frame->height > 0 && + this->sc.output_width > 0 && this->sc.output_height > 0 && this->cur_frame->format > 0 && this->video_win_visibility) { - + if(ioctl(this->fd, SYNCFB_GET_CONFIG, &this->syncfb_config)) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + 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; - + if(this->props[VO_PROP_INTERLACED].value) this->syncfb_config.syncfb_mode |= SYNCFB_FEATURE_DEINTERLACE; - + switch(this->cur_frame->format) { case XINE_IMGFMT_YV12: this->syncfb_config.src_palette = this->yuv_format; @@ -397,33 +397,33 @@ static void syncfb_compute_output_size(syncfb_driver_t *this) this->syncfb_config.src_palette = VIDEO_PALETTE_YUV422; break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (unknown frame format)\n"); this->syncfb_config.src_palette = 0; break; } - + this->syncfb_config.fb_screen_size = this->virtual_screen_width * this->virtual_screen_height * (this->screen_depth / 8) * 2; this->syncfb_config.src_width = this->cur_frame->width; this->syncfb_config.src_height = this->cur_frame->height; - + this->syncfb_config.image_width = this->sc.output_width; this->syncfb_config.image_height = this->sc.output_height; - + this->syncfb_config.image_xorg = this->sc.output_xoffset + this->sc.gui_win_x; this->syncfb_config.image_yorg = this->sc.output_yoffset + this->sc.gui_win_y; - + this->syncfb_config.src_crop_top = this->sc.displayed_yoffset; this->syncfb_config.src_crop_bot = (this->props[VO_PROP_INTERLACED].value && this->sc.displayed_yoffset == 0) ? 1 : this->sc.displayed_yoffset; this->syncfb_config.src_crop_left = this->sc.displayed_xoffset; this->syncfb_config.src_crop_right = this->sc.displayed_xoffset; - + this->syncfb_config.default_repeat = (this->props[VO_PROP_INTERLACED].value) ? 1 : this->default_repeat; - + if(this->capabilities.palettes & (1<<this->syncfb_config.src_palette)) { if(ioctl(this->fd,SYNCFB_SET_CONFIG,&this->syncfb_config)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (set_config ioctl failed)\n"); - + syncfb_overlay_on(this); } } @@ -438,16 +438,16 @@ static int syncfb_redraw_needed(vo_driver_t* this_gen) syncfb_driver_t* this = (syncfb_driver_t *) this_gen; int ret = 0; - + if( _x_vo_scale_redraw_needed( &this->sc ) ) { syncfb_compute_output_size (this); syncfb_clean_output_area (this); - + ret = 1; } - + return ret; } @@ -466,7 +466,7 @@ static void syncfb_frame_field (vo_frame_t *vo_img, int which_field) static void syncfb_frame_dispose(vo_frame_t* vo_img) { syncfb_frame_t* frame = (syncfb_frame_t *) vo_img; - + if(frame) { free_framedata(frame); free(frame); @@ -477,17 +477,17 @@ static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) { /* syncfb_driver_t *this = (syncfb_driver_t *) this_gen; */ syncfb_frame_t *frame; - + frame = calloc(1, sizeof(syncfb_frame_t)); 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 */ @@ -495,9 +495,9 @@ static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) 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; } @@ -509,7 +509,7 @@ static void syncfb_update_frame_format(vo_driver_t* this_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) || (frame->height != height) || (frame->format != format)) { @@ -518,7 +518,7 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, printf("video_out_syncfb: debug. (update frame format: old values [width=%d, height=%d, format=%04x], new values [width=%d, height=%d, format=%04x])\n", frame->width, frame->height, frame->format, width, height, format); #endif free_framedata(frame); - + frame->width = width; frame->height = height; frame->format = format; @@ -547,14 +547,14 @@ static void syncfb_update_frame_format(vo_driver_t* this_gen, "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)) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (framedata allocation failed: out of memory)\n"); - + free_framedata(frame); } } @@ -566,7 +566,7 @@ static void syncfb_overlay_blend(vo_driver_t* this_gen, vo_frame_t* frame_gen, v { syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; @@ -600,23 +600,23 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) this->sc.delivered_width = frame->width; this->sc.delivered_height = frame->height; this->sc.delivered_ratio = frame->ratio; - + this->sc.crop_left = frame->vo_frame.crop_left; this->sc.crop_right = frame->vo_frame.crop_right; this->sc.crop_top = frame->vo_frame.crop_top; this->sc.crop_bottom = frame->vo_frame.crop_bottom; syncfb_compute_ideal_size(this); - + this->sc.force_redraw = 1; } - /* + /* * tell gui that we are about to display a frame, * ask for offset and output size - */ + */ syncfb_redraw_needed(this_gen); - + /* the rest is only successful and safe, if the overlay is really on */ if(this->overlay_state) { if(this->bufinfo.id != -1) { @@ -626,16 +626,16 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) return; } - + if(ioctl(this->fd, SYNCFB_REQUEST_BUFFER, &this->bufinfo)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (request ioctl failed)\n"); - + if(this->bufinfo.id == -1) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + 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); - - /* + + /* * there are several "fixable" situations when this request will fail. * for example when the screen resolution changes, the kernel module * will get confused - reinitializing everything will fix things for @@ -643,26 +643,26 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) */ syncfb_compute_ideal_size(this); syncfb_compute_output_size(this); - syncfb_clean_output_area(this); - + syncfb_clean_output_area(this); + return; } - + write_frame_sfb(this, frame); - + if(ioctl(this->fd, SYNCFB_COMMIT_BUFFER, &this->bufinfo)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (commit ioctl failed)\n"); } else frame->vo_frame.free(&frame->vo_frame); - - this->bufinfo.id = -1; + + this->bufinfo.id = -1; } static int syncfb_get_property(vo_driver_t* this_gen, int property) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -683,28 +683,28 @@ static int syncfb_get_property(vo_driver_t* this_gen, int property) this->props[property].value = this->sc.output_yoffset; break; } - + return this->props[property].value; } static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - + switch (property) { case VO_PROP_INTERLACED: this->props[property].value = value; #ifdef DEBUG_OUTPUT - printf("video_out_syncfb: debug. (VO_PROP_INTERLACED(%d))\n", + printf("video_out_syncfb: debug. (VO_PROP_INTERLACED(%d))\n", this->props[property].value); #endif - + syncfb_compute_ideal_size(this); syncfb_compute_output_size(this); - syncfb_clean_output_area(this); + syncfb_clean_output_area(this); break; - + case VO_PROP_ASPECT_RATIO: if(value >= XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; @@ -721,14 +721,14 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) syncfb_compute_output_size(this); syncfb_clean_output_area(this); break; - + case VO_PROP_ZOOM_X: if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; - + syncfb_compute_ideal_size (this); - + this->sc.force_redraw = 1; } /* @@ -740,16 +740,16 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; - + syncfb_compute_ideal_size (this); - + this->sc.force_redraw = 1; } /* printf("video_out_syncfb: info. (the zooming feature is not supported at the moment because of a bug with the SyncFB kernel driver, please refer to README.syncfb)\n"); */ break; - + case VO_PROP_CONTRAST: this->props[property].value = value; @@ -764,7 +764,7 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) this->params.image_height = this->syncfb_config.image_height; this->params.image_xorg = this->syncfb_config.image_xorg; this->params.image_yorg = this->syncfb_config.image_yorg; - + if(ioctl(this->fd,SYNCFB_SET_PARAMS,&this->params)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (setting of contrast value failed)\n"); @@ -778,25 +778,25 @@ static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) printf("video_out_syncfb: debug. (VO_PROP_BRIGHTNESS(%d))\n", this->props[property].value); #endif - + this->params.brightness = value; this->params.contrast = this->props[VO_PROP_CONTRAST].value; this->params.image_width = this->syncfb_config.image_width; /* FIXME */ this->params.image_height = this->syncfb_config.image_height; this->params.image_xorg = this->syncfb_config.image_xorg; this->params.image_yorg = this->syncfb_config.image_yorg; - + if(ioctl(this->fd,SYNCFB_SET_PARAMS,&this->params)) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (setting of brightness value failed)\n"); - + break; - } + } return value; } -static void syncfb_get_property_min_max(vo_driver_t *this_gen, +static void syncfb_get_property_min_max(vo_driver_t *this_gen, int property, int *min, int *max) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; @@ -809,7 +809,7 @@ static int syncfb_gui_data_exchange(vo_driver_t* this_gen, int data_type, void *data) { syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - + switch (data_type) { case XINE_GUI_SEND_DRAWABLE_CHANGED: this->drawable = (Drawable) data; @@ -839,8 +839,8 @@ static int syncfb_gui_data_exchange(vo_driver_t* this_gen, int data_type, this->video_win_visibility = (int)(int *)data; syncfb_compute_output_size(this); break; - */ - + */ + default: return -1; } @@ -854,39 +854,39 @@ static void syncfb_dispose(vo_driver_t *this_gen) /* get it off the screen - I wanna see my desktop again :-) */ syncfb_overlay_off(this); - + /* don't know if it is necessary are even right, but anyway...?! */ - munmap(0, this->capabilities.memory_size); - + munmap(0, this->capabilities.memory_size); + close(this->fd); XLockDisplay (this->display); XFreeGC(this->display, this->gc); XUnlockDisplay (this->display); - + _x_alphablend_free(&this->alphablend_extra_data); - + free(this); } static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) { - + syncfb_class_t *class = (syncfb_class_t *) class_gen; config_values_t *config = class->config; syncfb_driver_t* this; - Display* display = NULL; + Display* display = NULL; unsigned int i; x11_visual_t* visual = (x11_visual_t *) visual_gen; XColor dummy; XWindowAttributes attr; display = visual->display; - + if(!(this = calloc(1, sizeof (syncfb_driver_t)))) return NULL; - + _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + /* check for syncfb device */ if((this->fd = open(class->device_name, O_RDWR)) < 0) { xprintf(class->xine, XINE_VERBOSITY_DEBUG, @@ -894,17 +894,17 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi free(this); return NULL; } - + this->xine = class->xine; /* get capabilities from the syncfb module */ if(ioctl(this->fd, SYNCFB_GET_CAPS, &this->capabilities)) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: aborting. (syncfb_get_caps ioctl failed)\n"); - + close(this->fd); free(this); - + return NULL; } @@ -914,16 +914,16 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if(this->video_mem == MAP_FAILED) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: aborting. (mmap of video memory failed)\n"); - + close(this->fd); free(this); - + return NULL; } - + /* * init properties and capabilities - */ + */ for (i = 0; i<VO_NUM_PROPERTIES; i++) { this->props[i].value = 0; this->props[i].min = 0; @@ -953,13 +953,13 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->yuv_format = VIDEO_PALETTE_YUV420P2; 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)) { + } else if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) { this->supported_capabilities |= VO_CAP_YV12; this->yuv_format = VIDEO_PALETTE_YUV422; 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; xprintf(this->xine, XINE_VERBOSITY_DEBUG, @@ -976,11 +976,11 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi if(!this->supported_capabilities) { 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); + + munmap(0, this->capabilities.memory_size); close(this->fd); free(this); - + return NULL; } @@ -1002,21 +1002,21 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi /* check for virtual screen size and screen depth - this is rather important because that data is later used for free memory calculation */ XGetWindowAttributes(visual->display, DefaultRootWindow(visual->display), &attr); - + this->virtual_screen_height = attr.height; this->virtual_screen_width = attr.width; this->screen_depth = attr.depth; - + /* initialize the rest of the variables now with default values */ this->bufinfo.id = -1; this->config = config; this->cur_frame = NULL; - + /* FIXME: setting the default_repeat to anything higher than 1 will result in a distorted video, so for now, set this manually to 0 until the kernel driver is fixed... */ #if 0 - this->default_repeat = config->register_range(config, + this->default_repeat = config->register_range(config, "video.device.syncfb_default_repeat", 3, 1, 4, _("default number of frame repetitions"), _("This specifies how many times a single video " @@ -1024,7 +1024,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi 10, NULL, NULL); #endif this->default_repeat = 0; - + this->display = visual->display; this->drawable = visual->d; this->gc = XCreateGC (this->display, this->drawable, 0, NULL); @@ -1034,9 +1034,9 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->sc.user_data = visual->user_data; this->overlay = NULL; - this->screen = visual->screen; + this->screen = visual->screen; this->video_win_visibility = 1; - + XAllocNamedColor(this->display, DefaultColormap(this->display, this->screen), "black", &this->black, &dummy); @@ -1084,7 +1084,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { int fd; device_name = xine->config->register_filename(xine->config, "video.device.syncfb_device", "/dev/syncfb", - XINE_CONFIG_STRING_IS_DEVICE_NAME, + XINE_CONFIG_STRING_IS_DEVICE_NAME, _("SyncFB device name"), _("Specifies the file name for the SyncFB (TeleTux) device " "to be used.\nThis setting is security critical, " @@ -1093,7 +1093,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { "So you should be careful that the value you enter " "really is a proper framebuffer device."), XINE_CONFIG_SECURITY, NULL, NULL); - + /* check for syncfb device */ if((fd = open(device_name, O_RDWR)) < 0) { xprintf(xine, XINE_VERBOSITY_DEBUG, @@ -1101,7 +1101,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { return NULL; } close(fd); - + /* * from this point on, nothing should go wrong anymore */ @@ -1115,7 +1115,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->config = xine->config; this->xine = xine; this->device_name = device_name; - + return this; } diff --git a/src/video_out/video_out_syncfb.h b/src/video_out/video_out_syncfb.h index 1fc3df83a..069cbcedc 100644 --- a/src/video_out/video_out_syncfb.h +++ b/src/video_out/video_out_syncfb.h @@ -83,16 +83,16 @@ typedef unsigned char uint_8; #define SYNCFB_FEATURE_SCALE_H 1 #define SYNCFB_FEATURE_SCALE_V 2 #define SYNCFB_FEATURE_SCALE 3 -#define SYNCFB_FEATURE_CROP 4 +#define SYNCFB_FEATURE_CROP 4 #define SYNCFB_FEATURE_OFFSET 8 -#define SYNCFB_FEATURE_DEINTERLACE 16 -#define SYNCFB_FEATURE_PROCAMP 32 -#define SYNCFB_FEATURE_TRANSITIONS 64 -#define SYNCFB_FEATURE_COLKEY 128 -#define SYNCFB_FEATURE_MIRROR_H 256 -#define SYNCFB_FEATURE_MIRROR_V 512 -#define SYNCFB_FEATURE_BLOCK_REQUEST 1024 -#define SYNCFB_FEATURE_FREQDIV2 2048 +#define SYNCFB_FEATURE_DEINTERLACE 16 +#define SYNCFB_FEATURE_PROCAMP 32 +#define SYNCFB_FEATURE_TRANSITIONS 64 +#define SYNCFB_FEATURE_COLKEY 128 +#define SYNCFB_FEATURE_MIRROR_H 256 +#define SYNCFB_FEATURE_MIRROR_V 512 +#define SYNCFB_FEATURE_BLOCK_REQUEST 1024 +#define SYNCFB_FEATURE_FREQDIV2 2048 typedef struct syncfb_config_s @@ -107,7 +107,7 @@ typedef struct syncfb_config_s uint_32 buffers; /* RO, number of available buffers */ uint_32 buffer_size; /* RO, filled in by syncfb */ - uint_32 default_repeat; /* default repeat time for a single frame, can be overridden in syncfb_buffer_info_t */ + uint_32 default_repeat; /* default repeat time for a single frame, can be overridden in syncfb_buffer_info_t */ uint_32 src_width; /* source image width in pixel */ uint_32 src_height; /* source image height in pixel */ @@ -121,7 +121,7 @@ typedef struct syncfb_config_s uint_32 scale_filters; /* 0: no filtering, 255: all filters on */ uint_32 image_width; /* onscreen image width */ uint_32 image_height; /* onscreen image height */ - + /* if syncfb has FEATURE_CROP */ uint_32 src_crop_left; /* */ uint_32 src_crop_right; /* */ @@ -176,8 +176,8 @@ typedef struct syncfb_status_info_s uint_32 skip_field_cnt; /* skipped fields when fifo was about to fill up */ uint_32 request_frames; /* number of request_buffer calls */ - uint_32 commit_frames; /* number of commit_buffer calls */ - + uint_32 commit_frames; /* number of commit_buffer calls */ + uint_32 failed_requests; /* number of calls to request_buffer that failed */ uint_32 buffers_waiting; @@ -188,7 +188,7 @@ typedef struct syncfb_status_info_s -typedef struct syncfb_capability_s +typedef struct syncfb_capability_s { char name[64]; /* A name for the syncfb ... */ uint_32 palettes; /* supported palettes - see videodev.h for palettes, test the corresponding bit here */ diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 482841a09..618ce1023 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.c @@ -7,7 +7,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -65,7 +65,7 @@ #ifdef HAVE_X11 #include "x11osd.h" #endif - + #define NUM_FRAMES 3 typedef struct vidix_driver_s vidix_driver_t; @@ -109,16 +109,16 @@ struct vidix_driver_s { uint32_t colourkey; int use_doublebuffer; - + int supports_yv12; - + pthread_mutex_t mutex; vidix_property_t props[VO_NUM_PROPERTIES]; uint32_t capabilities; int visual_type; - + /* X11 related stuff */ #ifdef HAVE_X11 Display *display; @@ -128,17 +128,17 @@ struct vidix_driver_s { x11osd *xoverlay; int ovl_changed; #endif - + /* fb related stuff */ int fb_width; int fb_height; - + int depth; vo_scale_t sc; int delivered_format; - + xine_t *xine; alphablend_t alphablend_extra_data; @@ -151,7 +151,7 @@ typedef struct vidix_class_s { VDL_HANDLE vidix_handler; vidix_capability_t vidix_cap; - + xine_t *xine; } vidix_class_t; @@ -175,7 +175,7 @@ static void free_framedata(vidix_frame_t* frame) } static void write_frame_YUV420P2(vidix_driver_t* this, vidix_frame_t* frame) -{ +{ uint8_t* y = frame->vo_frame.base[0] + this->sc.displayed_xoffset + this->sc.displayed_yoffset*frame->vo_frame.pitches[0]; uint8_t* cb = frame->vo_frame.base[1] + this->sc.displayed_xoffset/2 + @@ -183,16 +183,16 @@ static void write_frame_YUV420P2(vidix_driver_t* this, vidix_frame_t* frame) uint8_t* cr = frame->vo_frame.base[2]+this->sc.displayed_xoffset/2 + this->sc.displayed_yoffset*frame->vo_frame.pitches[2]/2; uint8_t* dst8 = (this->vidix_mem + - this->vidix_play.offsets[this->next_frame] + + this->vidix_play.offsets[this->next_frame] + this->vidix_play.offset.y); - int h, w; - + int h, w; + for(h = 0; h < this->sc.displayed_height; h++) { xine_fast_memcpy(dst8, y, this->sc.displayed_width); y += frame->vo_frame.pitches[0]; dst8 += this->dstrides.y; } - + dst8 = (this->vidix_mem + this->vidix_play.offsets[this->next_frame] + this->vidix_play.offset.v); @@ -211,7 +211,7 @@ static void write_frame_sfb(vidix_driver_t* this, vidix_frame_t* frame) { uint8_t *base = this->vidix_mem+this->vidix_play.offsets[this->next_frame]; - switch(frame->format) { + switch(frame->format) { case XINE_IMGFMT_YUY2: yuy2_to_yuy2( /* src */ @@ -223,7 +223,7 @@ static void write_frame_sfb(vidix_driver_t* this, vidix_frame_t* frame) /* width x height */ this->sc.displayed_width, this->sc.displayed_height); break; - + case XINE_IMGFMT_YV12: { uint8_t* y = frame->vo_frame.base[0] + this->sc.displayed_xoffset + this->sc.displayed_yoffset*frame->vo_frame.pitches[0]; @@ -231,7 +231,7 @@ static void write_frame_sfb(vidix_driver_t* this, vidix_frame_t* frame) this->sc.displayed_yoffset*frame->vo_frame.pitches[1]/2; uint8_t* cr = frame->vo_frame.base[2] + this->sc.displayed_xoffset/2 + this->sc.displayed_yoffset*frame->vo_frame.pitches[2]/2; - + if(this->supports_yv12) { if(this->vidix_play.flags & VID_PLAY_INTERLEAVED_UV) write_frame_YUV420P2(this, frame); @@ -262,9 +262,9 @@ static void write_frame_sfb(vidix_driver_t* this, vidix_frame_t* frame) frame->vo_frame.progressive_frame); break; } - + default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: error. (unknown frame format %04x)\n", frame->format); break; } @@ -276,11 +276,11 @@ static void vidix_clean_output_area(vidix_driver_t *this) { if(this->visual_type == XINE_VISUAL_TYPE_X11) { #ifdef HAVE_X11 int i; - - XLockDisplay(this->display); - + + XLockDisplay(this->display); + XSetForeground(this->display, this->gc, BlackPixel(this->display, this->screen)); - + for( i = 0; i < 4; i++ ) { if( this->sc.border[i].w && this->sc.border[i].h ) { XFillRectangle(this->display, this->drawable, this->gc, @@ -288,15 +288,15 @@ static void vidix_clean_output_area(vidix_driver_t *this) { this->sc.border[i].w, this->sc.border[i].h); } } - + XSetForeground(this->display, this->gc, this->colourkey); XFillRectangle(this->display, this->drawable, this->gc, this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); - + if (this->xoverlay) { x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + XFlush(this->display); XUnlockDisplay(this->display); @@ -326,12 +326,12 @@ static void vidix_update_colourkey(vidix_driver_t *this) { default: break; } - + vidix_clean_output_area(this); - + vdlSetGrKeys(this->vidix_handler, &this->vidix_grkey); } - + static uint32_t vidix_get_capabilities (vo_driver_t *this_gen) { @@ -362,7 +362,7 @@ static void vidix_frame_dispose (vo_frame_t *vo_img) { vidix_frame_t *frame = (vidix_frame_t *) vo_img ; - free_framedata(frame); + free_framedata(frame); free (frame); } @@ -375,7 +375,7 @@ static vo_frame_t *vidix_alloc_frame (vo_driver_t *this_gen) { 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; @@ -407,33 +407,33 @@ static void vidix_config_playback (vidix_driver_t *this) { uint32_t apitch; int err,i; - + _x_vo_scale_compute_output_size( &this->sc ); - + /* We require that the displayed xoffset and width are even. * To prevent displaying more than we're supposed to we round the * xoffset up and the width down */ this->sc.displayed_xoffset = (this->sc.displayed_xoffset+1) & ~1; this->sc.displayed_width = this->sc.displayed_width & ~1; - + /* For yv12 source displayed yoffset and height need to be even too */ if(this->delivered_format == XINE_IMGFMT_YV12) { this->sc.displayed_yoffset = (this->sc.displayed_yoffset+1) & ~1; this->sc.displayed_height = this->sc.displayed_height & ~1; } - + if( this->vidix_started > 0 ) { lprintf("video_out_vidix: overlay off\n"); vdlPlaybackOff(this->vidix_handler); } memset(&this->vidix_play,0,sizeof(vidix_playback_t)); - + if(this->delivered_format == XINE_IMGFMT_YV12 && this->supports_yv12) this->vidix_play.fourcc = IMGFMT_YV12; else this->vidix_play.fourcc = IMGFMT_YUY2; - + this->vidix_play.capability = this->vidix_cap.flags; /* every ;) */ this->vidix_play.blend_factor = 0; /* for now */ this->vidix_play.src.x = 0; @@ -449,7 +449,7 @@ static void vidix_config_playback (vidix_driver_t *this) { if((err=vdlConfigPlayback(this->vidix_handler,&this->vidix_play))!=0) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: Can't configure playback: %s\n",strerror(err)); this->vidix_started = -1; return; @@ -458,27 +458,27 @@ static void vidix_config_playback (vidix_driver_t *this) { lprintf("video_out_vidix: dga_addr = %p frame_size = %u frames = %u\n", this->vidix_play.dga_addr, this->vidix_play.frame_size, this->vidix_play.num_frames ); - + lprintf("video_out_vidix: offsets[0..2] = %u %u %u\n", this->vidix_play.offsets[0], this->vidix_play.offsets[1], this->vidix_play.offsets[2] ); - + lprintf("video_out_vidix: offset.y/u/v = %u/%u/%u\n", this->vidix_play.offset.y, this->vidix_play.offset.u, this->vidix_play.offset.v ); - + lprintf("video_out_vidix: src.x/y/w/h = %u/%u/%u/%u\n", this->vidix_play.src.x, this->vidix_play.src.y, this->vidix_play.src.w, this->vidix_play.src.h ); - + lprintf("video_out_vidix: dest.x/y/w/h = %u/%u/%u/%u\n", this->vidix_play.dest.x, this->vidix_play.dest.y, this->vidix_play.dest.w, this->vidix_play.dest.h ); - + lprintf("video_out_vidix: dest.pitch.y/u/v = %u/%u/%u\n", this->vidix_play.dest.pitch.y, this->vidix_play.dest.pitch.u, this->vidix_play.dest.pitch.v ); - + this->vidix_mem = this->vidix_play.dga_addr; this->next_frame = 0; @@ -502,7 +502,7 @@ static void vidix_config_playback (vidix_driver_t *this) { this->dstrides.y = (this->sc.displayed_width*2 + apitch) & ~apitch; break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: error. (unknown frame format: %04x)\n", this->delivered_format); } @@ -517,7 +517,7 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, 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) || (frame->height != height) || (frame->format != format)) { @@ -525,9 +525,9 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, /* * (re-) allocate image */ - + free_framedata(frame); - + frame->width = width; frame->height = height; frame->format = format; @@ -548,15 +548,15 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, frame->vo_frame.base[2] = NULL; break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + 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)) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: error. (framedata allocation failed: out of memory)\n"); - + free_framedata(frame); } } @@ -564,7 +564,7 @@ static void vidix_update_frame_format (vo_driver_t *this_gen, frame->ratio = ratio; } -static void vidix_overlay_begin (vo_driver_t *this_gen, +static void vidix_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { vidix_driver_t *this = (vidix_driver_t *) this_gen; @@ -573,11 +573,11 @@ static void vidix_overlay_begin (vo_driver_t *this_gen, if( this->ovl_changed && this->xoverlay ) { XLockDisplay (this->display); - x11osd_clear(this->xoverlay); + x11osd_clear(this->xoverlay); XUnlockDisplay (this->display); } #endif - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -603,17 +603,17 @@ static void vidix_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, v vidix_frame_t *frame = (vidix_frame_t *) frame_gen; vidix_driver_t *this = (vidix_driver_t *) this_gen; - + if (overlay->rle) { if( overlay->unscaled ) { #ifdef HAVE_X11 if( this->ovl_changed && this->xoverlay ) { XLockDisplay (this->display); - x11osd_blend(this->xoverlay, overlay); + x11osd_blend(this->xoverlay, overlay); XUnlockDisplay (this->display); } #endif - } else { + } else { if( frame->format == XINE_IMGFMT_YV12 ) _x_blend_yuv( frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); else @@ -649,25 +649,25 @@ static void vidix_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) + || (frame->ratio != this->sc.delivered_ratio) || (frame->format != this->delivered_format ) ) { lprintf("video_out_vidix: change frame format\n"); - + this->sc.delivered_width = frame->width; this->sc.delivered_height = frame->height; this->sc.delivered_ratio = frame->ratio; this->delivered_format = frame->format; - + this->sc.crop_left = frame->vo_frame.crop_left; this->sc.crop_right = frame->vo_frame.crop_right; this->sc.crop_top = frame->vo_frame.crop_top; this->sc.crop_bottom = frame->vo_frame.crop_bottom; - + vidix_compute_ideal_size( this ); this->sc.force_redraw = 1; } - - /* + + /* * check if we have to reconfigure vidix because of * format/window position change */ @@ -692,7 +692,7 @@ static void vidix_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int vidix_get_property (vo_driver_t *this_gen, int property) { vidix_driver_t *this = (vidix_driver_t *) this_gen; - + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -713,7 +713,7 @@ static int vidix_get_property (vo_driver_t *this_gen, int property) { this->props[property].value = this->sc.output_yoffset; break; } - + lprintf ("video_out_vidix: property #%d = %d\n", property, this->props[property].value); @@ -726,91 +726,91 @@ static int vidix_set_property (vo_driver_t *this_gen, vidix_driver_t *this = (vidix_driver_t *) this_gen; int err; - + if ((value >= this->props[property].min) && (value <= this->props[property].max)) { this->props[property].value = value; - + if ( property == VO_PROP_ASPECT_RATIO) { lprintf("video_out_vidix: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); - + if(value == XINE_VO_ASPECT_NUM_RATIOS) value = this->props[property].value = XINE_VO_ASPECT_AUTO; - this->sc.user_ratio = value; + this->sc.user_ratio = value; vidix_compute_ideal_size (this); this->sc.force_redraw = 1; - } + } if ( property == VO_PROP_ZOOM_X ) { this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; vidix_compute_ideal_size (this); this->sc.force_redraw = 1; - } + } if ( property == VO_PROP_ZOOM_Y ) { this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; vidix_compute_ideal_size (this); this->sc.force_redraw = 1; - } - + } + if ( property == VO_PROP_HUE ) { this->vidix_eq.cap = VEQ_CAP_HUE; this->vidix_eq.hue = value; - + if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set hue: %s\n", strerror(err)); } - + if ( property == VO_PROP_SATURATION ) { this->vidix_eq.cap = VEQ_CAP_SATURATION; this->vidix_eq.saturation = value; - + if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set saturation: %s\n", strerror(err)); } - + if ( property == VO_PROP_BRIGHTNESS ) { this->vidix_eq.cap = VEQ_CAP_BRIGHTNESS; this->vidix_eq.brightness = value; - + if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set brightness: %s\n", strerror(err)); } - + if ( property == VO_PROP_CONTRAST ) { this->vidix_eq.cap = VEQ_CAP_CONTRAST; this->vidix_eq.contrast = value; - + if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq)) != 0) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set contrast: %s\n", strerror(err)); } } - + return value; } static void vidix_ckey_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) { - vidix_driver_t *this = (vidix_driver_t *) this_gen; - + vidix_driver_t *this = (vidix_driver_t *) this_gen; + if(strcmp(entry->key, "video.device.vidix_colour_key_red") == 0) { this->vidix_grkey.ckey.red = entry->num_value; } - + if(strcmp(entry->key, "video.device.vidix_colour_key_green") == 0) { this->vidix_grkey.ckey.green = entry->num_value; } - + if(strcmp(entry->key, "video.device.vidix_colour_key_blue") == 0) { this->vidix_grkey.ckey.blue = entry->num_value; } - + vidix_update_colourkey(this); this->sc.force_redraw = 1; } @@ -818,7 +818,7 @@ static void vidix_ckey_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) static void vidix_db_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) { - vidix_driver_t *this = (vidix_driver_t *) this_gen; + vidix_driver_t *this = (vidix_driver_t *) this_gen; this->use_doublebuffer = entry->num_value; this->sc.force_redraw = 1; @@ -828,16 +828,16 @@ static void vidix_db_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) { static void vidix_rgb_callback(vo_driver_t *this_gen, xine_cfg_entry_t *entry) { int err; vidix_driver_t *this = (vidix_driver_t *) this_gen; - + this->vidix_eq.cap = VEQ_CAP_RGB_INTENSITY; - + if(!strcmp(entry->key, "video.output.vidix_red_intensity")) { this->vidix_eq.red_intensity = entry->num_value; } else if(!strcmp(entry->key, "video.output.vidix_green_intensity")) { this->vidix_eq.green_intensity = entry->num_value; } else if(!strcmp(entry->key, "video.output.vidix_blue_intensity")) { this->vidix_eq.blue_intensity = entry->num_value; - } + } if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq))) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); @@ -860,12 +860,12 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, vidix_driver_t *this = (vidix_driver_t *) this_gen; pthread_mutex_lock(&this->mutex); - + switch (data_type) { case XINE_GUI_SEND_DRAWABLE_CHANGED: lprintf ("video_out_vidix: GUI_DATA_EX_DRAWABLE_CHANGED\n"); - + if(this->visual_type == XINE_VISUAL_TYPE_X11) { #ifdef HAVE_X11 this->drawable = (Drawable) data; @@ -879,7 +879,7 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, #endif } break; - + case XINE_GUI_SEND_EXPOSE_EVENT: lprintf ("video_out_vidix: GUI_DATA_EX_EXPOSE_EVENT\n"); vidix_clean_output_area(this); @@ -908,7 +908,7 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, rect->h = y2-y1; } break; - + default: ret = -1; } @@ -916,7 +916,7 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, return ret; } - + static void vidix_exit (vo_driver_t *this_gen) { vidix_driver_t *this = (vidix_driver_t *) this_gen; @@ -937,7 +937,7 @@ static void vidix_exit (vo_driver_t *this_gen) { #endif _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -946,30 +946,30 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { config_values_t *config = class->config; vidix_driver_t *this; int err; - + this = (vidix_driver_t *) calloc(1, sizeof(vidix_driver_t)); if (!this) return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + pthread_mutex_init (&this->mutex, NULL); this->vidix_handler = class->vidix_handler; this->vidix_cap = class->vidix_cap; _x_vo_scale_init( &this->sc, 1, /*this->vidix_cap.flags & FLAG_UPSCALER,*/ 0, config ); - + this->xine = class->xine; this->config = config; - + this->got_frame_data = 0; this->capabilities = VO_CAP_CROP; /* 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_DEBUG, + 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) { @@ -977,48 +977,48 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { this->props[VO_PROP_BRIGHTNESS].min = -1000; this->props[VO_PROP_BRIGHTNESS].max = 1000; } - + if(this->vidix_eq.cap & VEQ_CAP_CONTRAST) { this->props[VO_PROP_CONTRAST].value = 0; this->props[VO_PROP_CONTRAST].min = -1000; this->props[VO_PROP_CONTRAST].max = 1000; } - + if(this->vidix_eq.cap & VEQ_CAP_SATURATION) { this->props[VO_PROP_SATURATION].value = 0; this->props[VO_PROP_SATURATION].min = -1000; this->props[VO_PROP_SATURATION].max = 1000; } - + if(this->vidix_eq.cap & VEQ_CAP_HUE) { this->props[VO_PROP_HUE].value = 0; this->props[VO_PROP_HUE].min = -1000; this->props[VO_PROP_HUE].max = 1000; } - + if(this->vidix_eq.cap & VEQ_CAP_RGB_INTENSITY) { this->vidix_eq.red_intensity = config->register_range(config, - "video.output.vidix_red_intensity", 0, -1000, 1000, + "video.output.vidix_red_intensity", 0, -1000, 1000, _("red intensity"), _("The intensity of the red colour components."), 10, - (void*) vidix_rgb_callback, this); + (void*) vidix_rgb_callback, this); this->vidix_eq.green_intensity = config->register_range(config, - "video.output.vidix_green_intensity", 0, -1000, 1000, + "video.output.vidix_green_intensity", 0, -1000, 1000, _("green intensity"), _("The intensity of the green colour components."), 10, (void*) vidix_rgb_callback, this); this->vidix_eq.blue_intensity = config->register_range(config, - "video.output.vidix_blue_intensity", 0, -1000, 1000, + "video.output.vidix_blue_intensity", 0, -1000, 1000, _("blue intensity"), _("The intensity of the blue colour components."), 10, (void*) vidix_rgb_callback, this); - + if((err = vdlPlaybackSetEq(this->vidix_handler, &this->vidix_eq))) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: can't set rgb intensity: %s\n", strerror(err)); - } + } } } - + /* Configuration for double buffering */ this->use_doublebuffer = config->register_bool(config, "video.device.vidix_double_buffer", 1, _("enable double buffering"), @@ -1026,20 +1026,20 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { "screen (\"vertical retrace\"). This eliminates flickering and tearing artifacts, but will use " "more graphics memory."), 20, (void*) vidix_db_callback, this); - + /* Set up remaining props */ this->props[VO_PROP_ASPECT_RATIO].value = XINE_VO_ASPECT_AUTO; this->props[VO_PROP_ASPECT_RATIO].min = 0; this->props[VO_PROP_ASPECT_RATIO].max = XINE_VO_ASPECT_NUM_RATIOS; - + this->props[VO_PROP_ZOOM_X].value = 100; this->props[VO_PROP_ZOOM_X].min = XINE_VO_ZOOM_MIN; this->props[VO_PROP_ZOOM_X].max = XINE_VO_ZOOM_MAX; - + this->props[VO_PROP_ZOOM_Y].value = 100; this->props[VO_PROP_ZOOM_Y].min = XINE_VO_ZOOM_MIN; this->props[VO_PROP_ZOOM_Y].max = XINE_VO_ZOOM_MAX; - + this->vo_driver.get_capabilities = vidix_get_capabilities; this->vo_driver.alloc_frame = vidix_alloc_frame; this->vo_driver.update_frame_format = vidix_update_frame_format; @@ -1060,23 +1060,23 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) { static void query_fourccs (vidix_driver_t *this) { vidix_fourcc_t vidix_fourcc; int err; - + /* Detect if YUY2 is supported */ memset(&vidix_fourcc, 0, sizeof(vidix_fourcc_t)); vidix_fourcc.fourcc = IMGFMT_YUY2; vidix_fourcc.depth = this->depth; - + 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")); } - + /* Detect if YV12 is supported - we always support yv12 but we need to know if we have to convert */ this->capabilities |= VO_CAP_YV12; vidix_fourcc.fourcc = IMGFMT_YV12; - + if((err = vdlQueryFourcc(this->vidix_handler, &vidix_fourcc)) == 0) { this->supports_yv12 = 1; xprintf(this->xine, XINE_VERBOSITY_LOG, @@ -1088,14 +1088,14 @@ static void query_fourccs (vidix_driver_t *this) { static void *init_class (xine_t *xine, void *visual_gen) { vidix_class_t *this; int err; - + this = (vidix_class_t *) calloc(1, sizeof(vidix_class_t)); if (!this) return NULL; - + if(vdlGetVersion() != VIDIX_VERSION) { - xprintf(xine, XINE_VERBOSITY_LOG, + xprintf(xine, XINE_VERBOSITY_LOG, _("video_out_vidix: You have wrong version of VIDIX library\n")); free(this); return NULL; @@ -1110,18 +1110,18 @@ static void *init_class (xine_t *xine, void *visual_gen) { } if((err=vdlGetCapability(this->vidix_handler,&this->vidix_cap)) != 0) { - xprintf(xine, XINE_VERBOSITY_DEBUG, + 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, + 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; - + return this; } @@ -1138,63 +1138,63 @@ static vo_driver_t *vidix_open_plugin (video_driver_class_t *class_gen, const vo vidix_driver_t *this = open_plugin(class_gen); config_values_t *config = this->config; x11_visual_t *visual = (x11_visual_t *) visual_gen; - XWindowAttributes window_attributes; - + XWindowAttributes window_attributes; + this->visual_type = XINE_VISUAL_TYPE_X11; - + this->display = visual->display; this->screen = visual->screen; this->drawable = visual->d; this->gc = XCreateGC(this->display, this->drawable, 0, NULL); this->xoverlay = NULL; this->ovl_changed = 0; - + XGetWindowAttributes(this->display, this->drawable, &window_attributes); this->sc.gui_width = window_attributes.width; this->sc.gui_height = window_attributes.height; this->depth = window_attributes.depth; - + this->sc.frame_output_cb = visual->frame_output_cb; this->sc.user_data = visual->user_data; - - /* We'll assume all drivers support colour keying (which they do + + /* We'll assume all drivers support colour keying (which they do at the moment) */ this->vidix_grkey.ckey.op = CKEY_TRUE; - + /* Colour key components */ this->vidix_grkey.ckey.red = config->register_range(config, - "video.device.vidix_colour_key_red", 255, 0, 255, + "video.device.vidix_colour_key_red", 255, 0, 255, _("video overlay colour key red component"), _("The colour key is used to tell the graphics card where to overlay the video image. " "Try different values, if you experience windows becoming transparent."), 20, - (void*) vidix_ckey_callback, this); - + (void*) vidix_ckey_callback, this); + this->vidix_grkey.ckey.green = config->register_range(config, - "video.device.vidix_colour_key_green", 0, 0, 255, + "video.device.vidix_colour_key_green", 0, 0, 255, _("video overlay colour key green component"), _("The colour key is used to tell the graphics card where to overlay the video image. " "Try different values, if you experience windows becoming transparent."), 20, - (void*) vidix_ckey_callback, this); - + (void*) vidix_ckey_callback, this); + this->vidix_grkey.ckey.blue = config->register_range(config, - "video.device.vidix_colour_key_blue", 255, 0, 255, + "video.device.vidix_colour_key_blue", 255, 0, 255, _("video overlay colour key blue component"), _("The colour key is used to tell the graphics card where to overlay the video image. " "Try different values, if you experience windows becoming transparent."), 20, - (void*) vidix_ckey_callback, this); - + (void*) vidix_ckey_callback, this); + vidix_update_colourkey(this); query_fourccs(this); XLockDisplay (this->display); - if(this->colourkey) { + if(this->colourkey) { this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable, X11OSD_COLORKEY); if(this->xoverlay) x11osd_colorkey(this->xoverlay, this->colourkey, &this->sc); } else { - this->xoverlay = x11osd_create (this->xine, this->display, this->screen, + this->xoverlay = x11osd_create (this->xine, this->display, this->screen, this->drawable, X11OSD_SHAPED); } XUnlockDisplay (this->display); @@ -1216,14 +1216,14 @@ static char* vidix_get_description (video_driver_class_t *this_gen) { static void *vidix_init_class (xine_t *xine, void *visual_gen) { vidix_class_t *this = init_class (xine, visual_gen); - + if(this) { this->driver_class.open_plugin = vidix_open_plugin; this->driver_class.get_identifier = vidix_get_identifier; this->driver_class.get_description = vidix_get_description; this->driver_class.dispose = dispose_class; } - + return this; } @@ -1240,9 +1240,9 @@ static vo_driver_t *vidixfb_open_plugin (video_driver_class_t *class_gen, const char *device; int fd; struct fb_var_screeninfo fb_var; - + this->visual_type = XINE_VISUAL_TYPE_FB; - + /* Register config option for fb device */ device = config->register_filename(config, "video.device.vidixfb_device", "/dev/fb0", XINE_CONFIG_STRING_IS_DEVICE_NAME, _("framebuffer device name"), @@ -1251,45 +1251,45 @@ static vo_driver_t *vidixfb_open_plugin (video_driver_class_t *class_gen, const "can be used to fill this file with arbitrary content. So you should be careful that " "the value you enter really is a proper framebuffer device."), XINE_CONFIG_SECURITY, NULL, NULL); - + /* Open fb device for reading */ if((fd = open("/dev/fb0", O_RDONLY)) < 0) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + 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) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_vidix: error in ioctl FBIOGET_VSCREENINFO: %s", strerror(errno)); close(fd); return NULL; } - + /* Store screen bpp and dimensions */ this->depth = fb_var.bits_per_pixel; this->fb_width = fb_var.xres; this->fb_height = fb_var.yres; - + /* Close device */ close(fd); - + this->sc.frame_output_cb = vidixfb_frame_output_cb; this->sc.user_data = this; - + /* Make sure colour keying is turned off */ this->vidix_grkey.ckey.op = CKEY_FALSE; vdlSetGrKeys(this->vidix_handler, &this->vidix_grkey); - + query_fourccs(this); - + return &this->vo_driver; } static char* vidixfb_get_identifier (video_driver_class_t *this_gen) { return "vidixfb"; -} +} static char* vidixfb_get_description (video_driver_class_t *this_gen) { return _("xine video output plugin using libvidix for linux frame buffer"); @@ -1298,14 +1298,14 @@ static char* vidixfb_get_description (video_driver_class_t *this_gen) { static void *vidixfb_init_class (xine_t *xine, void *visual_gen) { vidix_class_t *this = init_class (xine, visual_gen); - + if(this) { this->driver_class.open_plugin = vidixfb_open_plugin; this->driver_class.get_identifier = vidixfb_get_identifier; this->driver_class.get_description = vidixfb_get_description; this->driver_class.dispose = dispose_class; } - + return this; } @@ -1320,7 +1320,7 @@ static const vo_info_t vo_info_vidixfb = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ #ifdef HAVE_X11 { PLUGIN_VIDEO_OUT, 21, "vidix", XINE_VERSION_CODE, &vo_info_vidix, vidix_init_class }, #endif diff --git a/src/video_out/video_out_xcbshm.c b/src/video_out/video_out_xcbshm.c index a5282a24f..c93cf8c1e 100644 --- a/src/video_out/video_out_xcbshm.c +++ b/src/video_out/video_out_xcbshm.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2003, 2007 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -23,7 +23,7 @@ * Aaron Holtzman <aholtzma@ess.engr.uvic.ca> * * xine-specific code by Guenter Bartsch <bartscgr@studbox.uni-stuttgart.de> - * + * * ported to xcb by Christoph Pfister - Feb 2007 */ @@ -71,7 +71,7 @@ typedef struct { int flags; vo_scale_t sc; - + uint8_t *image; int bytes_per_line; xcb_shm_seg_t shmseg; @@ -96,7 +96,7 @@ typedef struct { int bpp; int scanline_pad; int use_shm; - + int yuv2rgb_brightness; int yuv2rgb_contrast; int yuv2rgb_saturation; @@ -104,7 +104,7 @@ typedef struct { yuv2rgb_factory_t *yuv2rgb_factory; vo_scale_t sc; - + xshm_frame_t *cur_frame; xcbosd *xoverlay; int ovl_changed; @@ -126,7 +126,7 @@ typedef struct { /* - * allocate an XImage, try XShm first but fall back to + * allocate an XImage, try XShm first but fall back to * plain X11 if XShm should fail */ static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, int height) @@ -151,9 +151,9 @@ static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, i "video_out_xcbshm: => not using MIT Shared Memory extension.\n"), strerror(errno)); goto shm_fail1; } - + frame->image = shmat(shmid, 0, 0); - + if (frame->image == ((void *) -1)) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xcbshm: shared memory error (address error) when allocating image \n" @@ -173,10 +173,10 @@ static void create_ximage(xshm_driver_t *this, xshm_frame_t *frame, int width, i goto shm_fail3; } - /* + /* * Now that the Xserver has learned about and attached to the * shared memory segment, delete it. It's actually deleted by - * the kernel when all users of that segment have detached from + * the kernel when all users of that segment have detached from * it. Gives an automatic shared memory cleanup in case we crash. */ @@ -229,10 +229,10 @@ static uint32_t xshm_get_capabilities (vo_driver_t *this_gen) { static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { xshm_frame_t *frame = (xshm_frame_t *) vo_img ; /*xshm_driver_t *this = (xshm_driver_t *) vo_img->driver; */ - - vo_img->proc_called = 1; - - if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || + + vo_img->proc_called = 1; + + if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || frame->vo_frame.crop_right || frame->vo_frame.crop_bottom ) { /* we don't support crop, so don't even waste cpu cycles. @@ -240,7 +240,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { */ return; } - + lprintf ("copy... (format %d)\n", frame->format); if (frame->format == XINE_IMGFMT_YV12) @@ -249,7 +249,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { else frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0]); - + lprintf ("copy...done\n"); } @@ -306,10 +306,10 @@ static vo_frame_t *xshm_alloc_frame (vo_driver_t *this_gen) { /* * supply required functions/fields */ - + frame->vo_frame.proc_slice = xshm_frame_proc_slice; frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = xshm_frame_field; + frame->vo_frame.field = xshm_frame_field; frame->vo_frame.dispose = xshm_frame_dispose; frame->vo_frame.driver = this_gen; @@ -369,7 +369,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->sc.video_pixel_aspect, &gui_width, &gui_height, &gui_pixel_aspect); - + /* find out if we need to adapt this frame */ do_adapt = 0; @@ -394,7 +394,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->sc.user_ratio = this->sc.user_ratio; xshm_compute_ideal_size (this, frame); - + /* now we have updated video_aspect_pixel we use the callback */ /* again to obtain the correct gui_width and gui_height values. */ frame->sc.dest_size_cb (frame->sc.user_data, width, height, @@ -402,20 +402,20 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, &gui_width, &gui_height, &gui_pixel_aspect); } - + if ((frame->sc.gui_width != gui_width) || (frame->sc.gui_height != gui_height) || do_adapt) { - + do_adapt = 1; frame->sc.gui_width = gui_width; frame->sc.gui_height = gui_height; - + xshm_compute_rgb_size (this, frame); - + lprintf ("gui_size has changed => adapt\n"); } - + /* ok, now do what we have to do */ @@ -469,7 +469,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, lprintf ("stripe out_ht=%i, deliv_ht=%i\n", frame->sc.output_height, frame->sc.delivered_height); - /* + /* * set up colorspace converter */ @@ -525,7 +525,7 @@ static void xshm_overlay_clut_yuv2rgb(xshm_driver_t *this, vo_overlay_t *overla } } -static void xshm_overlay_begin (vo_driver_t *this_gen, +static void xshm_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -536,7 +536,7 @@ static void xshm_overlay_begin (vo_driver_t *this_gen, xcbosd_clear(this->xoverlay); pthread_mutex_unlock(&this->main_mutex); } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -553,7 +553,7 @@ static void xshm_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { this->ovl_changed = 0; } -static void xshm_overlay_blend (vo_driver_t *this_gen, +static void xshm_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xshm_driver_t *this = (xshm_driver_t *) this_gen; xshm_frame_t *frame = (xshm_frame_t *) frame_gen; @@ -569,7 +569,7 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, } else { if (!overlay->rgb_clut || !overlay->hili_rgb_clut) xshm_overlay_clut_yuv2rgb (this, overlay, frame); - + switch (this->bpp) { case 16: _x_blend_rgb16(frame->image, overlay, @@ -590,7 +590,7 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, &this->alphablend_extra_data); break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "xine-lib:video_out_xcbshm: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; @@ -603,11 +603,11 @@ static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) { int i; xcb_rectangle_t rects[4]; int rects_count = 0; - + memcpy( this->sc.border, frame->sc.border, sizeof(this->sc.border) ); - + pthread_mutex_lock(&this->main_mutex); - + for( i = 0; i < 4; i++ ) { if( this->sc.border[i].w && this->sc.border[i].h ) rects[rects_count].x = this->sc.border[i].x; @@ -624,7 +624,7 @@ static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) { xcbosd_resize(this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + pthread_mutex_unlock(&this->main_mutex); } @@ -636,15 +636,15 @@ static int xshm_redraw_needed (vo_driver_t *this_gen) { this->sc.delivered_height = this->cur_frame->sc.delivered_height; this->sc.delivered_width = this->cur_frame->sc.delivered_width; this->sc.video_pixel_aspect = this->cur_frame->sc.video_pixel_aspect; - if( _x_vo_scale_redraw_needed( &this->sc ) ) { + if( _x_vo_scale_redraw_needed( &this->sc ) ) { clean_output_area (this, this->cur_frame); ret = 1; } - } + } else ret = 1; - + return ret; } @@ -657,22 +657,22 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { frame->vo_frame.id, frame->sc.output_width, frame->sc.output_height); - /* + /* * tell gui that we are about to display a frame, * ask for offset */ - + this->sc.delivered_height = frame->sc.delivered_height; this->sc.delivered_width = frame->sc.delivered_width; this->sc.video_pixel_aspect = frame->sc.video_pixel_aspect; - if( _x_vo_scale_redraw_needed( &this->sc ) ) { + if( _x_vo_scale_redraw_needed( &this->sc ) ) { clean_output_area (this, frame); } - + if (this->cur_frame) { - if ( (this->cur_frame->sc.output_width != frame->sc.output_width) + if ( (this->cur_frame->sc.output_width != frame->sc.output_width) || (this->cur_frame->sc.output_height != frame->sc.output_height) || (this->cur_frame->sc.output_xoffset != frame->sc.output_xoffset) || (this->cur_frame->sc.output_yoffset != frame->sc.output_yoffset) ) @@ -682,10 +682,10 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { } this->cur_frame = frame; - + pthread_mutex_lock(&this->main_mutex); lprintf ("display locked...\n"); - + if (frame->shmseg) { lprintf ("put image (shm)\n"); @@ -736,14 +736,14 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_OUTPUT_YOFFSET: return this->cur_frame->sc.output_yoffset; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xcbshm: tried to get unsupported property %d\n", property); } return 0; } -static int xshm_set_property (vo_driver_t *this_gen, +static int xshm_set_property (vo_driver_t *this_gen, int property, int value) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -752,7 +752,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_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xcbshm: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); } else if (property == VO_PROP_BRIGHTNESS) { @@ -786,7 +786,7 @@ static int xshm_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; } else { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xcbshm: tried to set unsupported property %d\n", property); } @@ -812,7 +812,7 @@ static void xshm_get_property_min_max (vo_driver_t *this_gen, } } -static int xshm_gui_data_exchange (vo_driver_t *this_gen, +static int xshm_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -823,17 +823,17 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, #endif case XINE_GUI_SEND_EXPOSE_EVENT: - + lprintf ("expose event\n"); if (this->cur_frame) { xcb_expose_event_t *xev = (xcb_expose_event_t *) data; - + if (xev && xev->count == 0) { int i; xcb_rectangle_t rects[4]; int rects_count = 0; - + pthread_mutex_lock(&this->main_mutex); if (this->cur_frame->shmseg) xcb_shm_put_image(this->connection, this->window, this->gc, this->cur_frame->sc.output_width, @@ -868,7 +868,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, } } break; - + case XINE_GUI_SEND_DRAWABLE_CHANGED: this->window = (xcb_window_t) data; @@ -887,7 +887,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, if (this->cur_frame) { x11_rectangle_t *rect = data; int x1, y1, x2, y2; - + _x_vo_scale_translate_gui2video(&this->cur_frame->sc, rect->x, rect->y, &x1, &y1); @@ -910,16 +910,16 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, static void xshm_dispose (vo_driver_t *this_gen) { xshm_driver_t *this = (xshm_driver_t *) this_gen; - + if (this->cur_frame) this->cur_frame->vo_frame.dispose (&this->cur_frame->vo_frame); this->yuv2rgb_factory->dispose (this->yuv2rgb_factory); - + pthread_mutex_lock(&this->main_mutex); xcb_free_gc(this->connection, this->gc); pthread_mutex_unlock(&this->main_mutex); - + if( this->xoverlay ) { pthread_mutex_lock(&this->main_mutex); xcbosd_destroy(this->xoverlay); @@ -929,7 +929,7 @@ static void xshm_dispose (vo_driver_t *this_gen) { pthread_mutex_destroy(&this->main_mutex); _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -1014,7 +1014,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void xcb_get_geometry_reply_t *geometry_reply; const xcb_query_extension_reply_t *query_extension_reply; - + this = (xshm_driver_t *) calloc(1, sizeof(xshm_driver_t)); if (!this) @@ -1023,7 +1023,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void pthread_mutex_init(&this->main_mutex, NULL); _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->connection = visual->connection; this->screen = visual->screen; this->window = visual->window; @@ -1032,15 +1032,15 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void this->sc.frame_output_cb = visual->frame_output_cb; this->sc.dest_size_cb = visual->dest_size_cb; this->sc.user_data = visual->user_data; - + this->sc.user_ratio = XINE_VO_ASPECT_AUTO; - + this->cur_frame = NULL; this->gc = xcb_generate_id(this->connection); xcb_create_gc(this->connection, this->gc, this->window, XCB_GC_FOREGROUND, &this->screen->black_pixel); this->xoverlay = NULL; this->ovl_changed = 0; - + this->xine = class->xine; this->vo_driver.get_capabilities = xshm_get_capabilities; @@ -1108,7 +1108,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void query_extension_reply = xcb_get_extension_data(this->connection, &xcb_shm_id); if (query_extension_reply && query_extension_reply->present) { this->use_shm = 1; - } + } else { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xcbshm: MIT shared memory extension not present on display.\n")); @@ -1147,7 +1147,7 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void */ cpu_byte_order = htonl(1) == 1 ? XCB_IMAGE_ORDER_MSB_FIRST : XCB_IMAGE_ORDER_LSB_FIRST; swapped = cpu_byte_order != image_byte_order; - + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xcbshm: video mode depth is %d (%d bpp), %s, %sswapped,\n" "\tred: %08x, green: %08x, blue: %08x\n", @@ -1209,16 +1209,16 @@ static vo_driver_t *xshm_open_plugin(video_driver_class_t *class_gen, const void } if (!mode) { - xprintf (this->xine, XINE_VERBOSITY_LOG, + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_xcbshm: your video mode was not recognized, sorry :-(\n")); return NULL; } - + this->yuv2rgb_brightness = 0; this->yuv2rgb_contrast = 128; this->yuv2rgb_saturation = 128; - - this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped, + + this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped, this->yuv2rgb_cmap); this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, @@ -1274,7 +1274,7 @@ static const vo_info_t vo_info_xshm = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "xshm", XINE_VERSION_CODE, &vo_info_xshm, xshm_init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index 1e6e2b663..b3a141e61 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -196,7 +196,7 @@ static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) { frame = (xv_frame_t *) calloc(1, sizeof(xv_frame_t)); if (!frame) return NULL; - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -380,7 +380,7 @@ static void xv_update_frame_format (vo_driver_t *this_gen, if(format == XINE_IMGFMT_YUY2) { frame->vo_frame.pitches[0] = frame->xv_pitches[0]; frame->vo_frame.base[0] = frame->image + frame->xv_offsets[0]; - } + } else { frame->vo_frame.pitches[0] = frame->xv_pitches[0]; frame->vo_frame.pitches[1] = frame->xv_pitches[2]; @@ -418,7 +418,7 @@ static void xv_deinterlace_frame (xv_driver_t *this) { if(this->deinterlace_frame.image) dispose_ximage(this, &this->deinterlace_frame); - + create_ximage(this, &this->deinterlace_frame, frame->width, frame->height / xvscaling, frame->format); this->deinterlace_frame.width = frame->width; this->deinterlace_frame.height = frame->height; @@ -539,12 +539,12 @@ static void xv_clean_output_area (xv_driver_t *this) { this->sc.output_width, this->sc.output_height }; xcb_poly_fill_rectangle(this->connection, this->window, this->gc, 1, &rectangle); } - + if (this->xoverlay) { xcbosd_resize(this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + pthread_mutex_unlock(&this->main_mutex); } @@ -575,7 +575,7 @@ static void xv_compute_output_size (xv_driver_t *this) { } } -static void xv_overlay_begin (vo_driver_t *this_gen, +static void xv_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -586,7 +586,7 @@ static void xv_overlay_begin (vo_driver_t *this_gen, xcbosd_clear(this->xoverlay); pthread_mutex_unlock(&this->main_mutex); } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -603,7 +603,7 @@ static void xv_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { this->ovl_changed = 0; } -static void xv_overlay_blend (vo_driver_t *this_gen, +static void xv_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xv_driver_t *this = (xv_driver_t *) this_gen; xv_frame_t *frame = (xv_frame_t *) frame_gen; @@ -617,11 +617,11 @@ static void xv_overlay_blend (vo_driver_t *this_gen, } } else { if (frame->format == XINE_IMGFMT_YV12) - _x_blend_yuv(frame->vo_frame.base, overlay, + _x_blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); else - _x_blend_yuy2(frame->vo_frame.base[0], overlay, + _x_blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0], &this->alphablend_extra_data); } @@ -665,7 +665,7 @@ static int xv_redraw_needed (vo_driver_t *this_gen) { this->sc.delivered_height = this->cur_frame->height; this->sc.delivered_width = this->cur_frame->width; this->sc.delivered_ratio = this->cur_frame->ratio; - + this->sc.crop_left = this->cur_frame->vo_frame.crop_left; this->sc.crop_right = this->cur_frame->vo_frame.crop_right; this->sc.crop_top = this->cur_frame->vo_frame.crop_top; @@ -694,7 +694,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { /* printf ("video_out_xcbxv: xv_display_frame...\n"); */ - + /* * queue frames (deinterlacing) * free old frames @@ -795,7 +795,7 @@ static int xv_get_property (vo_driver_t *this_gen, int property) { static void xv_property_callback (void *property_gen, xine_cfg_entry_t *entry) { xv_property_t *property = (xv_property_t *) property_gen; xv_driver_t *this = property->this; - + pthread_mutex_lock(&this->main_mutex); xcb_xv_set_port_attribute(this->connection, this->xv_port, property->atom, entry->num_value); @@ -829,7 +829,7 @@ static int xv_set_property (vo_driver_t *this_gen, this->props[property].entry->num_value = this->props[property].value; return this->props[property].value; - } + } else { switch (property) { @@ -843,13 +843,13 @@ static int xv_set_property (vo_driver_t *this_gen, xv_compute_output_size (this); } break; - + case VO_PROP_ASPECT_RATIO: if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xcbxv: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); this->sc.user_ratio = value; @@ -863,7 +863,7 @@ static int xv_set_property (vo_driver_t *this_gen, this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xcbxv: 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); @@ -955,7 +955,7 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, if(this->xoverlay) xcbosd_expose(this->xoverlay); - + xcb_flush(this->connection); pthread_mutex_unlock(&this->main_mutex); } @@ -1013,7 +1013,7 @@ static void xv_store_port_attribute(xv_driver_t *this, char *name) { xcb_xv_get_port_attribute_cookie_t get_attribute_cookie; xcb_xv_get_port_attribute_reply_t *get_attribute_reply; - + pthread_mutex_lock(&this->main_mutex); atom_cookie = xcb_intern_atom(this->connection, 0, strlen(name), name); atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); @@ -1021,7 +1021,7 @@ static void xv_store_port_attribute(xv_driver_t *this, char *name) { get_attribute_reply = xcb_xv_get_port_attribute_reply(this->connection, get_attribute_cookie, NULL); free(atom_reply); pthread_mutex_unlock(&this->main_mutex); - + if (get_attribute_reply != NULL) { xv_portattribute_t *attr; @@ -1039,26 +1039,26 @@ static void xv_restore_port_attributes(xv_driver_t *this) { xcb_intern_atom_cookie_t atom_cookie; xcb_intern_atom_reply_t *atom_reply; - + while ((ite = xine_list_front(this->port_attributes)) != NULL) { xv_portattribute_t *attr = xine_list_get_value(this->port_attributes, ite); xine_list_remove (this->port_attributes, ite); - + pthread_mutex_lock(&this->main_mutex); atom_cookie = xcb_intern_atom(this->connection, 0, strlen(attr->name), attr->name); atom_reply = xcb_intern_atom_reply(this->connection, atom_cookie, NULL); xcb_xv_set_port_attribute(this->connection, this->xv_port, atom_reply->atom, attr->value); free(atom_reply); pthread_mutex_unlock(&this->main_mutex); - + free( attr->name ); free( attr ); } - + pthread_mutex_lock(&this->main_mutex); xcb_flush(this->connection); pthread_mutex_unlock(&this->main_mutex); - + xine_list_delete( this->port_attributes ); } @@ -1068,7 +1068,7 @@ static void xv_dispose (vo_driver_t *this_gen) { /* restore port attributes to their initial values */ xv_restore_port_attributes(this); - + if (this->deinterlace_frame.image) { pthread_mutex_lock(&this->main_mutex); dispose_ximage(this, &this->deinterlace_frame); @@ -1096,7 +1096,7 @@ static void xv_dispose (vo_driver_t *this_gen) { pthread_mutex_destroy(&this->main_mutex); _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -1111,7 +1111,7 @@ static int xv_check_yv12(xcb_connection_t *connection, xcb_xv_port_t port) { if (!list_formats_reply) return 1; /* no formats listed; probably due to an invalid port no. */ format_it = xcb_xv_list_image_formats_format_iterator(list_formats_reply); - + for (; format_it.rem; xcb_xv_image_format_info_next(&format_it)) if ((format_it.data->id == XINE_IMGFMT_YV12) && (! (strcmp ((char *) format_it.data->guid, "YV12")))) { @@ -1138,7 +1138,7 @@ static void xv_check_capability (xv_driver_t *this, xcb_intern_atom_cookie_t atom_cookie; xcb_intern_atom_reply_t *atom_reply; - + /* * some Xv drivers (Gatos ATI) report some ~0 as max values, this is confusing. */ @@ -1168,7 +1168,7 @@ static void xv_check_capability (xv_driver_t *this, /* might be overridden using config entry */ if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0) int_default = 0; - + if (config_name) { /* is this a boolean property ? */ if ((attr->min == 0) && (attr->max == 1)) { @@ -1185,12 +1185,12 @@ static void xv_check_capability (xv_driver_t *this, entry = this->config->lookup_entry (this->config, config_name); - if((entry->num_value < this->props[property].min) || + if((entry->num_value < this->props[property].min) || (entry->num_value > this->props[property].max)) { - this->config->update_num(this->config, config_name, + this->config->update_num(this->config, config_name, ((this->props[property].min + this->props[property].max) >> 1)); - + entry = this->config->lookup_entry (this->config, config_name); } @@ -1339,7 +1339,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis pthread_mutex_init(&this->main_mutex, NULL); _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->connection = visual->connection; this->screen = visual->screen; this->window = visual->window; @@ -1404,16 +1404,16 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xcbxv: 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)*/ return NULL; - } + } else xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xcbxv: using Xv port %d from adaptor %s for hardware " "colour space conversion and scaling.\n"), xv_port, xcb_xv_adaptor_info_name(adaptor_it.data)); - + this->xv_port = xv_port; _x_vo_scale_init (&this->sc, 1, 0, config ); @@ -1526,10 +1526,10 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis VIDEO_DEVICE_XV_DOUBLE_BUFFER_HELP, 20, xv_update_XV_DOUBLE_BUFFER, this); config->update_num(config,"video.device.xv_double_buffer",xv_double_buffer); - } else if(!strcmp(name, sync_atoms[this->sync_is_vsync = 0]) || - !strcmp(name, sync_atoms[this->sync_is_vsync = 1])) { + } else if(!strcmp(name, sync_atoms[this->sync_is_vsync = 0]) || + !strcmp(name, sync_atoms[this->sync_is_vsync = 1])) { int xv_sync_to_vblank; - xv_sync_to_vblank = + xv_sync_to_vblank = config->register_bool (config, "video.device.xv_sync_to_vblank", 1, _("enable vblank sync"), _("This option will synchronize the update of the video image to the " @@ -1562,10 +1562,10 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis list_formats_reply = xcb_xv_list_image_formats_reply(this->connection, list_formats_cookie, NULL); format_it = xcb_xv_list_image_formats_format_iterator(list_formats_reply); - + this->xv_format_yv12 = 0; this->xv_format_yuy2 = 0; - + for (; format_it.rem; xcb_xv_image_format_info_next(&format_it)) { lprintf ("Xv image format: 0x%x (%4.4s) %s\n", format_it.data->id, (char*)&format_it.data->id, @@ -1580,19 +1580,19 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis } else if (format_it.data->id == XINE_IMGFMT_YUY2) { this->xv_format_yuy2 = format_it.data->id; this->capabilities |= VO_CAP_YUY2; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xcbxv: this adaptor supports the yuy2 format.\n")); } } free(list_formats_reply); - this->use_pitch_alignment = + this->use_pitch_alignment = config->register_bool (config, "video.device.xv_pitch_alignment", 0, VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP, 10, xv_update_xv_pitch_alignment, this); - this->deinterlace_method = + this->deinterlace_method = config->register_enum (config, "video.output.xv_deinterlace_method", 4, deinterlace_methods, _("deinterlace method (deprecated)"), @@ -1655,7 +1655,7 @@ static char* get_description (video_driver_class_t *this_gen) { static void dispose_class (video_driver_class_t *this_gen) { xv_class_t *this = (xv_class_t *) this_gen; - + free (this); } diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 74791f145..3d4dae3f9 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -1,13 +1,13 @@ /* * Copyright (C) 2000-2003 the xine project - * + * * This file is part of xine, a free video player. - * + * * xine is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -76,7 +76,7 @@ typedef struct { int flags; vo_scale_t sc; - + XImage *image; XShmSegmentInfo shminfo; @@ -100,7 +100,7 @@ typedef struct { int depth, bpp, bytes_per_pixel, image_byte_order; int use_shm; XColor black; - + int yuv2rgb_brightness; int yuv2rgb_contrast; int yuv2rgb_saturation; @@ -108,7 +108,7 @@ typedef struct { yuv2rgb_factory_t *yuv2rgb_factory; vo_scale_t sc; - + xshm_frame_t *cur_frame; x11osd *xoverlay; int ovl_changed; @@ -164,11 +164,11 @@ static void x11_DeInstallXErrorHandler (xshm_driver_t *this) { } /* - * allocate an XImage, try XShm first but fall back to + * allocate an XImage, try XShm first but fall back to * plain X11 if XShm should fail */ /* called xlocked */ -static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, +static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, int width, int height) { XImage *myimage = NULL; @@ -177,16 +177,16 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, /* * try shm */ - + gX11Fail = 0; x11_InstallXErrorHandler (this); - myimage = XShmCreateImage(this->display, + myimage = XShmCreateImage(this->display, this->visual, this->depth, ZPixmap, NULL, shminfo, - width, + width, height); if (myimage == NULL ) { @@ -196,15 +196,15 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, this->use_shm = 0; goto finishShmTesting; } - + this->bpp = myimage->bits_per_pixel; this->bytes_per_pixel = this->bpp / 8; this->image_byte_order = myimage->byte_order; - + shminfo->shmid=shmget(IPC_PRIVATE, - myimage->bytes_per_line * myimage->height, + myimage->bytes_per_line * myimage->height, IPC_CREAT | 0777); - + if (shminfo->shmid < 0 ) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xshm: %s: allocating image\n" @@ -212,9 +212,9 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, this->use_shm = 0; goto finishShmTesting; } - + shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); - + if (shminfo->shmaddr == ((char *) -1)) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xshm: shared memory error (address error) when allocating image \n" @@ -224,12 +224,12 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, this->use_shm = 0; goto finishShmTesting; } - + shminfo->readOnly = False; myimage->data = shminfo->shmaddr; - + XShmAttach(this->display, shminfo); - + XSync(this->display, False); if (gX11Fail) { @@ -243,10 +243,10 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, goto finishShmTesting; } - /* + /* * Now that the Xserver has learned about and attached to the * shared memory segment, delete it. It's actually deleted by - * the kernel when all users of that segment have detached from + * the kernel when all users of that segment have detached from * it. Gives an automatic shared memory cleanup in case we crash. */ shmctl (shminfo->shmid, IPC_RMID, 0); @@ -268,7 +268,7 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, this->depth, ZPixmap, 0, NULL, - width, + width, height, 8, 0); @@ -284,8 +284,8 @@ static XImage *create_ximage (xshm_driver_t *this, XShmSegmentInfo *shminfo, } /* called xlocked */ -static void dispose_ximage (xshm_driver_t *this, - XShmSegmentInfo *shminfo, +static void dispose_ximage (xshm_driver_t *this, + XShmSegmentInfo *shminfo, XImage *myimage) { if (this->use_shm) { @@ -298,7 +298,7 @@ static void dispose_ximage (xshm_driver_t *this, shminfo->shmid = -1; } - } + } else XDestroyImage (myimage); } @@ -321,10 +321,10 @@ static uint32_t xshm_get_capabilities (vo_driver_t *this_gen) { static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { xshm_frame_t *frame = (xshm_frame_t *) vo_img ; /*xshm_driver_t *this = (xshm_driver_t *) vo_img->driver; */ - - vo_img->proc_called = 1; - - if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || + + vo_img->proc_called = 1; + + if( frame->vo_frame.crop_left || frame->vo_frame.crop_top || frame->vo_frame.crop_right || frame->vo_frame.crop_bottom ) { /* we don't support crop, so don't even waste cpu cycles. @@ -332,7 +332,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { */ return; } - + lprintf ("copy... (format %d)\n", frame->format); if (frame->format == XINE_IMGFMT_YV12) @@ -341,7 +341,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { else frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0]); - + lprintf ("copy...done\n"); } @@ -398,10 +398,10 @@ static vo_frame_t *xshm_alloc_frame (vo_driver_t *this_gen) { /* * supply required functions/fields */ - + frame->vo_frame.proc_slice = xshm_frame_proc_slice; frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = xshm_frame_field; + frame->vo_frame.field = xshm_frame_field; frame->vo_frame.dispose = xshm_frame_dispose; frame->vo_frame.driver = this_gen; @@ -461,7 +461,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->sc.video_pixel_aspect, &gui_width, &gui_height, &gui_pixel_aspect); - + /* find out if we need to adapt this frame */ do_adapt = 0; @@ -486,7 +486,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->sc.user_ratio = this->sc.user_ratio; xshm_compute_ideal_size (this, frame); - + /* now we have updated video_aspect_pixel we use the callback */ /* again to obtain the correct gui_width and gui_height values. */ frame->sc.dest_size_cb (frame->sc.user_data, width, height, @@ -494,20 +494,20 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, &gui_width, &gui_height, &gui_pixel_aspect); } - + if ((frame->sc.gui_width != gui_width) || (frame->sc.gui_height != gui_height) || do_adapt) { - + do_adapt = 1; frame->sc.gui_width = gui_width; frame->sc.gui_height = gui_height; - + xshm_compute_rgb_size (this, frame); - + lprintf ("gui_size has changed => adapt\n"); } - + /* ok, now do what we have to do */ @@ -564,7 +564,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, lprintf ("stripe out_ht=%i, deliv_ht=%i\n", frame->sc.output_height, frame->sc.delivered_height); - /* + /* * set up colorspace converter */ @@ -620,7 +620,7 @@ static void xshm_overlay_clut_yuv2rgb(xshm_driver_t *this, vo_overlay_t *overla } } -static void xshm_overlay_begin (vo_driver_t *this_gen, +static void xshm_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -628,10 +628,10 @@ static void xshm_overlay_begin (vo_driver_t *this_gen, if( this->ovl_changed && this->xoverlay ) { LOCK_DISPLAY(this); - x11osd_clear(this->xoverlay); + x11osd_clear(this->xoverlay); UNLOCK_DISPLAY(this); } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -648,7 +648,7 @@ static void xshm_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { this->ovl_changed = 0; } -static void xshm_overlay_blend (vo_driver_t *this_gen, +static void xshm_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xshm_driver_t *this = (xshm_driver_t *) this_gen; xshm_frame_t *frame = (xshm_frame_t *) frame_gen; @@ -658,13 +658,13 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, if( overlay->unscaled ) { if( this->ovl_changed && this->xoverlay ) { LOCK_DISPLAY(this); - x11osd_blend(this->xoverlay, overlay); + x11osd_blend(this->xoverlay, overlay); UNLOCK_DISPLAY(this); } } else { if (!overlay->rgb_clut || !overlay->hili_rgb_clut) xshm_overlay_clut_yuv2rgb (this, overlay, frame); - + switch (this->bpp) { case 16: _x_blend_rgb16 ((uint8_t *)frame->image->data, overlay, @@ -685,7 +685,7 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, &this->alphablend_extra_data); break; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + 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; @@ -696,12 +696,12 @@ static void xshm_overlay_blend (vo_driver_t *this_gen, static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) { int i; - + memcpy( this->sc.border, frame->sc.border, sizeof(this->sc.border) ); - + LOCK_DISPLAY(this); XSetForeground (this->display, this->gc, this->black.pixel); - + for( i = 0; i < 4; i++ ) { if( this->sc.border[i].w && this->sc.border[i].h ) XFillRectangle(this->display, this->drawable, this->gc, @@ -712,7 +712,7 @@ static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) { x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + UNLOCK_DISPLAY(this); } @@ -724,15 +724,15 @@ static int xshm_redraw_needed (vo_driver_t *this_gen) { this->sc.delivered_height = this->cur_frame->sc.delivered_height; this->sc.delivered_width = this->cur_frame->sc.delivered_width; this->sc.video_pixel_aspect = this->cur_frame->sc.video_pixel_aspect; - if( _x_vo_scale_redraw_needed( &this->sc ) ) { + if( _x_vo_scale_redraw_needed( &this->sc ) ) { clean_output_area (this, this->cur_frame); ret = 1; } - } + } else ret = 1; - + return ret; } @@ -745,22 +745,22 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { frame->vo_frame.id, frame->sc.output_width, frame->sc.output_height); - /* + /* * tell gui that we are about to display a frame, * ask for offset */ - + this->sc.delivered_height = frame->sc.delivered_height; this->sc.delivered_width = frame->sc.delivered_width; this->sc.video_pixel_aspect = frame->sc.video_pixel_aspect; - if( _x_vo_scale_redraw_needed( &this->sc ) ) { + if( _x_vo_scale_redraw_needed( &this->sc ) ) { clean_output_area (this, frame); } - + if (this->cur_frame) { - if ( (this->cur_frame->sc.output_width != frame->sc.output_width) + if ( (this->cur_frame->sc.output_width != frame->sc.output_width) || (this->cur_frame->sc.output_height != frame->sc.output_height) || (this->cur_frame->sc.output_xoffset != frame->sc.output_xoffset) || (this->cur_frame->sc.output_yoffset != frame->sc.output_yoffset) ) @@ -770,10 +770,10 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { } this->cur_frame = frame; - + LOCK_DISPLAY(this); lprintf ("display locked...\n"); - + if (this->use_shm) { lprintf ("put image (shm)\n"); @@ -824,14 +824,14 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_OUTPUT_YOFFSET: return this->cur_frame->sc.output_yoffset; default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: tried to get unsupported property %d\n", property); } return 0; } -static int xshm_set_property (vo_driver_t *this_gen, +static int xshm_set_property (vo_driver_t *this_gen, int property, int value) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -840,7 +840,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_DEBUG, + 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) { @@ -874,7 +874,7 @@ static int xshm_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; } else { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xshm: tried to set unsupported property %d\n", property); } @@ -900,7 +900,7 @@ static void xshm_get_property_min_max (vo_driver_t *this_gen, } } -static int xshm_gui_data_exchange (vo_driver_t *this_gen, +static int xshm_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { xshm_driver_t *this = (xshm_driver_t *) this_gen; @@ -911,15 +911,15 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, #endif case XINE_GUI_SEND_EXPOSE_EVENT: - + lprintf ("expose event\n"); if (this->cur_frame) { XExposeEvent * xev = (XExposeEvent *) data; - + if (xev && xev->count == 0) { int i; - + LOCK_DISPLAY(this); if (this->use_shm) { XShmPutImage(this->display, @@ -929,7 +929,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, False); } else { - XPutImage(this->display, + XPutImage(this->display, this->drawable, this->gc, this->cur_frame->image, 0, 0, this->cur_frame->sc.output_xoffset, this->cur_frame->sc.output_yoffset, this->cur_frame->sc.output_width, this->cur_frame->sc.output_height); @@ -952,7 +952,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, } } break; - + case XINE_GUI_SEND_DRAWABLE_CHANGED: this->drawable = (Drawable) data; @@ -970,7 +970,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, if (this->cur_frame) { x11_rectangle_t *rect = data; int x1, y1, x2, y2; - + _x_vo_scale_translate_gui2video(&this->cur_frame->sc, rect->x, rect->y, &x1, &y1); @@ -993,16 +993,16 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, static void xshm_dispose (vo_driver_t *this_gen) { xshm_driver_t *this = (xshm_driver_t *) this_gen; - + if (this->cur_frame) this->cur_frame->vo_frame.dispose (&this->cur_frame->vo_frame); this->yuv2rgb_factory->dispose (this->yuv2rgb_factory); - + LOCK_DISPLAY(this); XFreeGC(this->display, this->gc); UNLOCK_DISPLAY(this); - + if( this->xoverlay ) { LOCK_DISPLAY(this); x11osd_destroy (this->xoverlay); @@ -1010,7 +1010,7 @@ static void xshm_dispose (vo_driver_t *this_gen) { } _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -1022,7 +1022,7 @@ static int ImlibPaletteLUTGet(xshm_driver_t *this) { int format_ret; long length; Atom to_get; - + retval = NULL; length = 0x7fffffff; to_get = XInternAtom(this->display, "_IMLIB_COLORMAP", False); @@ -1034,7 +1034,7 @@ static int ImlibPaletteLUTGet(xshm_driver_t *this) { if (format_ret == 8) { unsigned int i; unsigned long j; - + j = 1 + retval[0]*4; this->yuv2rgb_cmap = malloc(sizeof(uint8_t) * 32 * 32 * 32); for (i = 0; i < 32 * 32 * 32 && j < num_ret; i++) @@ -1082,14 +1082,14 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v int swapped; int cpu_byte_order; XColor dummy; - + this = (xshm_driver_t *) calloc(1, sizeof(xshm_driver_t)); if (!this) return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->display = visual->display; this->screen = visual->screen; @@ -1102,9 +1102,9 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v this->sc.frame_output_cb = visual->frame_output_cb; this->sc.dest_size_cb = visual->dest_size_cb; this->sc.user_data = visual->user_data; - + this->sc.user_ratio = XINE_VO_ASPECT_AUTO; - + this->drawable = visual->d; this->cur_frame = NULL; LOCK_DISPLAY(this); @@ -1112,7 +1112,7 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v UNLOCK_DISPLAY(this); this->xoverlay = NULL; this->ovl_changed = 0; - + this->x11_old_error_handler = NULL; this->xine = class->xine; @@ -1129,7 +1129,7 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v this->vo_driver.gui_data_exchange = xshm_gui_data_exchange; this->vo_driver.dispose = xshm_dispose; this->vo_driver.redraw_needed = xshm_redraw_needed; - + LOCK_DISPLAY(this); XAllocNamedColor (this->display, DefaultColormap (this->display, this->screen), @@ -1151,7 +1151,7 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v UNLOCK_DISPLAY(this); this->visual = attribs.visual; this->depth = attribs.depth; - + if (this->depth>16) xprintf(this->xine, XINE_VERBOSITY_LOG, _("\n\nWARNING: current display depth is %d. For better performance\n" @@ -1164,7 +1164,7 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v LOCK_DISPLAY(this); if (XShmQueryExtension(this->display)) { this->use_shm = 1; - } + } else { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xshm: MIT shared memory extension not present on display.\n")); @@ -1186,7 +1186,7 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v */ cpu_byte_order = htonl(1) == 1 ? MSBFirst : LSBFirst; swapped = cpu_byte_order != this->image_byte_order; - + 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", @@ -1250,16 +1250,16 @@ static vo_driver_t *xshm_open_plugin_2 (video_driver_class_t *class_gen, const v } if (!mode) { - xprintf (this->xine, XINE_VERBOSITY_LOG, + xprintf (this->xine, XINE_VERBOSITY_LOG, _("video_out_xshm: your video mode was not recognized, sorry :-(\n")); return NULL; } - + this->yuv2rgb_brightness = 0; this->yuv2rgb_contrast = 128; this->yuv2rgb_saturation = 128; - - this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped, + + this->yuv2rgb_factory = yuv2rgb_factory_init (mode, swapped, this->yuv2rgb_cmap); this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, @@ -1287,7 +1287,7 @@ static vo_driver_t *xshm_open_plugin_old (video_driver_class_t *class_gen, const visual.frame_output_cb = old_visual->frame_output_cb; visual.lock_display = NULL; visual.unlock_display = NULL; - + return xshm_open_plugin_2(class_gen, (void *)&visual); } @@ -1347,7 +1347,7 @@ static const vo_info_t vo_info_xshm_2 = { */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ + /* type, API, "name", version, special_info, init_function */ { PLUGIN_VIDEO_OUT, 21, "xshm", XINE_VERSION_CODE, &vo_info_xshm, xshm_init_class }, { PLUGIN_VIDEO_OUT, 21, "xshm", XINE_VERSION_CODE, &vo_info_xshm_2, xshm_init_class_2 }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index f2c47ef7e..65cd29aa4 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -218,7 +218,7 @@ static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) { frame = (xv_frame_t *) calloc(1, sizeof(xv_frame_t)); if (!frame) return NULL; - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -235,7 +235,7 @@ static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) { static int HandleXError (Display *display, XErrorEvent *xevent) { char str [1024]; - + XGetErrorText (display, xevent->error_code, str, 1024); printf ("received X error event: %s\n", str); gX11Fail = 1; @@ -309,7 +309,7 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, lprintf( "XvImage height %d\n", image->height ); lprintf( "XvImage data_size %d\n", image->data_size ); lprintf( "XvImage num_planes %d\n", image->num_planes ); - + for( q=0; q < image->num_planes; q++) { lprintf( "XvImage pitches[%d] %d\n", q, image->pitches[q] ); @@ -425,10 +425,10 @@ static void dispose_ximage (xv_driver_t *this, shminfo->shmid = -1; } - } + } else { free (myimage->data); - + XFree (myimage); } } @@ -466,7 +466,7 @@ static void xv_update_frame_format (vo_driver_t *this_gen, if(format == XINE_IMGFMT_YUY2) { frame->vo_frame.pitches[0] = frame->image->pitches[0]; frame->vo_frame.base[0] = frame->image->data + frame->image->offsets[0]; - } + } else { frame->vo_frame.pitches[0] = frame->image->pitches[0]; frame->vo_frame.pitches[1] = frame->image->pitches[2]; @@ -505,7 +505,7 @@ static void xv_deinterlace_frame (xv_driver_t *this) { if(this->deinterlace_frame.image) dispose_ximage (this, &this->deinterlace_frame.shminfo, this->deinterlace_frame.image); - + this->deinterlace_frame.image = create_ximage (this, &this->deinterlace_frame.shminfo, frame->width,frame->height / xvscaling, frame->format); @@ -621,12 +621,12 @@ static void xv_clean_output_area (xv_driver_t *this) { this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); } - + if (this->xoverlay) { x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + UNLOCK_DISPLAY(this); } @@ -657,7 +657,7 @@ static void xv_compute_output_size (xv_driver_t *this) { } } -static void xv_overlay_begin (vo_driver_t *this_gen, +static void xv_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -665,10 +665,10 @@ static void xv_overlay_begin (vo_driver_t *this_gen, if( this->ovl_changed && this->xoverlay ) { LOCK_DISPLAY(this); - x11osd_clear(this->xoverlay); + x11osd_clear(this->xoverlay); UNLOCK_DISPLAY(this); } - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } @@ -685,7 +685,7 @@ static void xv_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { this->ovl_changed = 0; } -static void xv_overlay_blend (vo_driver_t *this_gen, +static void xv_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xv_driver_t *this = (xv_driver_t *) this_gen; xv_frame_t *frame = (xv_frame_t *) frame_gen; @@ -694,16 +694,16 @@ static void xv_overlay_blend (vo_driver_t *this_gen, if( overlay->unscaled ) { if( this->ovl_changed && this->xoverlay ) { LOCK_DISPLAY(this); - x11osd_blend(this->xoverlay, overlay); + x11osd_blend(this->xoverlay, overlay); UNLOCK_DISPLAY(this); } } else { if (frame->format == XINE_IMGFMT_YV12) - _x_blend_yuv(frame->vo_frame.base, overlay, + _x_blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); else - _x_blend_yuy2(frame->vo_frame.base[0], overlay, + _x_blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0], &this->alphablend_extra_data); } @@ -747,7 +747,7 @@ static int xv_redraw_needed (vo_driver_t *this_gen) { this->sc.delivered_height = this->cur_frame->height; this->sc.delivered_width = this->cur_frame->width; this->sc.delivered_ratio = this->cur_frame->ratio; - + this->sc.crop_left = this->cur_frame->vo_frame.crop_left; this->sc.crop_right = this->cur_frame->vo_frame.crop_right; this->sc.crop_top = this->cur_frame->vo_frame.crop_top; @@ -786,7 +786,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { /* printf ("video_out_xv: xv_display_frame...\n"); */ - + /* * queue frames (deinterlacing) * free old frames @@ -858,7 +858,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if( factor > 1 ) { - lprintf( "%s PutImage %dX interval (%fs)\n", + lprintf( "%s PutImage %dX interval (%fs)\n", LOG_MODULE, factor, elapse_time ); } } @@ -900,7 +900,7 @@ static int xv_get_property (vo_driver_t *this_gen, int property) { static void xv_property_callback (void *property_gen, xine_cfg_entry_t *entry) { xv_property_t *property = (xv_property_t *) property_gen; xv_driver_t *this = property->this; - + LOCK_DISPLAY(this); XvSetPortAttribute (this->display, this->xv_port, property->atom, @@ -930,7 +930,7 @@ static int xv_set_property (vo_driver_t *this_gen, this->props[property].entry->num_value = this->props[property].value; return this->props[property].value; - } + } else { switch (property) { @@ -944,13 +944,13 @@ static int xv_set_property (vo_driver_t *this_gen, xv_compute_output_size (this); } break; - + case VO_PROP_ASPECT_RATIO: if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xv: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); this->sc.user_ratio = value; @@ -964,7 +964,7 @@ static int xv_set_property (vo_driver_t *this_gen, this->props[property].value = 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); @@ -1046,7 +1046,7 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, if(this->xoverlay) x11osd_expose(this->xoverlay); - + XSync(this->display, False); UNLOCK_DISPLAY(this); } @@ -1100,39 +1100,39 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, static void xv_store_port_attribute(xv_driver_t *this, const char *name) { Atom atom; xv_portattribute_t *attr; - + attr = (xv_portattribute_t *)malloc( sizeof(xv_portattribute_t) ); attr->name = strdup(name); - + LOCK_DISPLAY(this); atom = XInternAtom (this->display, attr->name, False); XvGetPortAttribute (this->display, this->xv_port, atom, &attr->value); UNLOCK_DISPLAY(this); - + xine_list_push_back (this->port_attributes, attr); } static void xv_restore_port_attributes(xv_driver_t *this) { Atom atom; xine_list_iterator_t ite; - + while ((ite = xine_list_front(this->port_attributes)) != NULL) { xv_portattribute_t *attr = xine_list_get_value(this->port_attributes, ite); xine_list_remove (this->port_attributes, ite); - + LOCK_DISPLAY(this); atom = XInternAtom (this->display, attr->name, False); XvSetPortAttribute (this->display, this->xv_port, atom, attr->value); UNLOCK_DISPLAY(this); - + free( attr->name ); free( attr ); } - + LOCK_DISPLAY(this); XSync(this->display, False); UNLOCK_DISPLAY(this); - + xine_list_delete( this->port_attributes ); } @@ -1142,7 +1142,7 @@ static void xv_dispose (vo_driver_t *this_gen) { /* restore port attributes to their initial values */ xv_restore_port_attributes(this); - + if (this->deinterlace_frame.image) { LOCK_DISPLAY(this); dispose_ximage (this, &this->deinterlace_frame.shminfo, @@ -1172,7 +1172,7 @@ static void xv_dispose (vo_driver_t *this_gen) { } _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -1183,7 +1183,7 @@ static int xv_check_yv12 (Display *display, XvPortID port) { int i; formatValues = XvListImageFormats (display, port, &formats); - + for (i = 0; i < formats; i++) if ((formatValues[i].id == XINE_IMGFMT_YV12) && (! (strcmp (formatValues[i].guid, "YV12")))) { @@ -1204,7 +1204,7 @@ static void xv_check_capability (xv_driver_t *this, int int_default; cfg_entry_t *entry; const char *str_prop = attr.name; - + /* * some Xv drivers (Gatos ATI) report some ~0 as max values, this is confusing. */ @@ -1225,7 +1225,7 @@ static void xv_check_capability (xv_driver_t *this, /* might be overridden using config entry */ if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0) int_default = 0; - + if (config_name) { /* is this a boolean property ? */ if ((attr.min_value == 0) && (attr.max_value == 1)) { @@ -1242,12 +1242,12 @@ static void xv_check_capability (xv_driver_t *this, entry = this->config->lookup_entry (this->config, config_name); - if((entry->num_value < this->props[property].min) || + if((entry->num_value < this->props[property].min) || (entry->num_value > this->props[property].max)) { - this->config->update_num(this->config, config_name, + this->config->update_num(this->config, config_name, ((this->props[property].min + this->props[property].max) >> 1)); - + entry = this->config->lookup_entry (this->config, config_name); } @@ -1384,7 +1384,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->display = visual->display; this->screen = visual->screen; this->config = config; @@ -1446,19 +1446,19 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * xprintf(class->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)*/ UNLOCK_DISPLAY(this); return NULL; - } + } else xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xv: using Xv port %ld from adaptor %s for hardware " "colour space conversion and scaling.\n"), xv_port, adaptor_info[adaptor_num].name); - + UNLOCK_DISPLAY(this); - + this->xv_port = xv_port; _x_vo_scale_init (&this->sc, 1, 0, config ); @@ -1534,7 +1534,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * const char *const name = attr[k].name; /* store initial port attribute value */ xv_store_port_attribute(this, name); - + if(!strcmp(name, "XV_HUE")) { if (!strncmp(adaptor_info[adaptor_num].name, "NV", 2)) { xprintf (this->xine, XINE_VERBOSITY_NONE, "video_out_xv: ignoring broken XV_HUE settings on NVidia cards\n"); @@ -1582,7 +1582,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * } else if(((this->sync_is_vsync = 0), !strcmp(name, sync_atoms[0])) || ((this->sync_is_vsync = 1), !strcmp(name, sync_atoms[1]))) { int xv_sync_to_vblank; - xv_sync_to_vblank = + xv_sync_to_vblank = config->register_bool (config, "video.device.xv_sync_to_vblank", 1, _("enable vblank sync"), _("This option will synchronize the update of the video image to the " @@ -1613,10 +1613,10 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * fo = XvListImageFormats(this->display, this->xv_port, (int*)&formats); UNLOCK_DISPLAY(this); - + this->xv_format_yv12 = 0; this->xv_format_yuy2 = 0; - + for(i = 0; i < formats; i++) { lprintf ("Xv image format: 0x%x (%4.4s) %s\n", fo[i].id, (char*)&fo[i].id, @@ -1630,7 +1630,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * } 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, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xv: this adaptor supports the yuy2 format.\n")); } } @@ -1651,12 +1651,12 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * dispose_ximage (this, &myshminfo, myimage); UNLOCK_DISPLAY(this); - this->use_pitch_alignment = + this->use_pitch_alignment = config->register_bool (config, "video.device.xv_pitch_alignment", 0, VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP, 10, xv_update_xv_pitch_alignment, this); - this->deinterlace_method = + this->deinterlace_method = config->register_enum (config, "video.output.xv_deinterlace_method", 4, deinterlace_methods, _("deinterlace method (deprecated)"), @@ -1720,7 +1720,7 @@ static vo_driver_t *open_plugin_old (video_driver_class_t *class_gen, const void visual.frame_output_cb = old_visual->frame_output_cb; visual.lock_display = NULL; visual.unlock_display = NULL; - + return open_plugin_2(class_gen, (void *)&visual); } @@ -1738,7 +1738,7 @@ static char* get_description (video_driver_class_t *this_gen) { static void dispose_class (video_driver_class_t *this_gen) { xv_class_t *this = (xv_class_t *) this_gen; - + free (this); } diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c index c2560ccc0..aeb536fc1 100644 --- a/src/video_out/video_out_xvmc.c +++ b/src/video_out/video_out_xvmc.c @@ -7,7 +7,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * xine is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -93,7 +93,7 @@ typedef struct { XvMCMacroBlock *macroblockbaseptr; /* pointer to base MacroBlock in MB array */ XvMCMacroBlockArray *macro_blocks; /* pointer to memory for macroblock array */ int slices; -} xvmc_macroblocks_t; +} xvmc_macroblocks_t; typedef struct { void *xid; @@ -149,8 +149,8 @@ struct xvmc_driver_s { int max_surface_height; int num_frame_buffers; - int surface_width; - int surface_height; + int surface_width; + int surface_height; int surface_ratio; int surface_format; int surface_flags; @@ -168,7 +168,7 @@ struct xvmc_driver_s { /* display anatomy */ double display_ratio; /* given by visual parameter from init function */ - + xvmc_property_t props[VO_NUM_PROPERTIES]; uint32_t capabilities; @@ -181,7 +181,7 @@ struct xvmc_driver_s { /* size / aspect ratio calculations */ - /* + /* * "delivered" size: * frame dimension / aspect as delivered by the decoder * used (among other things) to detect frame size changes @@ -189,7 +189,7 @@ struct xvmc_driver_s { int delivered_duration; - /* + /* * "ideal" size : * displayed width/height corrected by aspect ratio */ @@ -197,19 +197,19 @@ struct xvmc_driver_s { double ratio_factor; /* output frame must fullfill: height = width * ratio_factor */ - + xvmc_frame_t deinterlace_frame; int deinterlace_method; int deinterlace_enabled; /* gui callback */ - + void (*frame_output_cb) (void *user_data, int video_width, int video_height, - int *dest_x, int *dest_y, + int *dest_x, int *dest_y, int *dest_height, int *dest_width, int *win_x, int *win_y); - + int use_colorkey; uint32_t colorkey; @@ -245,19 +245,19 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, /**************************************************************************/ -/* +/* * dmvector: differential motion vector * mvx, mvy: decoded mv components (always in field format) */ -static void calc_DMV(int DMV[][2], int *dmvector, +static void calc_DMV(int DMV[][2], int *dmvector, int mvx, int mvy, int picture_structure, int top_field_first) { - + if (picture_structure==VO_BOTH_FIELDS) { if (top_field_first) { /* vector for prediction of top field from bottom field */ DMV[0][0] = ((mvx +(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((mvy +(mvy>0))>>1) + dmvector[1] - 1; - + /* vector for prediction of bottom field from top field */ DMV[1][0] = ((3*mvx+(mvx>0))>>1) + dmvector[0]; DMV[1][1] = ((3*mvy+(mvy>0))>>1) + dmvector[1] + 1; @@ -266,7 +266,7 @@ static void calc_DMV(int DMV[][2], int *dmvector, /* vector for prediction of top field from bottom field */ DMV[0][0] = ((3*mvx+(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((3*mvy+(mvy>0))>>1) + dmvector[1] - 1; - + /* vector for prediction of bottom field from top field */ DMV[1][0] = ((mvx +(mvx>0))>>1) + dmvector[0]; DMV[1][1] = ((mvy +(mvy>0))>>1) + dmvector[1] + 1; @@ -276,7 +276,7 @@ static void calc_DMV(int DMV[][2], int *dmvector, /* vector for prediction from field of opposite 'parity' */ DMV[0][0] = ((mvx+(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((mvy+(mvy>0))>>1) + dmvector[1]; - + /* correct for vertical field shift */ if (picture_structure==VO_TOP_FIELD) DMV[0][1]--; @@ -285,11 +285,11 @@ static void calc_DMV(int DMV[][2], int *dmvector, } } -static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, - int (*mv_field_sel)[2], int *dmvector, int cbp, - int dct_type, vo_frame_t *current_frame, - vo_frame_t *forward_ref_frame, - vo_frame_t *backward_ref_frame, int picture_structure, +static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, + int (*mv_field_sel)[2], int *dmvector, int cbp, + int dct_type, vo_frame_t *current_frame, + vo_frame_t *forward_ref_frame, + vo_frame_t *backward_ref_frame, int picture_structure, int second_field, int (*f_mot_pmv)[2], int (*b_mot_pmv)[2]) { xvmc_driver_t *this = (xvmc_driver_t *) current_frame->driver; xvmc_macroblocks_t *mbs = &this->macroblocks; @@ -298,10 +298,10 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, mbs->macroblockptr->x = x; mbs->macroblockptr->y = y; - + if(mb_type & XINE_MACROBLOCK_INTRA) { mbs->macroblockptr->macroblock_type = XVMC_MB_TYPE_INTRA; - } + } else { mbs->macroblockptr->macroblock_type = 0; /* XvMC doesn't support skips */ @@ -310,7 +310,7 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, motion_type = (picture_structure == VO_BOTH_FIELDS) ? XINE_MC_FRAME : XINE_MC_FIELD; mbs->macroblockptr->PMV[0][0][0] = 0; mbs->macroblockptr->PMV[0][0][1] = 0; - } + } else { if(mb_type & XINE_MACROBLOCK_MOTION_BACKWARD) { mbs->macroblockptr->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD; @@ -342,17 +342,17 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, calc_DMV(DMV,dmvector, f_mot_pmv[0][0], f_mot_pmv[0][1]>>1, picture_structure, top_field_first); - + mbs->macroblockptr->PMV[1][0][0] = DMV[0][0]; mbs->macroblockptr->PMV[1][0][1] = DMV[0][1]; mbs->macroblockptr->PMV[1][1][0] = DMV[1][0]; mbs->macroblockptr->PMV[1][1][1] = DMV[1][1]; - } + } else { calc_DMV(DMV,dmvector, f_mot_pmv[0][0], f_mot_pmv[0][1]>>1, picture_structure, top_field_first); - + mbs->macroblockptr->PMV[0][1][0] = DMV[0][0]; mbs->macroblockptr->PMV[0][1][1] = DMV[0][1]; } @@ -378,7 +378,7 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, mbs->macroblockptr->dct_type = dct_type; mbs->macroblockptr->coded_block_pattern = cbp; - while(cbp) { + while(cbp) { if(cbp & 1) mbs->macroblockptr->index--; cbp >>= 1; } @@ -446,7 +446,7 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, picture_structure, second_field ? XVMC_SECOND_FIELD : 0, mbs); - + mbs->num_blocks = 0; mbs->macroblockptr = mbs->macroblockbaseptr; mbs->xine_mc.blockptr = mbs->xine_mc.blockbaseptr; @@ -470,9 +470,9 @@ static void xvmc_frame_dispose (vo_frame_t *vo_img) { lprintf ("xvmc_frame_dispose\n"); - /* + /* * TODO - clean up of images/surfaces and frames - * Note this function is not really needed + * Note this function is not really needed * set_context does the work */ @@ -498,9 +498,9 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, (long) forward_frame); /* lprintf ("slices %d 0x%08lx 0x%08lx 0x%08lx\n",macroblocks->slices, (long) current_frame->surface, (long) backward_frame->surface, - (long) forward_frame->surface); + (long) forward_frame->surface); */ - + flags = second_field; if(forward_frame) { @@ -512,7 +512,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, flags, macroblocks->slices, 0, macroblocks->macro_blocks, macroblocks->blocks); - } + } else { XvMCRenderSurface(this->display, &this->context, picture_structure, ¤t_frame->surface, @@ -522,7 +522,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, macroblocks->slices, 0, macroblocks->macro_blocks, macroblocks->blocks); } - } + } else { if(backward_frame) { XvMCRenderSurface(this->display, &this->context, picture_structure, @@ -532,7 +532,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, flags, macroblocks->slices, 0, macroblocks->macro_blocks, macroblocks->blocks); - } + } else { XvMCRenderSurface(this->display, &this->context, picture_structure, ¤t_frame->surface, @@ -564,7 +564,7 @@ static vo_frame_t *xvmc_alloc_frame (vo_driver_t *this_gen) { /* keep track of frames and how many frames alocated. */ this->frames[this->num_frame_buffers++] = frame; - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); /* @@ -591,12 +591,12 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, xvmc_macroblocks_t *macroblocks = (xvmc_macroblocks_t *) macro_blocks; lprintf ("xvmc_set_context %dx%d %04x\n",width,height,format); - + /* initialize block & macro block pointers first time */ if(macroblocks->blocks == NULL || macroblocks->macro_blocks == NULL) { macroblocks->blocks = calloc(1, sizeof(XvMCBlockArray)); macroblocks->macro_blocks = calloc(1, sizeof(XvMCMacroBlockArray)); - + lprintf("macroblocks->blocks %lx ->macro_blocks %lx\n", macroblocks->blocks,macroblocks->macro_blocks); } @@ -612,11 +612,11 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, return(&this->context_id); - } - else { + } + else { if(this->context_id.xid != NULL) { - /* + /* * flush any drawing and wait till we are done with the old stuff * blow away the old stuff */ @@ -639,8 +639,8 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, width,height, this->surface_type_id, (int)this->xv_port); /* now create a new context */ - result = XvMCCreateContext(this->display, this->xv_port, - this->surface_type_id, + result = XvMCCreateContext(this->display, this->xv_port, + this->surface_type_id, width, height, XVMC_DIRECT, &this->context); if(result != Success) { @@ -668,7 +668,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, slices = (slices * width/16); lprintf("CreateBlocks slices %d\n",slices); - + result = XvMCCreateBlocks(this->display, &this->context, slices * 6, macroblocks->blocks); if(result != Success) { @@ -751,7 +751,7 @@ static XvImage *create_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, static void dispose_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, XvImage *myimage) { - + lprintf ("dispose_ximage\n"); XFree(myimage); } @@ -779,9 +779,9 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen, lprintf ("updating frame to %d x %d (ratio=%f, format=%08x)\n", width, height, ratio, format); - /* Note that since we are rendering in hardware, we do not need to + /* Note that since we are rendering in hardware, we do not need to * allocate any ximage's for the software rendering buffers. - */ + */ frame->width = width; frame->height = height; frame->format = format; @@ -791,7 +791,7 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen, xvmc->macroblocks = (xine_macroblocks_t *)&this->macroblocks; this->macroblocks.num_blocks = 0; this->macroblocks.macroblockptr = this->macroblocks.macroblockbaseptr; - this->macroblocks.xine_mc.blockptr = + this->macroblocks.xine_mc.blockptr = this->macroblocks.xine_mc.blockbaseptr; if( flags & VO_NEW_SEQUENCE_FLAG ) { xvmc_set_context (this, width, height, ratio, format, flags, @@ -806,14 +806,14 @@ static void xvmc_clean_output_area (xvmc_driver_t *this) { XSetForeground (this->display, this->gc, this->black.pixel); XFillRectangle (this->display, this->drawable, this->gc, this->sc.gui_x, this->sc.gui_y, this->sc.gui_width, this->sc.gui_height); - + if (this->use_colorkey) { XSetForeground (this->display, this->gc, this->colorkey); XFillRectangle (this->display, this->drawable, this->gc, - this->sc.output_xoffset, this->sc.output_yoffset, + this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); } - + XUnlockDisplay (this->display); } @@ -834,27 +834,27 @@ static void xvmc_compute_output_size (xvmc_driver_t *this) { _x_vo_scale_compute_output_size( &this->sc ); } -static void xvmc_overlay_blend (vo_driver_t *this_gen, +static void xvmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen; lprintf ("xvmc_overlay_blend\n"); - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; /* Alpha Blend here * As XV drivers improve to support Hardware overlay, we will change this function. */ - + if (overlay->rle) { if (frame->format == XINE_IMGFMT_YV12) - _x_blend_yuv(frame->vo_frame.base, overlay, + _x_blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); else if (frame->format != XINE_IMGFMT_XVMC) - _x_blend_yuy2(frame->vo_frame.base[0], overlay, + _x_blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0], &this->alphablend_extra_data); else @@ -899,16 +899,16 @@ static int xvmc_redraw_needed (vo_driver_t *this_gen) { int ret = 0; if(this->cur_frame) { - + this->sc.delivered_height = this->cur_frame->height; this->sc.delivered_width = this->cur_frame->width; this->sc.delivered_ratio = this->cur_frame->ratio; - + this->sc.crop_left = this->cur_frame->vo_frame.crop_left; this->sc.crop_right = this->cur_frame->vo_frame.crop_right; this->sc.crop_top = this->cur_frame->vo_frame.crop_top; this->sc.crop_bottom = this->cur_frame->vo_frame.crop_bottom; - + xvmc_compute_ideal_size(this); if(_x_vo_scale_redraw_needed(&this->sc)) { @@ -929,49 +929,49 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { lprintf ("xvmc_display_frame %d %x\n",frame_gen->id,frame_gen); - /* + /* * queue frames (deinterlacing) * free old frames */ - + xvmc_add_recent_frame (this, frame); /* deinterlacing */ - + this->cur_frame = frame; - + /* * let's see if this frame is different in size / aspect * ratio from the previous one */ - + if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) ) { lprintf("frame format changed\n"); - - /* + + /* this->delivered_width = frame->width; this->delivered_height = frame->height; this->delivered_ratio = frame->ratio; this->delivered_duration = frame->vo_frame.duration; - + xvmc_compute_ideal_size (this); */ /* this->gui_width = 0; */ /* trigger re-calc of output size */ this->sc.force_redraw = 1; /* trigger re-calc of output size */ } - - /* + + /* * tell gui that we are about to display a frame, * ask for offset and output size */ xvmc_redraw_needed (this_gen); - + XLockDisplay (this->display); - /* Make sure the surface has finished rendering before we display */ + /* Make sure the surface has finished rendering before we display */ XvMCSyncSurface(this->display, &this->cur_frame->surface); - + if (this->deinterlace_enabled && (this->deinterlace_method == DEINTERLACE_ONEFIELD)) { XvMCPutSurface(this->display, &this->cur_frame->surface, @@ -990,9 +990,9 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { this->sc.output_width, this->sc.output_height, XVMC_FRAME_PICTURE); } - + XUnlockDisplay (this->display); - + /* printf ("video_out_xvmc: xvmc_display_frame... done\n"); */ @@ -1002,7 +1002,7 @@ static int xvmc_get_property (vo_driver_t *this_gen, int property) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; lprintf ("xvmc_get_property\n"); - + switch (property) { case VO_PROP_WINDOW_WIDTH: this->props[property].value = this->sc.gui_width; @@ -1023,7 +1023,7 @@ static int xvmc_get_property (vo_driver_t *this_gen, int property) { this->props[property].value = this->sc.output_yoffset; break; } - + return this->props[property].value; } @@ -1032,7 +1032,7 @@ static void xvmc_property_callback (void *property_gen, xine_cfg_entry_t *entry) xvmc_driver_t *this = property->this; lprintf ("xvmc_property_callback\n"); - + XLockDisplay(this->display); XvSetPortAttribute (this->display, this->xv_port, property->atom, entry->num_value); @@ -1044,7 +1044,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, xvmc_driver_t *this = (xvmc_driver_t *) this_gen; lprintf ("xvmc_set_property %d value %d\n",property,value); - + if (this->props[property].atom != None) { /* value is out of bound */ if((value < this->props[property].min) || (value > this->props[property].max)) @@ -1060,9 +1060,9 @@ static int xvmc_set_property (vo_driver_t *this_gen, if (this->props[property].entry) this->props[property].entry->num_value = this->props[property].value; - + return this->props[property].value; - } + } else { switch (property) { case VO_PROP_INTERLACED: @@ -1081,7 +1081,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, this->props[property].value = value; lprintf("VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); - + xvmc_compute_ideal_size (this); xvmc_compute_output_size (this); xvmc_clean_output_area (this); @@ -1091,7 +1091,7 @@ 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; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: VO_PROP_ZOOM_X = %d\n", this->props[property].value); this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; @@ -1103,7 +1103,7 @@ 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; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: VO_PROP_ZOOM_Y = %d\n", this->props[property].value); this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; @@ -1111,7 +1111,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; /* trigger re-calc of output size */ } break; - } + } } return value; @@ -1120,9 +1120,9 @@ static int xvmc_set_property (vo_driver_t *this_gen, static void xvmc_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - + lprintf ("xvmc_get_property_min_max\n"); - + *min = this->props[property].min; *max = this->props[property].max; } @@ -1132,32 +1132,32 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen, xvmc_driver_t *this = (xvmc_driver_t *) this_gen; lprintf ("xvmc_gui_data_exchange\n"); - + switch (data_type) { case XINE_GUI_SEND_EXPOSE_EVENT: { /* XExposeEvent * xev = (XExposeEvent *) data; */ /* FIXME : take care of completion events */ lprintf ("XINE_GUI_SEND_EXPOSE_EVENT\n"); - + if (this->cur_frame) { int i; - + XLockDisplay (this->display); - + XSetForeground (this->display, this->gc, this->black.pixel); - + for( i = 0; i < 4; i++ ) { if( this->sc.border[i].w && this->sc.border[i].h ) XFillRectangle(this->display, this->drawable, this->gc, this->sc.border[i].x, this->sc.border[i].y, this->sc.border[i].w, this->sc.border[i].h); } - + if (this->use_colorkey) { XSetForeground (this->display, this->gc, this->colorkey); XFillRectangle (this->display, this->drawable, this->gc, - this->sc.output_xoffset, this->sc.output_yoffset, + this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height); } @@ -1168,7 +1168,7 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen, this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height, XVMC_FRAME_PICTURE); - + XSync(this->display, False); XUnlockDisplay (this->display); } @@ -1187,18 +1187,18 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen, int x1, y1, x2, y2; x11_rectangle_t *rect = data; - /* + /* xvmc_translate_gui2video(this, rect->x, rect->y, - &x1, &y1); + &x1, &y1); xvmc_translate_gui2video(this, rect->x + rect->w, rect->y + rect->h, - &x2, &y2); + &x2, &y2); */ - + _x_vo_scale_translate_gui2video(&this->sc, rect->x, rect->y, &x1, &y1); _x_vo_scale_translate_gui2video(&this->sc, rect->x + rect->w, rect->y + rect->h, &x2, &y2); - + rect->x = x1; rect->y = y1; rect->w = x2-x1; @@ -1216,9 +1216,9 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen, static void xvmc_dispose (vo_driver_t *this_gen) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; int i; - + lprintf ("xvmc_dispose\n"); - + if(this->context_id.xid) { XLockDisplay(this->display); for(i = 0; i < this->num_frame_buffers; i++) { @@ -1228,7 +1228,7 @@ static void xvmc_dispose (vo_driver_t *this_gen) { } /* XvMCDestroyBlocks(this->display, ¯oblocks->blocks); */ /* XvMCDestroyMacroBlocks(this->display, ¯oblocks->macro_blocks); */ - XvMCDestroyContext(this->display, &this->context); + XvMCDestroyContext(this->display, &this->context); XUnlockDisplay(this->display); } @@ -1274,16 +1274,16 @@ static void xvmc_check_capability (xvmc_driver_t *this, XvGetPortAttribute (this->display, this->xv_port, this->props[property].atom, &int_default); - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + 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 ? */ if ((attr.min_value == 0) && (attr.max_value == 1)) { this->config->register_bool (this->config, config_name, int_default, config_desc, config_help, 20, xvmc_property_callback, &this->props[property]); - + } else { this->config->register_range (this->config, config_name, int_default, this->props[property].min, this->props[property].max, @@ -1301,7 +1301,7 @@ static void xvmc_check_capability (xvmc_driver_t *this, this->use_colorkey = 1; this->colorkey = entry->num_value; } - } + } else this->props[property].value = int_default; } @@ -1310,7 +1310,7 @@ static void xvmc_update_deinterlace(void *this_gen, xine_cfg_entry_t *entry) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; lprintf ("xvmc_update_deinterlace method = %d\n",entry->num_value); - + this->deinterlace_method = entry->num_value; } @@ -1319,7 +1319,7 @@ static void xvmc_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry xvmc_driver_t *this = (xvmc_driver_t *) this_gen; Atom atom; int xvmc_double_buffer; - + xvmc_double_buffer = entry->num_value; XLockDisplay(this->display); @@ -1344,11 +1344,11 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XvAdaptorInfo *adaptor_info; unsigned int adaptor_num; /* XvImage *myimage; */ - + lprintf ("open_plugin\n"); - + this = calloc(1, sizeof (xvmc_driver_t)); - + if (!this) return NULL; @@ -1425,9 +1425,9 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi /* * check this adaptor's capabilities */ - if(this->acceleration&XINE_VO_IDCT_ACCEL) + if(this->acceleration&XINE_VO_IDCT_ACCEL) this->capabilities |= VO_CAP_XVMC_IDCT; - + XLockDisplay(this->display); attr = XvQueryPortAttributes(this->display, xv_port, &nattr); if(attr && nattr) { @@ -1475,7 +1475,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi } } XFree(attr); - } + } else { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: no port attributes defined.\n"); } @@ -1489,12 +1489,12 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->xvmc_format_yv12 = 0; this->xvmc_format_yuy2 = 0; - + for(i = 0; i < formats; i++) { lprintf ("XvMC image format: 0x%x (%4.4s) %s\n", fo[i].id, (char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar"); - + if (fo[i].id == XINE_IMGFMT_YV12) { this->xvmc_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; @@ -1519,15 +1519,15 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi */ /* XLockDisplay(this->display); - myimage = create_ximage (this, &myshminfo, 100, 100, + myimage = create_ximage (this, &myshminfo, 100, 100, (this->xvmc_format_yv12 != 0) ? XINE_IMGFMT_YV12 : IMGFMT_YUY2); dispose_ximage (this, &myshminfo, myimage); XUnLockDisplay(this->display); */ - + this->deinterlace_method = config->register_enum (config, "video.output.xv_deinterlace_method", 4, - deinterlace_methods, + deinterlace_methods, _("deinterlace method (deprecated)"), _("This config setting is deprecated. You should use the new deinterlacing " "post processing settings instead.\n\n" @@ -1561,26 +1561,26 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi lprintf("deinterlace_methods %d ",this->deinterlace_method); switch(this->deinterlace_method) { - case DEINTERLACE_NONE: - lprintf("NONE\n"); + case DEINTERLACE_NONE: + lprintf("NONE\n"); break; - case DEINTERLACE_BOB: - lprintf("BOB\n"); + case DEINTERLACE_BOB: + lprintf("BOB\n"); break; - case DEINTERLACE_WEAVE: + case DEINTERLACE_WEAVE: lprintf("WEAVE\n"); break; - case DEINTERLACE_GREEDY: + case DEINTERLACE_GREEDY: lprintf("GREEDY\n"); break; - case DEINTERLACE_ONEFIELD: + case DEINTERLACE_ONEFIELD: lprintf("ONEFIELD\n"); break; - case DEINTERLACE_ONEFIELDXV: + case DEINTERLACE_ONEFIELDXV: lprintf("ONEFIELDXV\n"); break; - case DEINTERLACE_LINEARBLEND: - lprintf("LINEARBLEND\n"); + case DEINTERLACE_LINEARBLEND: + lprintf("LINEARBLEND\n"); break; } @@ -1625,7 +1625,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { int surface_type = 0; display = visual->display; - + /* * check for Xv and XvMC video support */ @@ -1666,20 +1666,20 @@ static void *init_class (xine_t *xine, void *visual_gen) { 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_IDCT | XVMC_MPEG_2))) { - + max_width = surfaceInfo[surface_num].max_width; max_height = surfaceInfo[surface_num].max_height; - + for(j = 0; j < adaptor_info[adaptor_num].num_ports; j++) { /* try to grab a port */ - if(Success == XvGrabPort(display, - adaptor_info[adaptor_num].base_id + j, CurrentTime)) { + if(Success == XvGrabPort(display, + adaptor_info[adaptor_num].base_id + j, CurrentTime)) { xv_port = adaptor_info[adaptor_num].base_id + j; surface_type = surfaceInfo[surface_num].surface_type_id; break; } } - + if(xv_port) break; } @@ -1691,22 +1691,22 @@ static void *init_class (xine_t *xine, void *visual_gen) { 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)))) { - + xprintf (xine, XINE_VERBOSITY_DEBUG, "Found XVMC_MOCOMP\n"); max_width = surfaceInfo[surface_num].max_width; max_height = surfaceInfo[surface_num].max_height; for(j = 0; j < adaptor_info[adaptor_num].num_ports; j++) { /* try to grab a port */ - if(Success == XvGrabPort(display, - adaptor_info[adaptor_num].base_id + j, CurrentTime)) { + if(Success == XvGrabPort(display, + adaptor_info[adaptor_num].base_id + j, CurrentTime)) { xv_port = adaptor_info[adaptor_num].base_id + j; surface_type = surfaceInfo[surface_num].surface_type_id; break; } } - if(xv_port) + if(xv_port) break; } } @@ -1714,7 +1714,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { if(xv_port) { lprintf ("port %ld surface %d\n",xv_port,j); - IDCTaccel = 0; + IDCTaccel = 0; if(surfaceInfo[surface_num].flags & XVMC_OVERLAID_SURFACE) useOverlay = 1; if(surfaceInfo[surface_num].flags & XVMC_INTRA_UNSIGNED) @@ -1733,7 +1733,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { } } } /* outer for adaptor_num loop */ - + if (!xv_port) { xprintf (xine, XINE_VERBOSITY_LOG, @@ -1743,13 +1743,13 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ XUnlockDisplay(display); return NULL; - } + } else { - xprintf (xine, XINE_VERBOSITY_LOG, + xprintf (xine, XINE_VERBOSITY_LOG, _("video_out_xvmc: using Xv port %ld from adaptor %s\n" " for hardware colour space conversion and scaling\n"), xv_port, adaptor_info[adaptor_num].name); - + if(IDCTaccel&XINE_VO_IDCT_ACCEL) xprintf (xine, XINE_VERBOSITY_LOG, _(" idct and motion compensation acceleration \n")); else if (IDCTaccel&XINE_VO_MOTION_ACCEL) @@ -1761,7 +1761,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { } XUnlockDisplay(display); - + this = (xvmc_class_t *) malloc (sizeof (xvmc_class_t)); if (!this) diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c index 61e0139e3..256e2f5a8 100644 --- a/src/video_out/video_out_xxmc.c +++ b/src/video_out/video_out_xxmc.c @@ -4,7 +4,7 @@ * * This file is part of xine, a free video player. * - * xine is free software; you can redistribute it and/or modify it + * xine is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. @@ -40,7 +40,7 @@ static int gX11Fail; -static void xxmc_frame_updates(xxmc_driver_t *driver, xxmc_frame_t *frame, +static void xxmc_frame_updates(xxmc_driver_t *driver, xxmc_frame_t *frame, int init_macroblocks); static void dispose_ximage (xxmc_driver_t *this, XShmSegmentInfo *shminfo, XvImage *myimage); @@ -69,7 +69,7 @@ static const unsigned int accel_priority[] = { * Additional thread safety, since the plugin may decide to destroy a context * while it's surfaces are still active in the video-out loop. * When / If XvMC libs are reasonably thread-safe, the locks can be made - * more efficient by allowing multiple threads in that do not destroy + * more efficient by allowing multiple threads in that do not destroy * the context or surfaces that may be active in other threads. */ @@ -92,7 +92,7 @@ void xvmc_context_reader_lock(context_lock_t *c) #ifdef XVMC_THREAD_SAFE c->num_readers++; pthread_mutex_unlock(&c->mutex); -#endif +#endif } void xvmc_context_reader_unlock(context_lock_t *c) @@ -103,9 +103,9 @@ void xvmc_context_reader_unlock(context_lock_t *c) if (--(c->num_readers) == 0) { pthread_cond_broadcast(&c->cond); } - } + } #endif - pthread_mutex_unlock(&c->mutex); + pthread_mutex_unlock(&c->mutex); } static void xvmc_context_writer_lock(context_lock_t *c) @@ -115,7 +115,7 @@ static void xvmc_context_writer_lock(context_lock_t *c) while(c->num_readers) { pthread_cond_wait(&c->cond, &c->mutex); } -#endif +#endif } static void xvmc_context_writer_unlock(context_lock_t *c) @@ -131,34 +131,34 @@ static void xvmc_context_writer_unlock(context_lock_t *c) -static void xxmc_xvmc_dump_surfaces(xxmc_driver_t *this ) +static void xxmc_xvmc_dump_surfaces(xxmc_driver_t *this ) { int i; xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; for (i=0; i<XVMC_MAX_SURFACES; ++i) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "%d %d;",handler->surfInUse[i], + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "%d %d;",handler->surfInUse[i], handler->surfValid[i]); } - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "\n"); } -static void xxmc_xvmc_dump_subpictures(xxmc_driver_t *this) +static void xxmc_xvmc_dump_subpictures(xxmc_driver_t *this) { int i; xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; for (i=0; i<XVMC_MAX_SUBPICTURES; ++i) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "%d %d;",handler->subInUse[i], + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "%d %d;",handler->subInUse[i], handler->subValid[i]); } - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "\n"); } -static void xxmc_xvmc_surface_handler_construct(xxmc_driver_t *this) +static void xxmc_xvmc_surface_handler_construct(xxmc_driver_t *this) { xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; @@ -208,11 +208,11 @@ static void xxmc_xvmc_destroy_subpictures(xxmc_driver_t *this) } pthread_mutex_unlock(&handler->mutex); } - -static XvMCSurface *xxmc_xvmc_alloc_surface(xxmc_driver_t *this, + +static XvMCSurface *xxmc_xvmc_alloc_surface(xxmc_driver_t *this, XvMCContext *context) { - xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; + xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; int i; pthread_mutex_lock(&handler->mutex); @@ -228,7 +228,7 @@ static XvMCSurface *xxmc_xvmc_alloc_surface(xxmc_driver_t *this, for (i=0; i<XVMC_MAX_SURFACES; ++i) { if (!handler->surfInUse[i]) { XVMCLOCKDISPLAY( this->display ); - if (Success != XvMCCreateSurface( this->display, context, + if (Success != XvMCCreateSurface( this->display, context, handler->surfaces + i)) { XVMCUNLOCKDISPLAY( this->display ); pthread_mutex_unlock(&handler->mutex); @@ -247,13 +247,13 @@ static XvMCSurface *xxmc_xvmc_alloc_surface(xxmc_driver_t *this, return NULL; } -static void xxmc_xvmc_free_surface(xxmc_driver_t *this, XvMCSurface *surf) +static void xxmc_xvmc_free_surface(xxmc_driver_t *this, XvMCSurface *surf) { xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; unsigned index = surf - handler->surfaces; - if (index >= XVMC_MAX_SURFACES) return; + if (index >= XVMC_MAX_SURFACES) return; pthread_mutex_lock(&handler->mutex); xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Disposing of surface %d\n",index); @@ -277,7 +277,7 @@ int xxmc_xvmc_surface_valid(xxmc_driver_t *this, XvMCSurface *surf) } static XvMCSubpicture *xxmc_xvmc_alloc_subpicture - (xxmc_driver_t *this, + (xxmc_driver_t *this, XvMCContext *context, unsigned short width, unsigned short height, int xvimage_id) { @@ -290,7 +290,7 @@ static XvMCSubpicture *xxmc_xvmc_alloc_subpicture for (i=0; i<XVMC_MAX_SUBPICTURES; ++i) { if (handler->subValid[i] && !handler->subInUse[i]) { XVMCLOCKDISPLAY( this->display ); - if (XvMCGetSubpictureStatus( this->display, handler->subpictures + i, + if (XvMCGetSubpictureStatus( this->display, handler->subpictures + i, &status)) { XVMCUNLOCKDISPLAY( this->display ); continue; @@ -307,7 +307,7 @@ static XvMCSubpicture *xxmc_xvmc_alloc_subpicture for (i=0; i<XVMC_MAX_SUBPICTURES; ++i) { if (!handler->subInUse[i]) { XVMCLOCKDISPLAY( this->display ); - if (Success != XvMCCreateSubpicture( this->display, context, + if (Success != XvMCCreateSubpicture( this->display, context, handler->subpictures + i, width, height, xvimage_id)) { XVMCUNLOCKDISPLAY( this->display ); @@ -327,14 +327,14 @@ static XvMCSubpicture *xxmc_xvmc_alloc_subpicture return NULL; } -static void xxmc_xvmc_free_subpicture(xxmc_driver_t *this, XvMCSubpicture *sub) +static void xxmc_xvmc_free_subpicture(xxmc_driver_t *this, XvMCSubpicture *sub) { xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; unsigned index = sub - handler->subpictures; - if (index >= XVMC_MAX_SUBPICTURES) return; + if (index >= XVMC_MAX_SUBPICTURES) return; pthread_mutex_lock(&handler->mutex); xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Disposing of subpicture %d\n",index); @@ -346,7 +346,7 @@ static void xxmc_xvmc_free_subpicture(xxmc_driver_t *this, XvMCSubpicture *sub) /* * Callback used by decoder to check that surfaces are still valid, - * and to lock the context so that it won't get destroyed during + * and to lock the context so that it won't get destroyed during * decoding. */ @@ -356,9 +356,9 @@ static int xxmc_lock_and_validate_surfaces(vo_frame_t *cur_frame, vo_frame_t *bw_frame, unsigned pc_type) { - xxmc_driver_t + xxmc_driver_t *driver = (xxmc_driver_t *) cur_frame->driver; - xxmc_frame_t + xxmc_frame_t *frame; xvmc_context_reader_lock( &driver->xvmc_lock ); @@ -377,7 +377,7 @@ static int xxmc_lock_and_validate_surfaces(vo_frame_t *cur_frame, if (!xxmc_xvmc_surface_valid( driver, frame->xvmc_surf)) break; return 0; } - + xvmc_context_reader_unlock( &driver->xvmc_lock ); return -1; } @@ -388,19 +388,19 @@ static int xxmc_lock_and_validate_surfaces(vo_frame_t *cur_frame, static void xxmc_unlock_surfaces(vo_driver_t *this_gen) { - xxmc_driver_t + xxmc_driver_t *driver = (xxmc_driver_t *) this_gen; - + xvmc_context_reader_unlock( &driver->xvmc_lock ); } /* - * Callback for decoder. - * Check that the surface is vaid and + * Callback for decoder. + * Check that the surface is vaid and * flush outstanding rendering requests on this surface. */ -static void xvmc_flush(vo_frame_t *this_gen) +static void xvmc_flush(vo_frame_t *this_gen) { xxmc_frame_t @@ -412,7 +412,7 @@ static void xvmc_flush(vo_frame_t *this_gen) if ( ! xxmc_xvmc_surface_valid( driver, frame->xvmc_surf)) { frame->xxmc_data.result = 128; - xvmc_context_reader_unlock( &driver->xvmc_lock ); + xvmc_context_reader_unlock( &driver->xvmc_lock ); return; } @@ -432,10 +432,10 @@ static void xvmc_flush(vo_frame_t *this_gen) * using a call to XvMCBlendSubpicture2 with a blank subpicture. */ -static void xxmc_duplicate_frame_data(vo_frame_t *this_gen, - vo_frame_t *original) +static void xxmc_duplicate_frame_data(vo_frame_t *this_gen, + vo_frame_t *original) { - xxmc_frame_t *this = (xxmc_frame_t *) this_gen, + xxmc_frame_t *this = (xxmc_frame_t *) this_gen, *orig = (xxmc_frame_t *) original; xxmc_driver_t *driver = (xxmc_driver_t *) this_gen->driver; xine_t *xine = driver->xine; @@ -450,25 +450,25 @@ static void xxmc_duplicate_frame_data(vo_frame_t *this_gen, if (!xxmc_xvmc_surface_valid(driver,orig->xvmc_surf)) { xvmc_context_writer_unlock( &driver->xvmc_lock ); return; - } + } this->xxmc_data = *xxmc; this->width = original->width; this->height = original->height; this->format = original->format; this->ratio = original->ratio; - - xxmc_frame_updates(driver,this,0); + + xxmc_frame_updates(driver,this,0); /* - * Allocate a dummy subpicture and copy using - * XvMCBlendsubpicture2. VLD implementations can do blending with a + * Allocate a dummy subpicture and copy using + * XvMCBlendsubpicture2. VLD implementations can do blending with a * NULL subpicture. Use that if possible. */ need_dummy = (xxmc->acceleration != XINE_XVMC_ACCEL_VLD); tmp = NULL; if (need_dummy) { - tmp = xxmc_xvmc_alloc_subpicture( driver, &driver->context, + tmp = xxmc_xvmc_alloc_subpicture( driver, &driver->context, this->width, this->height, driver->xvmc_cap [driver->xvmc_cur_cap].subPicType.id); @@ -477,20 +477,20 @@ static void xxmc_duplicate_frame_data(vo_frame_t *this_gen, XVMCLOCKDISPLAY( driver->display ); if (tmp) XvMCClearSubpicture(driver->display, tmp , 0,0, this->width, this->height, 0); - if (Success == XvMCBlendSubpicture2( driver->display, orig->xvmc_surf, + if (Success == XvMCBlendSubpicture2( driver->display, orig->xvmc_surf, this->xvmc_surf, tmp, - 0,0,this->width, this->height, + 0,0,this->width, this->height, 0,0,this->width, this->height)) { this->xxmc_data.decoded = 1; } XVMCUNLOCKDISPLAY( driver->display ); if (tmp) xxmc_xvmc_free_subpicture( driver, tmp); } - + xvmc_context_writer_unlock( &driver->xvmc_lock ); xprintf(xine, XINE_VERBOSITY_DEBUG, "Duplicated XvMC frame %d %d.\n", this->width,this->height); -} +} static uint32_t xxmc_get_capabilities (vo_driver_t *this_gen) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; @@ -499,7 +499,7 @@ static uint32_t xxmc_get_capabilities (vo_driver_t *this_gen) { } -static void xxmc_frame_field (vo_frame_t *vo_img, int which_field) +static void xxmc_frame_field (vo_frame_t *vo_img, int which_field) { lprintf ("xvmc_frame_field\n"); } @@ -544,13 +544,13 @@ static void xxmc_frame_dispose (vo_frame_t *vo_img) { */ static vo_frame_t *xxmc_alloc_frame (vo_driver_t *this_gen) { - xxmc_driver_t *this = (xxmc_driver_t *) this_gen; + xxmc_driver_t *this = (xxmc_driver_t *) this_gen; xxmc_frame_t *frame ; frame = calloc(1, sizeof (xxmc_frame_t)); if (!frame) return NULL; - + pthread_mutex_init (&frame->vo_frame.mutex, NULL); frame->xvmc_surf = NULL; @@ -575,7 +575,7 @@ static vo_frame_t *xxmc_alloc_frame (vo_driver_t *this_gen) { static int HandleXError (Display *display, XErrorEvent *xevent) { char str [1024]; - + XGetErrorText (display, xevent->error_code, str, 1024); printf ("received X error event: %s\n", str); gX11Fail = 1; @@ -607,7 +607,7 @@ static XvImage *create_ximage (xxmc_driver_t *this, XShmSegmentInfo *shminfo, } switch (format) { - case XINE_IMGFMT_YV12: + case XINE_IMGFMT_YV12: xv_format = this->xv_format_yv12; break; case XINE_IMGFMT_YUY2: @@ -753,7 +753,7 @@ static void xxmc_dispose_context(xxmc_driver_t *driver) XvMCDestroyMacroBlocks( driver->display, ¯oblocks->macro_blocks ); XvMCDestroyBlocks( driver->display , ¯oblocks->blocks ); } - + xprintf(driver->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: Freeing up XvMC Surfaces and subpictures.\n"); if (driver->xvmc_palette) free(driver->xvmc_palette); @@ -763,15 +763,15 @@ static void xxmc_dispose_context(xxmc_driver_t *driver) xprintf(driver->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: Freeing up XvMC Context.\n"); XLockDisplay (driver->display); - if (driver->subImage) - dispose_ximage(driver, &driver->subShmInfo, driver->subImage); + if (driver->subImage) + dispose_ximage(driver, &driver->subShmInfo, driver->subImage); driver->subImage = NULL; XUnlockDisplay (driver->display); XVMCLOCKDISPLAY( driver->display ); XvMCDestroyContext( driver->display, &driver->context); XVMCUNLOCKDISPLAY( driver->display ); driver->contextActive = 0; - driver->hwSubpictures = 0; + driver->hwSubpictures = 0; driver->xvmc_accel = 0; } } @@ -779,7 +779,7 @@ static void xxmc_dispose_context(xxmc_driver_t *driver) /* * Find a suitable XvMC Context according to the acceleration request * passed to us in the xxmc variable, and to the acceleration type - * priority set up in this plugin. Result is returned in + * priority set up in this plugin. Result is returned in * driver->xvmc_cur_cap. */ @@ -793,7 +793,7 @@ static int xxmc_find_context(xxmc_driver_t *driver, xine_xxmc_t *xxmc, request_mpeg_flags = xxmc->mpeg; found = 0; curCap = NULL; - + for (k = 0; k < NUM_ACCEL_PRIORITY; ++k) { request_accel_flags = xxmc->acceleration & accel_priority[k]; if (!request_accel_flags) continue; @@ -827,7 +827,7 @@ static int xxmc_find_context(xxmc_driver_t *driver, xine_xxmc_t *xxmc, } driver->xvmc_accel = 0; return 0; -} +} static int xxmc_create_context(xxmc_driver_t *driver, unsigned width, unsigned height) { @@ -837,9 +837,9 @@ static int xxmc_create_context(xxmc_driver_t *driver, unsigned width, unsigned h xprintf(driver->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: Creating new XvMC Context %d\n",curCap->type_id); XVMCLOCKDISPLAY( driver->display ); - if (Success == XvMCCreateContext( driver->display, driver->xv_port, + if (Success == XvMCCreateContext( driver->display, driver->xv_port, curCap->type_id, width, - height, driver->context_flags, + height, driver->context_flags, &driver->context)) { driver->xvmc_mpeg = curCap->mpeg_flags; driver->xvmc_width = width; @@ -860,26 +860,26 @@ static void xxmc_setup_subpictures(xxmc_driver_t *driver, unsigned width, unsign /* * Determine if we can use hardware subpictures, and in that case, set up an * XvImage that we can use for blending. - */ + */ curCap = driver->xvmc_cap + driver->xvmc_cur_cap; - if ((width > curCap->sub_max_width) || + if ((width > curCap->sub_max_width) || (height > curCap->sub_max_height)) return; - if ((driver->xvmc_backend_subpic = (curCap->flags & XVMC_BACKEND_SUBPICTURE))) + if ((driver->xvmc_backend_subpic = (curCap->flags & XVMC_BACKEND_SUBPICTURE))) xprintf(driver->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: Using Backend subpictures.\n"); - + if (!driver->subImage) { /* * Note: If other image formats than xx44 are to be used here, they must be - * translated to XINE_IMGFMT_XXX, since that is what create_ximage + * translated to XINE_IMGFMT_XXX, since that is what create_ximage * expects. */ XLockDisplay (driver->display); - driver->subImage = + driver->subImage = create_ximage(driver, &driver->subShmInfo, width, height, curCap->subPicType.id); XUnlockDisplay (driver->display); if (NULL == driver->subImage) { @@ -889,15 +889,15 @@ static void xxmc_setup_subpictures(xxmc_driver_t *driver, unsigned width, unsign } } - sp = xxmc_xvmc_alloc_subpicture( driver, &driver->context, width, + sp = xxmc_xvmc_alloc_subpicture( driver, &driver->context, width, height, curCap->subPicType.id); if (sp == NULL) return; _x_init_xx44_palette( &driver->palette, sp->num_palette_entries); - driver->xvmc_palette = (char *) xine_xmalloc(sp->num_palette_entries + driver->xvmc_palette = (char *) xine_xmalloc(sp->num_palette_entries * sp->entry_bytes); xxmc_xvmc_free_subpicture( driver, sp); - if (driver->xvmc_palette == NULL) return; + if (driver->xvmc_palette == NULL) return; driver->hwSubpictures = 1; } } @@ -927,8 +927,8 @@ static int xxmc_mocomp_create_macroblocks(xxmc_driver_t *driver, xxmc->xvmc.macroblocks = (xine_macroblocks_t *)macroblocks; return 1; -} - +} + static void xvmc_check_colorkey_properties(xxmc_driver_t *driver) { int num,i; @@ -943,7 +943,7 @@ static void xvmc_check_colorkey_properties(xxmc_driver_t *driver) driver->have_xvmc_autopaint = 0; if (driver->context_flags & XVMC_OVERLAID_SURFACE) { XVMCLOCKDISPLAY( driver->display ); - xvmc_attributes = XvMCQueryAttributes( driver->display, + xvmc_attributes = XvMCQueryAttributes( driver->display, &driver->context, &num); if (xvmc_attributes) { @@ -953,7 +953,7 @@ static void xvmc_check_colorkey_properties(xxmc_driver_t *driver) XvMCSetAttribute(driver->display, &driver->context,ap, driver->props[VO_PROP_AUTOPAINT_COLORKEY].value); driver->have_xvmc_autopaint = 1; - } + } } } XFree(xvmc_attributes); @@ -966,16 +966,16 @@ static void xvmc_check_colorkey_properties(xxmc_driver_t *driver) static int xxmc_xvmc_update_context(xxmc_driver_t *driver, xxmc_frame_t *frame, - uint32_t width, uint32_t height, int frame_format_xxmc) + uint32_t width, uint32_t height, int frame_format_xxmc) { xine_xxmc_t *xxmc = &frame->xxmc_data; /* * Are we at all capable of doing XvMC ? - */ + */ - - if (driver->xvmc_cap == 0) + + if (driver->xvmc_cap == 0) return 0; xprintf(driver->xine, XINE_VERBOSITY_LOG, @@ -986,18 +986,18 @@ static int xxmc_xvmc_update_context(xxmc_driver_t *driver, xxmc_frame_t *frame, " mpeg: %d acceleration: %d", xxmc->mpeg, xxmc->acceleration); } xprintf(driver->xine, XINE_VERBOSITY_LOG, "\n"); - + if (frame->xvmc_surf) xxmc_xvmc_free_surface( driver , frame->xvmc_surf); frame->xvmc_surf = NULL; xxmc_dispose_context( driver ); - + if (frame_format_xxmc && xxmc_find_context( driver, xxmc, width, height )) { xxmc_create_context( driver, width, height); xvmc_check_colorkey_properties( driver ); xxmc_setup_subpictures(driver, width, height); - if ((driver->xvmc_accel & + if ((driver->xvmc_accel & (XINE_XVMC_ACCEL_MOCOMP | XINE_XVMC_ACCEL_IDCT))) { if (!xxmc_mocomp_create_macroblocks(driver, frame, 1)) { lprintf("video_out_xxmc: ERROR: Macroblock allocation failed\n"); @@ -1012,15 +1012,15 @@ static int xxmc_xvmc_update_context(xxmc_driver_t *driver, xxmc_frame_t *frame, } else { printf("video_out_xxmc: Using hardware decoding for this stream.\n"); } - + driver->xvmc_mpeg = xxmc->mpeg; driver->xvmc_width = width; driver->xvmc_height = height; return driver->contextActive; } -static void xxmc_frame_updates(xxmc_driver_t *driver, - xxmc_frame_t *frame, +static void xxmc_frame_updates(xxmc_driver_t *driver, + xxmc_frame_t *frame, int init_macroblocks) { xine_xxmc_t *xxmc = &frame->xxmc_data; @@ -1041,10 +1041,10 @@ static void xxmc_frame_updates(xxmc_driver_t *driver, /* * If it is NULL create a new surface. - */ + */ if (frame->xvmc_surf == NULL) { - if (NULL == (frame->xvmc_surf = + if (NULL == (frame->xvmc_surf = xxmc_xvmc_alloc_surface( driver, &driver->context))) { fprintf(stderr, "video_out_xxmc: ERROR: Accelerated surface allocation failed.\n" "video_out_xxmc: You are probably out of framebuffer memory.\n" @@ -1052,7 +1052,7 @@ static void xxmc_frame_updates(xxmc_driver_t *driver, driver->xvmc_accel = 0; xxmc_dispose_context( driver ); return; - } + } xxmc->xvmc.macroblocks = (xine_macroblocks_t *) &driver->macroblocks; xxmc->xvmc.macroblocks->xvmc_accel = (driver->unsigned_intra) ? 0 : XINE_VO_SIGNED_INTRA; @@ -1071,7 +1071,7 @@ static void xxmc_frame_updates(xxmc_driver_t *driver, xxmc->proc_xxmc_flush = xvmc_flush; xxmc->proc_xxmc_lock_valid = xxmc_lock_and_validate_surfaces; xxmc->proc_xxmc_unlock = xxmc_unlock_surfaces; - + xxmc->xvmc.proc_macro_block = xxmc_xvmc_proc_macro_block; frame->vo_frame.proc_duplicate_frame_data = xxmc_duplicate_frame_data; #ifdef HAVE_VLDXVMC @@ -1083,7 +1083,7 @@ static void xxmc_frame_updates(xxmc_driver_t *driver, if (init_macroblocks) { driver->macroblocks.num_blocks = 0; driver->macroblocks.macroblockptr = driver->macroblocks.macroblockbaseptr; - driver->macroblocks.xine_mc.blockptr = + driver->macroblocks.xine_mc.blockptr = driver->macroblocks.xine_mc.blockbaseptr; } xxmc->acceleration = driver->xvmc_accel; @@ -1105,7 +1105,7 @@ static void dispose_ximage (xxmc_driver_t *this, shminfo->shmid = -1; } - } + } else { if (myimage->data) free(myimage->data); XFree (myimage); @@ -1125,29 +1125,29 @@ static void xxmc_do_update_frame_xv(vo_driver_t *this_gen, if (this->use_pitch_alignment) { width = (width + 7) & ~0x7; } - + if ((frame->width != width) || (frame->height != height) || (frame->last_sw_format != format)) { - + frame->last_sw_format = format; XLockDisplay (this->display); - + /* * (re-) allocate xvimage */ - + if (frame->image) { dispose_ximage (this, &frame->shminfo, frame->image); frame->image = NULL; } - + frame->image = create_ximage (this, &frame->shminfo, width, height, format); - + if(format == XINE_IMGFMT_YUY2) { frame->vo_frame.pitches[0] = frame->image->pitches[0]; frame->vo_frame.base[0] = frame->image->data + frame->image->offsets[0]; - } + } else { frame->vo_frame.pitches[0] = frame->image->pitches[0]; frame->vo_frame.pitches[1] = frame->image->pitches[2]; @@ -1156,14 +1156,14 @@ static void xxmc_do_update_frame_xv(vo_driver_t *this_gen, frame->vo_frame.base[1] = frame->image->data + frame->image->offsets[2]; frame->vo_frame.base[2] = frame->image->data + frame->image->offsets[1]; } - + XUnlockDisplay (this->display); } frame->ratio = ratio; frame->width = width; frame->height = height; - frame->format = format; + frame->format = format; frame->vo_frame.format = frame->format; } @@ -1180,7 +1180,7 @@ static int xxmc_accel_update(xxmc_driver_t *driver, /* * Same acceleration request. No need to change. - */ + */ if (last_request == new_request) return 0; @@ -1199,7 +1199,7 @@ static int xxmc_accel_update(xxmc_driver_t *driver, if (new_request & accel_priority[k]) return 1; } - /* + /* * Should never get here. */ @@ -1229,10 +1229,10 @@ static void xxmc_do_update_frame(vo_driver_t *this_gen, this->last_accel_request = xxmc->acceleration; } - if (this->contextActive) + if (this->contextActive) xxmc_frame_updates(this, frame, 1); - xxmc_do_update_frame_xv(this_gen, frame_gen, width, height, ratio, + xxmc_do_update_frame_xv(this_gen, frame_gen, width, height, ratio, xxmc->fallback_format, flags); if (!this->contextActive) { @@ -1245,7 +1245,7 @@ static void xxmc_do_update_frame(vo_driver_t *this_gen, } xvmc_context_writer_unlock( &this->xvmc_lock); - + } else { /* switch back to an unaccelerated context */ if (this->last_accel_request != 0xFFFFFFFF) { @@ -1253,7 +1253,7 @@ static void xxmc_do_update_frame(vo_driver_t *this_gen, xxmc_xvmc_update_context(this, frame, width, height, 0); } frame->vo_frame.proc_duplicate_frame_data = NULL; - xxmc_do_update_frame_xv(this_gen, frame_gen, width, height, ratio, + xxmc_do_update_frame_xv(this_gen, frame_gen, width, height, ratio, format, flags); } } @@ -1261,7 +1261,7 @@ static void xxmc_do_update_frame(vo_driver_t *this_gen, static void xxmc_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) + double ratio, int format, int flags) { if (format != XINE_IMGFMT_XXMC) { @@ -1279,7 +1279,7 @@ static void xxmc_update_frame_format(vo_driver_t *this_gen, xine_xxmc_t *xxmc = (xine_xxmc_t *)frame_gen->accel_data; xxmc->decoded = 0; xxmc->proc_xxmc_update_frame = xxmc_do_update_frame; - frame_gen->proc_duplicate_frame_data = xxmc_duplicate_frame_data; + frame_gen->proc_duplicate_frame_data = xxmc_duplicate_frame_data; } } @@ -1301,16 +1301,16 @@ static int xxmc_clean_output_area (xxmc_driver_t *this, int xvmc_active) { this->sc.border[i].w, this->sc.border[i].h); } } - + /* * XvMC does not support autopainting regardless of whether there's an - * Xv attribute for it. However, if there is an XvMC attribute for - * autopainting, we should be able to assume it is supported. + * Xv attribute for it. However, if there is an XvMC attribute for + * autopainting, we should be able to assume it is supported. * That support is checked whenever a context is changed. */ - autopainting = (this->props[VO_PROP_AUTOPAINT_COLORKEY].value == 1); - if ((xvmc_active && + autopainting = (this->props[VO_PROP_AUTOPAINT_COLORKEY].value == 1); + if ((xvmc_active && (this->context_flags & XVMC_OVERLAID_SURFACE) && (! this->have_xvmc_autopaint || ! autopainting)) || @@ -1323,12 +1323,12 @@ static int xxmc_clean_output_area (xxmc_driver_t *this, int xvmc_active) { } else { ret = 0; } - + if (this->xoverlay) { x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height); this->ovl_changed = 1; } - + XUnlockDisplay (this->display); return ret; } @@ -1354,11 +1354,11 @@ static void xxmc_compute_output_size (xxmc_driver_t *this) { } -static void xxmc_check_xoverlay_type(xxmc_driver_t *driver, xxmc_frame_t *frame) +static void xxmc_check_xoverlay_type(xxmc_driver_t *driver, xxmc_frame_t *frame) { int - new_overlay_type = (frame->format == XINE_IMGFMT_XXMC) ? + new_overlay_type = (frame->format == XINE_IMGFMT_XXMC) ? driver->xvmc_xoverlay_type : driver->xv_xoverlay_type; if (driver->xoverlay_type != new_overlay_type) { printf("Warning! Changing xoverlay\n"); @@ -1371,40 +1371,40 @@ static void xxmc_check_xoverlay_type(xxmc_driver_t *driver, xxmc_frame_t *frame) } -static void xxmc_overlay_begin (vo_driver_t *this_gen, +static void xxmc_overlay_begin (vo_driver_t *this_gen, vo_frame_t *frame_gen, int changed) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; xxmc_frame_t *frame = (xxmc_frame_t *) frame_gen; this->ovl_changed += changed; - + xvmc_context_reader_lock( &this->xvmc_lock ); - if ((frame->format == XINE_IMGFMT_XXMC) && + if ((frame->format == XINE_IMGFMT_XXMC) && !xxmc_xvmc_surface_valid(this, frame->xvmc_surf)) { xvmc_context_reader_unlock( &this->xvmc_lock ); return; } if( this->ovl_changed && this->xoverlay ) { - + XLockDisplay (this->display); xxmc_check_xoverlay_type(this, frame); - x11osd_clear(this->xoverlay); + x11osd_clear(this->xoverlay); XUnlockDisplay (this->display); - } - if (this->ovl_changed && (frame->format == XINE_IMGFMT_XXMC) && + } + if (this->ovl_changed && (frame->format == XINE_IMGFMT_XXMC) && this->hwSubpictures ) { this->new_subpic = xxmc_xvmc_alloc_subpicture - ( this, &this->context, this->xvmc_width, - this->xvmc_height, + ( this, &this->context, this->xvmc_width, + this->xvmc_height, this->xvmc_cap[this->xvmc_cur_cap].subPicType.id); if (this->new_subpic) { this->first_overlay = 1; XVMCLOCKDISPLAY( this->display ); - XvMCClearSubpicture(this->display, this->new_subpic, 0,0, + XvMCClearSubpicture(this->display, this->new_subpic, 0,0, this->xvmc_width, this->xvmc_height, 0x00); XVMCUNLOCKDISPLAY( this->display ); @@ -1412,22 +1412,22 @@ static void xxmc_overlay_begin (vo_driver_t *this_gen, } } xvmc_context_reader_unlock( &this->xvmc_lock ); - + this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; } -static void xxmc_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) +static void xxmc_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; xxmc_frame_t *frame = (xxmc_frame_t *) vo_img; - + if( this->ovl_changed && this->xoverlay ) { XLockDisplay (this->display); x11osd_expose(this->xoverlay); XUnlockDisplay (this->display); - } + } if ((frame->format == XINE_IMGFMT_XXMC) && this->hwSubpictures) { LOCK_AND_SURFACE_VALID( this, frame->xvmc_surf ); if (this->ovl_changed) { @@ -1444,7 +1444,7 @@ static void xxmc_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) this->reverse_nvidia_palette ? "YVU" : this->old_subpic->component_order); XVMCLOCKDISPLAY( this->display ); - XvMCSetSubpicturePalette( this->display, this->old_subpic, + XvMCSetSubpicturePalette( this->display, this->old_subpic, this->xvmc_palette); XvMCFlushSubpicture( this->display , this->old_subpic); XvMCSyncSubpicture( this->display, this->old_subpic ); @@ -1455,14 +1455,14 @@ static void xxmc_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) XVMCLOCKDISPLAY( this->display ); if (this->xvmc_backend_subpic ) { XvMCBlendSubpicture( this->display, frame->xvmc_surf, - this->old_subpic,0,0,this->xvmc_width, + this->old_subpic,0,0,this->xvmc_width, this->xvmc_height, 0, 0, this->xvmc_width, this->xvmc_height ); } else { - XvMCBlendSubpicture2( this->display, frame->xvmc_surf, + XvMCBlendSubpicture2( this->display, frame->xvmc_surf, frame->xvmc_surf, - this->old_subpic, 0,0,this->xvmc_width, - this->xvmc_height,0,0,this->xvmc_width, + this->old_subpic, 0,0,this->xvmc_width, + this->xvmc_height,0,0,this->xvmc_width, this->xvmc_height); } XVMCUNLOCKDISPLAY( this->display ); @@ -1473,8 +1473,8 @@ static void xxmc_overlay_end (vo_driver_t *this_gen, vo_frame_t *vo_img) } -static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, - vo_overlay_t *overlay) +static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, + vo_overlay_t *overlay) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; xxmc_frame_t *frame = (xxmc_frame_t *) frame_gen; @@ -1484,7 +1484,7 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, if( overlay->unscaled ) { if( this->ovl_changed && this->xoverlay ) { XLockDisplay (this->display); - x11osd_blend(this->xoverlay, overlay); + x11osd_blend(this->xoverlay, overlay); XUnlockDisplay (this->display); } } else if (frame->format == XINE_IMGFMT_XXMC) { @@ -1497,7 +1497,7 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, this->subImage->height); this->first_overlay = 0; } - _x_blend_xx44(this->subImage->data, overlay, this->subImage->width, + _x_blend_xx44(this->subImage->data, overlay, this->subImage->width, this->subImage->height, this->subImage->width, &this->alphablend_extra_data, &this->palette, (this->subImage->id == FOURCC_IA44)); @@ -1509,7 +1509,7 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, y1 = y0 + overlay->height; w = this->subImage->width; h = this->subImage->height; - + x0 = (x0 < 0) ? 0 : ((x0 > w) ? w : x0); y0 = (y0 < 0) ? 0 : ((y0 > h) ? h : y0); x1 = (x1 < 0) ? 0 : ((x1 > w) ? w : x1); @@ -1518,22 +1518,22 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, /* anything left after clipping? */ if (x0 != x1 && y0 != y1) { XVMCLOCKDISPLAY( this->display ); - XvMCCompositeSubpicture( this->display, this->new_subpic, - this->subImage, + XvMCCompositeSubpicture( this->display, this->new_subpic, + this->subImage, x0, y0, x1 - x0, y1 - y0, x0, y0); XVMCUNLOCKDISPLAY( this->display ); } - xvmc_context_reader_unlock( &this->xvmc_lock ); + xvmc_context_reader_unlock( &this->xvmc_lock ); } } - } else { + } else { if (frame->format == XINE_IMGFMT_YV12) { - _x_blend_yuv(frame->vo_frame.base, overlay, + _x_blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); } else { - _x_blend_yuy2(frame->vo_frame.base[0], overlay, + _x_blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0], &this->alphablend_extra_data); } @@ -1541,7 +1541,7 @@ static void xxmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, } } -static void xxmc_add_recent_frame (xxmc_driver_t *this, xxmc_frame_t *frame) +static void xxmc_add_recent_frame (xxmc_driver_t *this, xxmc_frame_t *frame) { int i; i = VO_NUM_RECENT_FRAMES-1; @@ -1555,11 +1555,11 @@ static void xxmc_add_recent_frame (xxmc_driver_t *this, xxmc_frame_t *frame) this->recent_frames[0] = frame; } -static int xxmc_redraw_needed (vo_driver_t *this_gen) +static int xxmc_redraw_needed (vo_driver_t *this_gen) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; int ret = 0; - + if( this->cur_frame ) { this->sc.delivered_height = this->cur_frame->height; @@ -1576,8 +1576,8 @@ static int xxmc_redraw_needed (vo_driver_t *this_gen) if( _x_vo_scale_redraw_needed( &this->sc ) ) { xxmc_compute_output_size (this); - - xxmc_clean_output_area + + xxmc_clean_output_area (this, (this->cur_frame->format == XINE_IMGFMT_XXMC)); ret = 1; @@ -1589,7 +1589,7 @@ static int xxmc_redraw_needed (vo_driver_t *this_gen) return ret; } -static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) +static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; xxmc_frame_t *frame = (xxmc_frame_t *) frame_gen; @@ -1623,7 +1623,7 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) * reset this flag now -- it will be set again before the next call to * xxmc_display_frame() as long as there is a scaled OSD active on screen. */ - this->scaled_osd_active = 0; + this->scaled_osd_active = 0; /* * queue frames (deinterlacing) @@ -1681,7 +1681,7 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) this->sc.displayed_xoffset, this->sc.displayed_yoffset, this->sc.displayed_width, this->sc.displayed_height, this->sc.output_xoffset, this->sc.output_yoffset, - this->sc.output_width, this->sc.output_height, + this->sc.output_width, this->sc.output_height, this->cur_field); XUnlockDisplay( this->display ); /* unblocks XINE_GUI_SEND_DRAWABLE_CHANGED from changing drawable */ XVMCUNLOCKDISPLAY( this->display ); @@ -1717,12 +1717,12 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) this->sc.displayed_xoffset, this->sc.displayed_yoffset, this->sc.displayed_width, this->sc.displayed_height, this->sc.output_xoffset, this->sc.output_yoffset, - this->sc.output_width, this->sc.output_height, + this->sc.output_width, this->sc.output_height, this->cur_field); XUnlockDisplay( this->display ); /* unblocks XINE_GUI_SEND_DRAWABLE_CHANGED from changing drawable */ XVMCUNLOCKDISPLAY( this->display ); } - } + } } else { XLockDisplay (this->display); if (this->use_shm) { @@ -1789,7 +1789,7 @@ static void xxmc_property_callback (void *property_gen, xine_cfg_entry_t *entry) if (this->contextActive) { XVMCLOCKDISPLAY( this->display ); XvMCSetAttribute(this->display, &this->context, - property->atom, + property->atom, entry->num_value); XVMCUNLOCKDISPLAY( this->display ); } @@ -1809,7 +1809,7 @@ static int xxmc_set_property (vo_driver_t *this_gen, if (this->contextActive) { XVMCLOCKDISPLAY( this->display ); XvMCSetAttribute(this->display, &this->context, - this->props[property].atom, + this->props[property].atom, value); XVMCUNLOCKDISPLAY( this->display ); } @@ -1827,7 +1827,7 @@ static int xxmc_set_property (vo_driver_t *this_gen, this->props[property].entry->num_value = this->props[property].value; return this->props[property].value; - } + } else { switch (property) { @@ -1843,7 +1843,7 @@ static int xxmc_set_property (vo_driver_t *this_gen, value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; - xprintf(this->xine, XINE_VERBOSITY_LOG, + xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); this->sc.user_ratio = value; @@ -1857,7 +1857,7 @@ static int xxmc_set_property (vo_driver_t *this_gen, this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, "video_out_xxmc: VO_PROP_ZOOM_X = %d\n", this->props[property].value); - + this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; xxmc_compute_ideal_size (this); @@ -1902,7 +1902,7 @@ static int xxmc_gui_data_exchange (vo_driver_t *this_gen, case XINE_GUI_SEND_COMPLETION_EVENT: break; #endif - + case XINE_GUI_SEND_EXPOSE_EVENT: { /* XExposeEvent * xev = (XExposeEvent *) data; */ @@ -1914,7 +1914,7 @@ static int xxmc_gui_data_exchange (vo_driver_t *this_gen, if ((frame->format == XINE_IMGFMT_XXMC) && (!xxmc->decoded || !xxmc_xvmc_surface_valid(this, frame->xvmc_surf))) { xvmc_context_reader_unlock( &this->xvmc_lock ); - if (! xxmc_redraw_needed (this_gen)) + if (! xxmc_redraw_needed (this_gen)) xxmc_clean_output_area(this, (frame->format == XINE_IMGFMT_XXMC)); break; } @@ -1928,8 +1928,8 @@ static int xxmc_gui_data_exchange (vo_driver_t *this_gen, this->sc.displayed_xoffset, this->sc.displayed_yoffset, this->sc.displayed_width, this->sc.displayed_height, this->sc.output_xoffset, this->sc.output_yoffset, - this->sc.output_width, this->sc.output_height, - this->cur_field); + this->sc.output_width, this->sc.output_height, + this->cur_field); XVMCUNLOCKDISPLAY( this->display ); } else { XLockDisplay (this->display); @@ -1954,10 +1954,10 @@ static int xxmc_gui_data_exchange (vo_driver_t *this_gen, xvmc_context_reader_unlock( &this->xvmc_lock ); } if(this->xoverlay) - x11osd_expose(this->xoverlay); - + x11osd_expose(this->xoverlay); + } - + break; case XINE_GUI_SEND_DRAWABLE_CHANGED: @@ -2000,7 +2000,7 @@ static void xxmc_dispose (vo_driver_t *this_gen) { xxmc_driver_t *this = (xxmc_driver_t *) this_gen; int i; - + if (this->xvmc_cap) { xvmc_context_writer_lock( &this->xvmc_lock ); xxmc_dispose_context( this ); @@ -2037,7 +2037,7 @@ static void xxmc_dispose (vo_driver_t *this_gen) { free_context_lock(&this->xvmc_lock); _x_alphablend_free(&this->alphablend_extra_data); - + free (this); } @@ -2048,7 +2048,7 @@ static int xxmc_check_yv12 (Display *display, XvPortID port) { int i; formatValues = XvListImageFormats (display, port, &formats); - + for (i = 0; i < formats; i++) if ((formatValues[i].id == XINE_IMGFMT_YV12) && (! (strcmp (formatValues[i].guid, "YV12")))) { @@ -2069,7 +2069,7 @@ static void xxmc_check_capability (xxmc_driver_t *this, int int_default; cfg_entry_t *entry; const char *str_prop = attr.name; - + if (VO_PROP_COLORKEY && (attr.max_value == ~0)) attr.max_value = 2147483615; @@ -2088,7 +2088,7 @@ static void xxmc_check_capability (xxmc_driver_t *this, */ if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0) int_default = 1; - + if (config_name) { /* is this a boolean property ? */ if ((attr.min_value == 0) && (attr.max_value == 1)) { @@ -2105,12 +2105,12 @@ static void xxmc_check_capability (xxmc_driver_t *this, entry = this->config->lookup_entry (this->config, config_name); - if((entry->num_value < this->props[property].min) || + if((entry->num_value < this->props[property].min) || (entry->num_value > this->props[property].max)) { - this->config->update_num(this->config, config_name, + this->config->update_num(this->config, config_name, ((this->props[property].min + this->props[property].max) >> 1)); - + entry = this->config->lookup_entry (this->config, config_name); } @@ -2118,13 +2118,13 @@ static void xxmc_check_capability (xxmc_driver_t *this, xxmc_set_property (&this->vo_driver, property, entry->num_value); - + if (strcmp(str_prop, "XV_COLORKEY") == 0) { this->use_colorkey |= 1; this->colorkey = entry->num_value; } else if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0) { if(entry->num_value==1) - this->use_colorkey |= 2; + this->use_colorkey |= 2; } } else this->props[property].value = int_default; @@ -2241,13 +2241,13 @@ static XvPortID xxmc_autodetect_port(xxmc_driver_t *this, } -static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) +static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) { int numSurf,numSub,i,j; XvMCSurfaceInfo *surfaceInfo,*curInfo; - XvMCContext + XvMCContext c; xvmc_capabilities_t *curCap; @@ -2266,13 +2266,13 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) XVMCLOCKDISPLAY( this->display ); - if ( !XvMCQueryExtension(this->display, &this->xvmc_eventbase, + if ( !XvMCQueryExtension(this->display, &this->xvmc_eventbase, &this->xvmc_errbase)) { XVMCUNLOCKDISPLAY( this->display ); xvmc_context_writer_unlock( &this->xvmc_lock ); return; } - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: XvMC extension present.\n"); surfaceInfo = XvMCListSurfaceTypes(this->display, xv_port, &numSurf); @@ -2288,56 +2288,56 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) curInfo = surfaceInfo; curCap = this->xvmc_cap; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Found %d XvMC surface types\n",numSurf); for (i=0; i< numSurf; ++i) { curCap->mpeg_flags = 0; curCap->accel_flags = 0; if (curInfo->chroma_format == XVMC_CHROMA_FORMAT_420) { - curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_1) ? - XINE_XVMC_MPEG_1 : 0); - curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_2) ? + curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_1) ? + XINE_XVMC_MPEG_1 : 0); + curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_2) ? XINE_XVMC_MPEG_2 : 0); - curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_4) ? + curCap->mpeg_flags |= ((curInfo->mc_type & XVMC_MPEG_4) ? XINE_XVMC_MPEG_4 : 0); - curCap->accel_flags |= ((curInfo->mc_type & XVMC_VLD) ? + curCap->accel_flags |= ((curInfo->mc_type & XVMC_VLD) ? XINE_XVMC_ACCEL_VLD : 0); - curCap->accel_flags |= ((curInfo->mc_type & XVMC_IDCT) ? + curCap->accel_flags |= ((curInfo->mc_type & XVMC_IDCT) ? XINE_XVMC_ACCEL_IDCT : 0); - curCap->accel_flags |= ((curInfo->mc_type & (XVMC_VLD | XVMC_IDCT)) ? + curCap->accel_flags |= ((curInfo->mc_type & (XVMC_VLD | XVMC_IDCT)) ? 0 : XINE_XVMC_ACCEL_MOCOMP); curCap->max_width = curInfo->max_width; curCap->max_height = curInfo->max_height; curCap->sub_max_width = curInfo->subpicture_max_width; curCap->sub_max_height = curInfo->subpicture_max_height; curCap->flags = curInfo->flags; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Surface type %d: Max size: %d %d.\n", i,curCap->max_width,curCap->max_height); - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Surface type %d: Max subpic size: %d %d.\n", i,curCap->sub_max_width,curCap->sub_max_height); - + curCap->type_id = curInfo->surface_type_id; - formatValues = XvMCListSubpictureTypes( this->display, xv_port, + formatValues = XvMCListSubpictureTypes( this->display, xv_port, curCap->type_id, &numSub); curCap->subPicType.id = 0; if (formatValues) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Surface type %d: Found %d XvMC subpicture " "types\n",i,numSub); for (j = 0; j<numSub; ++j) { if (formatValues[j].id == FOURCC_IA44) { curCap->subPicType = formatValues[j]; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Surface type %d: Detected and using " "IA44 subpicture type.\n",i); /* Prefer IA44 */ break; } else if (formatValues[j].id == FOURCC_AI44) { curCap->subPicType = formatValues[j]; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Surface type %d: Detected AI44 " "subpicture type.\n",i); } @@ -2347,7 +2347,7 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) XFree(formatValues); curInfo++; - curCap++; + curCap++; } } XFree(surfaceInfo); @@ -2356,7 +2356,7 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) * Try to create a direct rendering context. This will fail if we are not * on the displaying computer or an indirect context is not available. */ - + curCap = this->xvmc_cap; if (Success == XvMCCreateContext( this->display, xv_port, curCap->type_id, curCap->max_width,curCap->max_height, @@ -2369,7 +2369,7 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) } else { free(this->xvmc_cap); this->xvmc_cap = 0; - xprintf (this->xine, XINE_VERBOSITY_DEBUG, + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xxmc: Apparent attempt to use a direct XvMC " "context\nvideo_out_xxmc: on a remote display. " "Falling back to XV.\n"); @@ -2387,8 +2387,8 @@ static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) return; } - - + + static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) { @@ -2409,7 +2409,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XvAdaptorInfo *adaptor_info; unsigned int adaptor_num; xv_prefertype prefer_type; - cfg_entry_t *entry; + cfg_entry_t *entry; int use_more_frames; int use_unscaled; @@ -2418,7 +2418,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi return NULL; _x_alphablend_init(&this->alphablend_extra_data, class->xine); - + this->display = visual->display; this->screen = visual->screen; this->config = config; @@ -2475,19 +2475,19 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xxmc: 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(this->display); return NULL; - } + } else xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_xxmc: using Xv port %ld from adaptor %s for hardware " "colour space conversion and scaling.\n"), xv_port, adaptor_info[adaptor_num].name); - + XUnlockDisplay(this->display); - + this->xv_port = xv_port; _x_vo_scale_init (&this->sc, 1, 0, config ); @@ -2633,10 +2633,10 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi fo = XvListImageFormats(this->display, this->xv_port, (int*)&formats); XUnlockDisplay (this->display); - + this->xv_format_yv12 = 0; this->xv_format_yuy2 = 0; - + for(i = 0; i < formats; i++) { lprintf ("Xv image format: 0x%x (%4.4s) %s\n", fo[i].id, (char*)&fo[i].id, @@ -2650,7 +2650,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi } 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, + xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_xxmc: this adaptor supports the yuy2 format.\n")); } } @@ -2672,19 +2672,19 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi dispose_ximage (this, &myshminfo, myimage); XUnlockDisplay (this->display); - this->use_pitch_alignment = + this->use_pitch_alignment = config->register_bool (config, "video.device.xv_pitch_alignment", 0, VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP, 10, xxmc_update_xv_pitch_alignment, this); - use_more_frames= + use_more_frames= config->register_bool (config, "video.device.xvmc_more_frames", 0, _("Make XvMC allocate more frames for better buffering."), _("Some XvMC implementations allow more than 8 frames.\n" "This option, when turned on, makes the driver try to\n" "allocate 15 frames. A must for unichrome and live VDR.\n"), 10, NULL, this); - this->cpu_save_enabled = + this->cpu_save_enabled = config->register_bool (config, "video.device.unichrome_cpu_save", 0, _("Unichrome cpu save"), _("Saves CPU time by sleeping while decoder works.\n" @@ -2723,7 +2723,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi #ifdef HAVE_VLDXVMC printf("video_out_xxmc: Unichrome CPU saving is %s.\n", - (this->cpu_save_enabled) ? "on":"off"); + (this->cpu_save_enabled) ? "on":"off"); #else printf("video_out_xxmc: warning - compiled with no vld extensions.\n"); #endif @@ -2752,10 +2752,10 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi } XUnlockDisplay (this->display); } - + if( this->xoverlay ) { this->capabilities |= VO_CAP_UNSCALED_OVERLAY; - } + } return &this->vo_driver; } @@ -2773,7 +2773,7 @@ static char* get_description (video_driver_class_t *this_gen) { static void dispose_class (video_driver_class_t *this_gen) { xxmc_class_t *this = (xxmc_class_t *) this_gen; - + free (this); } @@ -2808,4 +2808,4 @@ const plugin_info_t xine_plugin_info[] EXPORTED = { { PLUGIN_VIDEO_OUT, 21, "xxmc", XINE_VERSION_CODE, &vo_info_xxmc, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; - + diff --git a/src/video_out/vidix/drivers/Makefile.am b/src/video_out/vidix/drivers/Makefile.am index f438dde36..2a90f8591 100644 --- a/src/video_out/vidix/drivers/Makefile.am +++ b/src/video_out/vidix/drivers/Makefile.am @@ -15,7 +15,7 @@ vidix_drivers = \ unichrome_vid.la \ nvidia_vid.la \ sis_vid.la \ - savage_vid.la + savage_vid.la endif vidix_LTLIBRARIES = $(vidix_drivers) diff --git a/src/video_out/x11osd.c b/src/video_out/x11osd.c index 4d0e46287..d6354a6e5 100644 --- a/src/video_out/x11osd.c +++ b/src/video_out/x11osd.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2003 the xine project * * This file is part of xine, a free video player. @@ -96,7 +96,7 @@ x11osd_expose (x11osd * osd) assert (osd); lprintf("expose (state:%d)\n", osd->clean ); - + switch (osd->mode) { case X11OSD_SHAPED: XShapeCombineMask (osd->display, osd->u.shaped.window, ShapeBounding, 0, 0, @@ -106,7 +106,7 @@ x11osd_expose (x11osd * osd) if( !osd->u.shaped.mapped ) XMapRaised (osd->display, osd->u.shaped.window); osd->u.shaped.mapped = 1; - + XCopyArea (osd->display, osd->bitmap, osd->u.shaped.window, osd->gc, 0, 0, osd->width, osd->height, 0, 0); } else { @@ -129,7 +129,7 @@ x11osd_resize (x11osd * osd, int width, int height) assert (osd); assert (width); assert (height); - + lprintf("resize old:%dx%d new:%dx%d\n", osd->width, osd->height, width, height ); osd->width = width; @@ -153,7 +153,7 @@ x11osd_resize (x11osd * osd, int width, int height) osd->width, osd->height, osd->depth); break; } - + osd->clean = UNDEFINED; x11osd_clear(osd); } @@ -165,7 +165,7 @@ x11osd_drawable_changed (x11osd * osd, Window window) XWindowAttributes getattr; assert (osd); - + lprintf("drawable changed\n"); /* @@ -183,14 +183,14 @@ x11osd_drawable_changed (x11osd * osd, Window window) XSync (osd->display, False); osd->window = window; - + XGetWindowAttributes (osd->display, osd->window, &getattr); osd->width = getattr.width; osd->height = getattr.height; - + assert(osd->width); assert(osd->height); - + switch(osd->mode) { case X11OSD_SHAPED: XFreePixmap (osd->display, osd->u.shaped.mask_bitmap); @@ -199,8 +199,8 @@ x11osd_drawable_changed (x11osd * osd, Window window) attr.override_redirect = True; attr.background_pixel = BlackPixel (osd->display, osd->screen); osd->u.shaped.window = XCreateWindow(osd->display, osd->window, - 0, 0, osd->width, osd->height, 0, - CopyFromParent, CopyFromParent, CopyFromParent, + 0, 0, osd->width, osd->height, 0, + CopyFromParent, CopyFromParent, CopyFromParent, CWBackPixel | CWOverrideRedirect, &attr); XSelectInput (osd->display, osd->u.shaped.window, ExposureMask); @@ -212,18 +212,18 @@ x11osd_drawable_changed (x11osd * osd, Window window) osd->bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, osd->height, osd->depth); - osd->cmap = XCreateColormap(osd->display, osd->u.shaped.window, + osd->cmap = XCreateColormap(osd->display, osd->u.shaped.window, osd->visual, AllocNone); break; case X11OSD_COLORKEY: osd->bitmap = XCreatePixmap (osd->display, osd->window, osd->width, osd->height, osd->depth); - osd->cmap = XCreateColormap(osd->display, osd->window, + osd->cmap = XCreateColormap(osd->display, osd->window, osd->visual, AllocNone); break; } - + osd->clean = UNDEFINED; /* do not x11osd_clear() here: osd->u.colorkey.sc has not being updated yet */ } @@ -260,11 +260,11 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x osd->visual = DefaultVisual (osd->display, osd->screen); osd->depth = DefaultDepth (osd->display, osd->screen); - + XGetWindowAttributes (osd->display, osd->window, &getattr); osd->width = getattr.width; osd->height = getattr.height; - + assert(osd->width); assert(osd->height); @@ -278,8 +278,8 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x attr.override_redirect = True; attr.background_pixel = BlackPixel (osd->display, osd->screen); osd->u.shaped.window = XCreateWindow(osd->display, osd->window, - 0, 0, osd->width, osd->height, 0, - CopyFromParent, CopyFromParent, CopyFromParent, + 0, 0, osd->width, osd->height, 0, + CopyFromParent, CopyFromParent, CopyFromParent, CWBackPixel | CWOverrideRedirect, &attr); XSync(osd->display, False); @@ -288,7 +288,7 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x goto error_window; } - osd->u.shaped.mask_bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, + osd->u.shaped.mask_bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, osd->height, 1); XSync(osd->display, False); if( x11_error ) { @@ -296,7 +296,7 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x goto error_aftermaskbitmap; } - osd->bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, + osd->bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, osd->height, osd->depth); osd->gc = XCreateGC (osd->display, osd->u.shaped.window, 0, NULL); @@ -315,14 +315,14 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x XSelectInput (osd->display, osd->u.shaped.window, ExposureMask); osd->u.shaped.mapped = 0; - osd->cmap = XCreateColormap(osd->display, osd->u.shaped.window, + osd->cmap = XCreateColormap(osd->display, osd->u.shaped.window, osd->visual, AllocNone); break; case X11OSD_COLORKEY: - osd->bitmap = XCreatePixmap (osd->display, osd->window, osd->width, + osd->bitmap = XCreatePixmap (osd->display, osd->window, osd->width, osd->height, osd->depth); osd->gc = XCreateGC (osd->display, osd->window, 0, NULL); - osd->cmap = XCreateColormap(osd->display, osd->window, + osd->cmap = XCreateColormap(osd->display, osd->window, osd->visual, AllocNone); /* FIXME: the expose event doesn't seem to happen? */ /*XSelectInput (osd->display, osd->window, ExposureMask);*/ @@ -342,8 +342,8 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x XSetErrorHandler(old_handler); - xprintf(osd->xine, XINE_VERBOSITY_DEBUG, - _("x11osd: unscaled overlay created (%s mode).\n"), + xprintf(osd->xine, XINE_VERBOSITY_DEBUG, + _("x11osd: unscaled overlay created (%s mode).\n"), (mode==X11OSD_SHAPED) ? "XShape" : "Colorkey" ); return osd; @@ -402,9 +402,9 @@ x11osd_destroy (x11osd * osd) void x11osd_clear(x11osd *osd) { int i; - + lprintf("clear (state:%d)\n", osd->clean ); - + if( osd->clean != WIPED ) switch (osd->mode) { case X11OSD_SHAPED: @@ -442,7 +442,7 @@ void x11osd_blend(x11osd *osd, vo_overlay_t *overlay) { if (osd->clean==UNDEFINED) x11osd_clear(osd); /* Workaround. Colorkey mode needs sc data before the clear. */ - + if (overlay->rle) { int i, x, y, len, width; int use_clip_palette, max_palette_colour[2]; @@ -474,7 +474,7 @@ void x11osd_blend(x11osd *osd, vo_overlay_t *overlay) if (x + width - 1 > overlay->hili_right) { width -= overlay->hili_right - x; len += overlay->hili_right - x; - } + } } } @@ -482,7 +482,7 @@ void x11osd_blend(x11osd *osd, vo_overlay_t *overlay) int j; clut_t *src_clut; uint8_t *src_trans; - + if (use_clip_palette) { src_clut = (clut_t *)&overlay->hili_color; src_trans = (uint8_t *)&overlay->hili_trans; @@ -507,7 +507,7 @@ void x11osd_blend(x11osd *osd, vo_overlay_t *overlay) xcolor.green = (65536 * saturate(g, 0, 255)) / 256; b = y + 2 * u - 274; xcolor.blue = (65536 * saturate(b, 0, 255)) / 256; - + xcolor.flags = DoRed | DoBlue | DoGreen; XAllocColor(osd->display, osd->cmap, &xcolor); diff --git a/src/video_out/x11osd.h b/src/video_out/x11osd.h index fe0bf6208..b7726e144 100644 --- a/src/video_out/x11osd.h +++ b/src/video_out/x11osd.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2003 the xine project * * This file is part of xine, a free video player. diff --git a/src/video_out/xcbosd.c b/src/video_out/xcbosd.c index d8cf119a2..ca51664a2 100644 --- a/src/video_out/xcbosd.c +++ b/src/video_out/xcbosd.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2003, 2007 the xine project * * This file is part of xine, a free video player. @@ -93,7 +93,7 @@ void xcbosd_expose(xcbosd *osd) assert (osd); lprintf("expose (state:%d)\n", osd->clean ); - + switch (osd->mode) { case XCBOSD_SHAPED: xcb_shape_mask(osd->connection, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, @@ -106,7 +106,7 @@ void xcbosd_expose(xcbosd *osd) xcb_map_window(osd->connection, osd->u.shaped.window); } osd->u.shaped.mapped = 1; - + xcb_copy_area(osd->connection, osd->bitmap, osd->u.shaped.window, osd->gc, 0, 0, 0, 0, osd->width, osd->height); } else { @@ -128,7 +128,7 @@ void xcbosd_resize(xcbosd *osd, int width, int height) assert (osd); assert (width); assert (height); - + lprintf("resize old:%dx%d new:%dx%d\n", osd->width, osd->height, width, height ); osd->width = width; @@ -151,7 +151,7 @@ void xcbosd_resize(xcbosd *osd, int width, int height) xcb_create_pixmap(osd->connection, osd->depth, osd->bitmap, osd->window, osd->width, osd->height); break; } - + osd->clean = UNDEFINED; xcbosd_clear(osd); } @@ -162,7 +162,7 @@ void xcbosd_drawable_changed(xcbosd *osd, xcb_window_t window) xcb_get_geometry_reply_t *get_geometry_reply; assert (osd); - + lprintf("drawable changed\n"); /* @@ -180,17 +180,17 @@ void xcbosd_drawable_changed(xcbosd *osd, xcb_window_t window) /* XSync (osd->display, False); FIXME don't think that we need that --pfister */ osd->window = window; - + get_geometry_cookie = xcb_get_geometry(osd->connection, osd->window); get_geometry_reply = xcb_get_geometry_reply(osd->connection, get_geometry_cookie, NULL); osd->depth = get_geometry_reply->depth; osd->width = get_geometry_reply->width; osd->height = get_geometry_reply->height; free(get_geometry_reply); - + assert(osd->width); assert(osd->height); - + switch(osd->mode) { case XCBOSD_SHAPED: { xcb_free_pixmap(osd->connection, osd->u.shaped.mask_bitmap); @@ -223,7 +223,7 @@ void xcbosd_drawable_changed(xcbosd *osd, xcb_window_t window) break; } - + osd->clean = UNDEFINED; /* do not xcbosd_clear() here: osd->u.colorkey.sc has not being updated yet */ } @@ -249,14 +249,14 @@ xcbosd *xcbosd_create(xine_t *xine, xcb_connection_t *connection, xcb_screen_t * osd->window = window; osd->visual = osd->screen->root_visual; - + get_geometry_cookie = xcb_get_geometry(osd->connection, osd->window); get_geometry_reply = xcb_get_geometry_reply(osd->connection, get_geometry_cookie, NULL); osd->depth = get_geometry_reply->depth; osd->width = get_geometry_reply->width; osd->height = get_geometry_reply->height; free(get_geometry_reply); - + assert(osd->width); assert(osd->height); @@ -326,8 +326,8 @@ xcbosd *xcbosd_create(xine_t *xine, xcb_connection_t *connection, xcb_screen_t * osd->clean = UNDEFINED; xcbosd_expose(osd); - xprintf(osd->xine, XINE_VERBOSITY_DEBUG, - _("x11osd: unscaled overlay created (%s mode).\n"), + xprintf(osd->xine, XINE_VERBOSITY_DEBUG, + _("x11osd: unscaled overlay created (%s mode).\n"), (mode==XCBOSD_SHAPED) ? "XShape" : "Colorkey" ); return osd; @@ -382,9 +382,9 @@ void xcbosd_destroy(xcbosd *osd) void xcbosd_clear(xcbosd *osd) { int i; - + lprintf("clear (state:%d)\n", osd->clean ); - + if( osd->clean != WIPED ) switch (osd->mode) { case XCBOSD_SHAPED: { @@ -435,7 +435,7 @@ void xcbosd_blend(xcbosd *osd, vo_overlay_t *overlay) if (osd->clean==UNDEFINED) xcbosd_clear(osd); /* Workaround. Colorkey mode needs sc data before the clear. */ - + if (overlay->rle) { int i, x, y, len, width; int use_clip_palette, max_palette_colour[2]; @@ -467,7 +467,7 @@ void xcbosd_blend(xcbosd *osd, vo_overlay_t *overlay) if (x + width - 1 > overlay->hili_right) { width -= overlay->hili_right - x; len += overlay->hili_right - x; - } + } } } @@ -475,7 +475,7 @@ void xcbosd_blend(xcbosd *osd, vo_overlay_t *overlay) int j; clut_t *src_clut; uint8_t *src_trans; - + if (use_clip_palette) { src_clut = (clut_t *)&overlay->hili_color; src_trans = (uint8_t *)&overlay->hili_trans; diff --git a/src/video_out/xcbosd.h b/src/video_out/xcbosd.h index 32af4965e..8b91b1b6e 100644 --- a/src/video_out/xcbosd.h +++ b/src/video_out/xcbosd.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2003, 2007 the xine project * * This file is part of xine, a free video player. diff --git a/src/video_out/xvmc_mocomp.c b/src/video_out/xvmc_mocomp.c index faa2b0010..197037206 100644 --- a/src/video_out/xvmc_mocomp.c +++ b/src/video_out/xvmc_mocomp.c @@ -23,15 +23,15 @@ #include "xxmc.h" -static void calc_DMV(int DMV[][2], int *dmvector, +static void calc_DMV(int DMV[][2], int *dmvector, int mvx, int mvy, int picture_structure, int top_field_first) { - + if (picture_structure==VO_BOTH_FIELDS) { if (top_field_first) { /* vector for prediction of top field from bottom field */ DMV[0][0] = ((mvx +(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((mvy +(mvy>0))>>1) + dmvector[1] - 1; - + /* vector for prediction of bottom field from top field */ DMV[1][0] = ((3*mvx+(mvx>0))>>1) + dmvector[0]; DMV[1][1] = ((3*mvy+(mvy>0))>>1) + dmvector[1] + 1; @@ -40,7 +40,7 @@ static void calc_DMV(int DMV[][2], int *dmvector, /* vector for prediction of top field from bottom field */ DMV[0][0] = ((3*mvx+(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((3*mvy+(mvy>0))>>1) + dmvector[1] - 1; - + /* vector for prediction of bottom field from top field */ DMV[1][0] = ((mvx +(mvx>0))>>1) + dmvector[0]; DMV[1][1] = ((mvy +(mvy>0))>>1) + dmvector[1] + 1; @@ -50,13 +50,13 @@ static void calc_DMV(int DMV[][2], int *dmvector, /* vector for prediction from field of opposite 'parity' */ DMV[0][0] = ((mvx+(mvx>0))>>1) + dmvector[0]; DMV[0][1] = ((mvy+(mvy>0))>>1) + dmvector[1]; - + /* correct for vertical field shift */ if (picture_structure==VO_TOP_FIELD) DMV[0][1]--; else DMV[0][1]++; - + } } @@ -96,12 +96,12 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, -void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, - int (*mv_field_sel)[2], int *dmvector, int cbp, - int dct_type, vo_frame_t *current_frame, - vo_frame_t *forward_ref_frame, - vo_frame_t *backward_ref_frame, int picture_structure, - int second_field, int (*f_mot_pmv)[2], int (*b_mot_pmv)[2]) +void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, + int (*mv_field_sel)[2], int *dmvector, int cbp, + int dct_type, vo_frame_t *current_frame, + vo_frame_t *forward_ref_frame, + vo_frame_t *backward_ref_frame, int picture_structure, + int second_field, int (*f_mot_pmv)[2], int (*b_mot_pmv)[2]) { xxmc_driver_t *this = (xxmc_driver_t *) current_frame->driver; xvmc_macroblocks_t *mbs = &this->macroblocks; @@ -110,10 +110,10 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, mbs->macroblockptr->x = x; mbs->macroblockptr->y = y; - + if(mb_type & XINE_MACROBLOCK_INTRA) { mbs->macroblockptr->macroblock_type = XVMC_MB_TYPE_INTRA; - } + } else { mbs->macroblockptr->macroblock_type = 0; /* XvMC doesn't support skips */ @@ -122,7 +122,7 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, motion_type = (picture_structure == VO_BOTH_FIELDS) ? XINE_MC_FRAME : XINE_MC_FIELD; mbs->macroblockptr->PMV[0][0][0] = 0; mbs->macroblockptr->PMV[0][0][1] = 0; - } + } else { if(mb_type & XINE_MACROBLOCK_MOTION_BACKWARD) { mbs->macroblockptr->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD; @@ -154,17 +154,17 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, calc_DMV(DMV,dmvector, f_mot_pmv[0][0], f_mot_pmv[0][1]>>1, picture_structure, top_field_first); - + mbs->macroblockptr->PMV[1][0][0] = DMV[0][0]; mbs->macroblockptr->PMV[1][0][1] = DMV[0][1]; mbs->macroblockptr->PMV[1][1][0] = DMV[1][0]; mbs->macroblockptr->PMV[1][1][1] = DMV[1][1]; - } + } else { calc_DMV(DMV,dmvector, f_mot_pmv[0][0], f_mot_pmv[0][1]>>1, picture_structure, top_field_first); - + mbs->macroblockptr->PMV[0][1][0] = DMV[0][0]; mbs->macroblockptr->PMV[0][1][1] = DMV[0][1]; } @@ -185,14 +185,14 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, mbs->macroblockptr->index = ((unsigned long)mbs->xine_mc.blockptr - (unsigned long)mbs->xine_mc.blockbaseptr) >> 7; - + mbs->macroblockptr->dct_type = dct_type; mbs->macroblockptr->coded_block_pattern = cbp; cbp &= 0x3F; mbs->macroblockptr->coded_block_pattern = cbp; - while(cbp) { + while(cbp) { if(cbp & 1) mbs->macroblockptr->index--; cbp >>= 1; } @@ -238,9 +238,9 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, xvmc_render_macro_blocks( current_frame, - (picture_coding_type == XINE_PICT_B_TYPE) ? + (picture_coding_type == XINE_PICT_B_TYPE) ? backward_ref_frame : NULL, - (picture_coding_type != XINE_PICT_I_TYPE) ? + (picture_coding_type != XINE_PICT_I_TYPE) ? forward_ref_frame : NULL, picture_structure, second_field ? XVMC_SECOND_FIELD : 0, diff --git a/src/video_out/xvmc_vld.c b/src/video_out/xvmc_vld.c index b81578276..9eb68972f 100644 --- a/src/video_out/xvmc_vld.c +++ b/src/video_out/xvmc_vld.c @@ -39,7 +39,7 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) *ff = (xxmc_frame_t *) vft->forward_reference_frame, *bf = (xxmc_frame_t *) vft->backward_reference_frame; XvMCMpegControl ctl; - xxmc_driver_t + xxmc_driver_t *driver = (xxmc_driver_t *) cf->vo_frame.driver; XvMCSurface *fs=0, *bs=0; XvMCQMatrix qmx; @@ -53,21 +53,21 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) ctl.picture_coding_type = vft->picture_coding_type; ctl.mpeg_coding = (vft->mpeg_coding == 0) ? XVMC_MPEG_1 : XVMC_MPEG_2; ctl.flags = 0; - ctl.flags |= (vft->progressive_sequence) ? + ctl.flags |= (vft->progressive_sequence) ? XVMC_PROGRESSIVE_SEQUENCE : 0 ; - ctl.flags |= (vft->scan) ? + ctl.flags |= (vft->scan) ? XVMC_ALTERNATE_SCAN : XVMC_ZIG_ZAG_SCAN; - ctl.flags |= (vft->pred_dct_frame) ? + ctl.flags |= (vft->pred_dct_frame) ? XVMC_PRED_DCT_FRAME : XVMC_PRED_DCT_FIELD; - ctl.flags |= (this->top_field_first) ? + ctl.flags |= (this->top_field_first) ? XVMC_TOP_FIELD_FIRST : XVMC_BOTTOM_FIELD_FIRST; - ctl.flags |= (vft->concealment_motion_vectors) ? - XVMC_CONCEALMENT_MOTION_VECTORS : 0 ; - ctl.flags |= (vft->q_scale_type) ? + ctl.flags |= (vft->concealment_motion_vectors) ? + XVMC_CONCEALMENT_MOTION_VECTORS : 0 ; + ctl.flags |= (vft->q_scale_type) ? XVMC_Q_SCALE_TYPE : 0; - ctl.flags |= (vft->intra_vlc_format) ? + ctl.flags |= (vft->intra_vlc_format) ? XVMC_INTRA_VLC_FORMAT : 0; - ctl.flags |= (vft->second_field) ? + ctl.flags |= (vft->second_field) ? XVMC_SECOND_FIELD : 0 ; if (ff) fs=ff->xvmc_surf; @@ -79,7 +79,7 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) if (ctl.picture_coding_type == XVMC_P_PICTURE) bs = cf->xvmc_surf; - + if ((qmx.load_intra_quantiser_matrix = vft->load_intra_quantizer_matrix)) { memcpy(qmx.intra_quantiser_matrix,vft->intra_quantizer_matrix, sizeof(qmx.intra_quantiser_matrix)); @@ -87,13 +87,13 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) if ((qmx.load_non_intra_quantiser_matrix = vft->load_non_intra_quantizer_matrix)) { memcpy(qmx.non_intra_quantiser_matrix,vft->non_intra_quantizer_matrix, sizeof(qmx.non_intra_quantiser_matrix)); - } - qmx.load_chroma_intra_quantiser_matrix = 0; + } + qmx.load_chroma_intra_quantiser_matrix = 0; qmx.load_chroma_non_intra_quantiser_matrix = 0; XVMCLOCKDISPLAY( driver->display ); - XvMCLoadQMatrix(driver->display, &driver->context, &qmx); - + XvMCLoadQMatrix(driver->display, &driver->context, &qmx); + while((cf->xxmc_data.result = XvMCBeginSurface(driver->display, &driver->context, cf->xvmc_surf, fs, bs, &ctl))); @@ -101,9 +101,9 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) driver->cpu_saver = 0.; } -void xvmc_vld_slice(vo_frame_t *this_gen) +void xvmc_vld_slice(vo_frame_t *this_gen) { - xxmc_frame_t + xxmc_frame_t *cf = (xxmc_frame_t *) this_gen; xxmc_driver_t *driver = (xxmc_driver_t *) cf->vo_frame.driver; @@ -115,7 +115,7 @@ void xvmc_vld_slice(vo_frame_t *this_gen) /* * If CPU-saving mode is enabled, sleep after every xxmc->sleep slice. This will free * up the cpu while the decoder is working on the slice. The value of xxmc->sleep is calculated - * so that the decoder thread sleeps at most 50% of the frame delay, + * so that the decoder thread sleeps at most 50% of the frame delay, * assuming a 2.6 kernel clock of 1000 Hz. */ @@ -123,7 +123,7 @@ void xvmc_vld_slice(vo_frame_t *this_gen) if (driver->cpu_save_enabled) { driver->cpu_saver += 1.; if (driver->cpu_saver >= cf->xxmc_data.sleep) { - usleep(1); + usleep(1); driver->cpu_saver -= cf->xxmc_data.sleep; } } diff --git a/src/video_out/xxmc.h b/src/video_out/xxmc.h index 03b12c15b..6110978d1 100644 --- a/src/video_out/xxmc.h +++ b/src/video_out/xxmc.h @@ -114,7 +114,7 @@ typedef struct { XvMCMacroBlock *macroblockbaseptr; /* pointer to base MacroBlock in MB array */ XvMCMacroBlockArray macro_blocks; /* pointer to memory for macroblock array */ int slices; -} xvmc_macroblocks_t; +} xvmc_macroblocks_t; typedef struct { @@ -138,7 +138,7 @@ typedef struct { XShmSegmentInfo shminfo; /* XvMC specific stuff */ - + XvMCSurface *xvmc_surf; xine_xxmc_t xxmc_data; int last_sw_format; @@ -155,7 +155,7 @@ typedef struct{ XvImageFormatValues subPicType; int flags; } xvmc_capabilities_t; - + typedef struct xvmc_surface_handler_s { XvMCSurface surfaces[XVMC_MAX_SURFACES]; int surfInUse[XVMC_MAX_SURFACES]; @@ -180,12 +180,12 @@ typedef struct context_lock_s { } #if defined(XVMC_THREAD_SAFE) && defined(XVMC_LOCKDISPLAY_SAFE) -#define XVMCLOCKDISPLAY(display) -#define XVMCUNLOCKDISPLAY(display) +#define XVMCLOCKDISPLAY(display) +#define XVMCUNLOCKDISPLAY(display) #else -#define XVMCLOCKDISPLAY(display) XLockDisplay(display) +#define XVMCLOCKDISPLAY(display) XLockDisplay(display) #define XVMCUNLOCKDISPLAY(display) XUnlockDisplay(display) -#endif +#endif struct xxmc_driver_s { vo_driver_t vo_driver; @@ -227,7 +227,7 @@ struct xxmc_driver_s { int (*x11_old_error_handler) (Display *, XErrorEvent *); xine_t *xine; - /* XvMC related stuff here */ + /* XvMC related stuff here */ xvmc_macroblocks_t macroblocks; xvmc_capabilities_t *xvmc_cap; unsigned xvmc_num_cap; @@ -272,8 +272,8 @@ struct xxmc_driver_s { /* * The mutex below is needed since XlockDisplay wasn't really enough - * to protect the XvMC Calls. - */ + * to protect the XvMC Calls. + */ context_lock_t xvmc_lock; alphablend_t alphablend_extra_data; @@ -293,14 +293,14 @@ extern int xxmc_xvmc_surface_valid(xxmc_driver_t *this, XvMCSurface *surf); extern void xvmc_vld_slice(vo_frame_t *this_gen); extern void xvmc_vld_frame(struct vo_frame_s *this_gen); -extern void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, - int (*mv_field_sel)[2], int *dmvector, - int cbp, - int dct_type, vo_frame_t *current_frame, - vo_frame_t *forward_ref_frame, - vo_frame_t *backward_ref_frame, - int picture_structure, - int second_field, int (*f_mot_pmv)[2], +extern void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, + int (*mv_field_sel)[2], int *dmvector, + int cbp, + int dct_type, vo_frame_t *current_frame, + vo_frame_t *forward_ref_frame, + vo_frame_t *backward_ref_frame, + int picture_structure, + int second_field, int (*f_mot_pmv)[2], int (*b_mot_pmv)[2]); #endif diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c index fb2d63e6c..b237bfafa 100644 --- a/src/video_out/yuv2rgb.c +++ b/src/video_out/yuv2rgb.c @@ -110,15 +110,15 @@ static void yuv2rgb_dispose (yuv2rgb_t *this) free (this); } -static int yuv2rgb_configure (yuv2rgb_t *this, +static int yuv2rgb_configure (yuv2rgb_t *this, int source_width, int source_height, int y_stride, int uv_stride, int dest_width, int dest_height, int rgb_stride) { -/* +/* printf ("yuv2rgb setup (%d x %d => %d x %d)\n", source_width, source_height, dest_width, dest_height); -*/ +*/ if (prof_scale_line == -1) prof_scale_line = xine_profiler_allocate_slot("xshm scale line"); @@ -161,7 +161,7 @@ static int yuv2rgb_configure (yuv2rgb_t *this, /* printf("yuv2rgb config: src_ht=%i, dst_ht=%i\n",source_height, dest_height); printf("yuv2rgb config: step_dy=%i %f\n",this->step_dy, (float)this->step_dy / 32768.0); -*/ +*/ this->scale_line = find_scale_line_func(this->step_dx); if ((source_width == dest_width) && (source_height == dest_height)) { @@ -183,7 +183,7 @@ static int yuv2rgb_configure (yuv2rgb_t *this, } else { this->do_scale = 1; - + /* * space for two y-lines (for yuv2rgb_mlib) * u,v subsampled 2:1 @@ -209,7 +209,7 @@ static int yuv2rgb_configure (yuv2rgb_t *this, if (!this->mlib_resize_buffer) return 0; } -#endif +#endif } return 1; } @@ -257,7 +257,7 @@ static void scale_line_gen (uint8_t *source, uint8_t *dest, p1 = p2; p2 = *source++; } - + dest ++; width --; } @@ -275,7 +275,7 @@ static void scale_line_gen (uint8_t *source, uint8_t *dest, p1 = p2; p2 = *source++; } - + dest ++; width --; } @@ -1242,7 +1242,7 @@ static void scale_line_1_2 (uint8_t *source, uint8_t *dest, xine_profiler_stop_count(prof_scale_line); } - + /* * Scale line with no horizontal scaling. For NTSC mpeg2 dvd input in * 4:3 output format (720x480 -> 720x540) @@ -1255,7 +1255,7 @@ static void scale_line_1_1 (uint8_t *source, uint8_t *dest, xine_profiler_stop_count(prof_scale_line); } - + static scale_line_func_t find_scale_line_func(int step) { static struct { int src_step; @@ -1400,7 +1400,7 @@ static void scale_line_4 (uint8_t *source, uint8_t *dest, dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y]; #define DST1CMAP(i) \ - Y = py_1[2*i]; \ + Y = py_1[2*i]; \ dst_1[2*i] = this->cmap[r[Y] + g[Y] + b[Y]]; \ Y = py_1[2*i+1]; \ dst_1[2*i+1] = this->cmap[r[Y] + g[Y] + b[Y]]; @@ -1428,7 +1428,7 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); dy = 0; @@ -1448,7 +1448,7 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1(1); - + X_RGB(2); DST1(2); @@ -1466,7 +1466,7 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4); + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4); dy += this->step_dy; _dst += this->rgb_stride; @@ -1479,18 +1479,18 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, dy -= 32768; _py += this->y_stride; - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768); @@ -1522,7 +1522,7 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, X_RGB(3); DST2(3); DST1(3); - + pu += 4; pv += 4; py_1 += 8; @@ -1531,7 +1531,7 @@ static void yuv2rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 8; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; @@ -1559,7 +1559,7 @@ static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); dy = 0; @@ -1579,7 +1579,7 @@ static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1RGB(1); - + X_RGB(2); DST1RGB(2); @@ -1597,7 +1597,7 @@ static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, _dst-this->rgb_stride, this->dest_width*3); + xine_fast_memcpy (_dst, _dst-this->rgb_stride, this->dest_width*3); dy += this->step_dy; _dst += this->rgb_stride; @@ -1610,18 +1610,18 @@ static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, dy -= 32768; _py += this->y_stride; - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while (dy>=32768); @@ -1662,11 +1662,11 @@ static void yuv2rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 24; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; - + } while (--height); } } @@ -1690,7 +1690,7 @@ static void yuv2rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); dy = 0; @@ -1710,7 +1710,7 @@ static void yuv2rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1BGR(1); - + X_RGB(2); DST1BGR(2); @@ -1741,18 +1741,18 @@ static void yuv2rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, dy -= 32768; _py += this->y_stride; - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768 ); @@ -1793,7 +1793,7 @@ static void yuv2rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 24; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; @@ -1821,7 +1821,7 @@ static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); dy = 0; @@ -1841,7 +1841,7 @@ static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1(1); - + X_RGB(2); DST1(2); @@ -1859,7 +1859,7 @@ static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); dy += this->step_dy; _dst += this->rgb_stride; @@ -1872,18 +1872,18 @@ static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, dy -= 32768; _py += this->y_stride; - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768); @@ -1923,7 +1923,7 @@ static void yuv2rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 8; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; @@ -1951,7 +1951,7 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); dy = 0; @@ -1971,7 +1971,7 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1(1); - + X_RGB(2); DST1(2); @@ -1989,7 +1989,7 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); dy += this->step_dy; _dst += this->rgb_stride; @@ -2002,18 +2002,18 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, dy -= 32768; _py += this->y_stride; - scale_line (_py, this->y_buffer, + scale_line (_py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768 ); @@ -2045,7 +2045,7 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, X_RGB(3); DST2(3); DST1(3); - + pu += 4; pv += 4; py_1 += 8; @@ -2054,7 +2054,7 @@ static void yuv2rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 8; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; @@ -2084,7 +2084,7 @@ static void yuv2rgb_c_gray (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); dy += this->step_dy; _dst += this->rgb_stride; @@ -2095,7 +2095,7 @@ static void yuv2rgb_c_gray (yuv2rgb_t *this, uint8_t * _dst, _py += this->y_stride*(dy>>15); dy &= 32767; - /* dy -= 32768; + /* dy -= 32768; _py += this->y_stride; */ } @@ -2146,7 +2146,7 @@ static void yuv2rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, X_RGB(1); DST1CMAP(1); - + X_RGB(2); DST1CMAP(2); @@ -2164,7 +2164,7 @@ static void yuv2rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); dy += this->step_dy; _dst += this->rgb_stride; @@ -2183,12 +2183,12 @@ static void yuv2rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, if (height & 1) { _pu += this->uv_stride; _pv += this->uv_stride; - + scale_line (_pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (_pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768 ); @@ -2228,7 +2228,7 @@ static void yuv2rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, dst_2 += 8; } while (--width); - _dst += 2 * this->rgb_stride; + _dst += 2 * this->rgb_stride; _py += 2 * this->y_stride; _pu += this->uv_stride; _pv += this->uv_stride; @@ -2424,7 +2424,7 @@ static void yuv2rgb_set_csc_levels (yuv2rgb_factory_t *this, lprintf ("mode %d not supported by yuv2rgb\n", mode); _x_abort(); } - + for (i = 0; i < 256; i++) { this->table_rV[i] = (((uint8_t *) table_r) + entry_size * div_round (crv * (i-128), 76309)); @@ -2437,7 +2437,7 @@ static void yuv2rgb_set_csc_levels (yuv2rgb_factory_t *this, #if defined(ARCH_X86) || defined(ARCH_X86_64) mmx_yuv2rgb_set_csc_levels (this, brightness, contrast, saturation); -#endif +#endif } static uint32_t yuv2rgb_single_pixel_32 (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v) @@ -2623,10 +2623,10 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) this->dest_width >> 1, this->step_dx); scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); - + dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { dst_1 = (uint32_t*)_dst; py_1 = this->y_buffer; @@ -2642,10 +2642,10 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) X_RGB(1); DST1(1); - + X_RGB(2); DST1(2); - + X_RGB(3); DST1(3); @@ -2654,18 +2654,18 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) py_1 += 8; dst_1 += 8; } while (--width); - + dy += this->step_dy; _dst += this->rgb_stride; - + while (--height > 0 && dy < 32768) { - + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*4); - + dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; @@ -2675,12 +2675,12 @@ static void yuy22rgb_c_32 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) dy -= 32768; _p += this->y_stride*2; */ - + scale_line_4 (_p+1, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line_2 (_p, this->y_buffer, + scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); } } @@ -2700,30 +2700,30 @@ static void yuy22rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line_2 (_p, this->y_buffer, + scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { dst_1 = _dst; py_1 = this->y_buffer; pu = this->u_buffer; pv = this->v_buffer; - + width = this->dest_width >> 3; - + do { X_RGB(0); DST1RGB(0); - + X_RGB(1); DST1RGB(1); - + X_RGB(2); DST1RGB(2); - + X_RGB(3); DST1RGB(3); @@ -2735,15 +2735,15 @@ static void yuy22rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) dy += this->step_dy; _dst += this->rgb_stride; - + while (--height > 0 && dy < 32768) { xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*3); - + dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; @@ -2753,7 +2753,7 @@ static void yuy22rgb_c_24_rgb (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) dy -= 32768; _p += this->y_stride*2; */ - + scale_line_4 (_p+1, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, @@ -2778,50 +2778,50 @@ static void yuy22rgb_c_24_bgr (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line_2 (_p, this->y_buffer, + scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { dst_1 = _dst; py_1 = this->y_buffer; pu = this->u_buffer; pv = this->v_buffer; - + width = this->dest_width >> 3; - + do { X_RGB(0); DST1BGR(0); - + X_RGB(1); DST1BGR(1); - + X_RGB(2); DST1BGR(2); X_RGB(3); DST1BGR(3); - + pu += 4; pv += 4; py_1 += 8; dst_1 += 24; } while (--width); - + dy += this->step_dy; _dst += this->rgb_stride; - + while (--height > 0 && dy < 32768) { xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*3); - + dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; @@ -2852,9 +2852,9 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line_2 (_p, this->y_buffer, + scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); - + dy = 0; height = this->next_slice (this, &_dst); @@ -2863,19 +2863,19 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) py_1 = this->y_buffer; pu = this->u_buffer; pv = this->v_buffer; - + width = this->dest_width >> 3; - + do { X_RGB(0); DST1(0); X_RGB(1); DST1(1); - + X_RGB(2); DST1(2); - + X_RGB(3); DST1(3); @@ -2884,24 +2884,24 @@ static void yuy22rgb_c_16 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) py_1 += 8; dst_1 += 8; } while (--width); - + dy += this->step_dy; _dst += this->rgb_stride; while (--height > 0 && dy < 32768) { - - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); + + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width*2); dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; _p += this->y_stride*(dy>>15); dy &= 32767; - + scale_line_4 (_p+1, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, @@ -2928,28 +2928,28 @@ static void yuy22rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) this->dest_width >> 1, this->step_dx); scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); - + dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { dst_1 = _dst; py_1 = this->y_buffer; pu = this->u_buffer; pv = this->v_buffer; - + width = this->dest_width >> 3; - + do { X_RGB(0); DST1(0); - + X_RGB(1); DST1(1); X_RGB(2); DST1(2); - + X_RGB(3); DST1(3); @@ -2958,29 +2958,29 @@ static void yuy22rgb_c_8 (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) py_1 += 8; dst_1 += 8; } while (--width); - + dy += this->step_dy; _dst += this->rgb_stride; - + while (--height > 0 && dy < 32768) { - - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); - + + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); + dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; _p += this->y_stride*(dy>>15); dy &= 32767; - + scale_line_4 (_p+1, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line_2 (_p, this->y_buffer, + scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); } } @@ -2995,21 +2995,21 @@ static void yuy22rgb_c_gray (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) if (this->do_scale) { dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { scale_line_2 (_p, _dst, this->dest_width, this->step_dx); - + dy += this->step_dy; _dst += this->rgb_stride; - + while (--height > 0 && dy < 32768) { - - xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); - + + xine_fast_memcpy (_dst, (uint8_t*)_dst-this->rgb_stride, this->dest_width); + dy += this->step_dy; _dst += this->rgb_stride; } - + if (height <= 0) break; @@ -3017,7 +3017,7 @@ static void yuy22rgb_c_gray (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) dy &= 32767; } } else { - for (height = this->next_slice (this, &_dst); --height >= 0; ) { + for (height = this->next_slice (this, &_dst); --height >= 0; ) { dst = _dst; y = _p; for (width = this->source_width; --width >= 0; ) { @@ -3038,25 +3038,25 @@ static void yuy22rgb_c_palette (yuv2rgb_t *this, uint8_t * _dst, uint8_t * _p) uint8_t * dst_1; int width, height; int dy; - + scale_line_4 (_p+1, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line_4 (_p+3, this->v_buffer, this->dest_width >> 1, this->step_dx); scale_line_2 (_p, this->y_buffer, this->dest_width, this->step_dx); - + dy = 0; height = this->next_slice (this, &_dst); - + for (;;) { dst_1 = _dst; py_1 = this->y_buffer; pu = this->u_buffer; pv = this->v_buffer; - + width = this->dest_width >> 3; - + do { X_RGB(0); DST1CMAP(0); @@ -3176,7 +3176,7 @@ static yuv2rgb_t *yuv2rgb_create_converter (yuv2rgb_factory_t *factory) { } /* - * factory functions + * factory functions */ static void yuv2rgb_factory_dispose (yuv2rgb_factory_t *this) { @@ -3186,7 +3186,7 @@ static void yuv2rgb_factory_dispose (yuv2rgb_factory_t *this) { free (this); } -yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, +yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, uint8_t *cmap) { yuv2rgb_factory_t *this; diff --git a/src/video_out/yuv2rgb.h b/src/video_out/yuv2rgb.h index dce0ade18..1a1252f40 100644 --- a/src/video_out/yuv2rgb.h +++ b/src/video_out/yuv2rgb.h @@ -114,7 +114,7 @@ struct yuv2rgb_s { void *table_mmx; uint8_t *cmap; - scale_line_func_t scale_line; + scale_line_func_t scale_line; } ; /* @@ -124,7 +124,7 @@ struct yuv2rgb_s { struct yuv2rgb_factory_s { yuv2rgb_t* (*create_converter) (yuv2rgb_factory_t *this); - /* + /* * set color space conversion levels * for all converters produced by this factory */ @@ -160,7 +160,7 @@ struct yuv2rgb_factory_s { yuv2rgb_factory_t *yuv2rgb_factory_init (int mode, int swapped, uint8_t *colormap); - + /* * internal stuff below this line */ diff --git a/src/video_out/yuv2rgb_mlib.c b/src/video_out/yuv2rgb_mlib.c index 22e67efa8..a10503d55 100644 --- a/src/video_out/yuv2rgb_mlib.c +++ b/src/video_out/yuv2rgb_mlib.c @@ -51,7 +51,7 @@ static void mlib_yuv420_rgb24(yuv2rgb_t *this, mlib_s32 resize_stride = this->dest_width << 2; mlib_VideoColorYUV420seq_to_ARGBint((mlib_u32*)this->mlib_buffer, - py, pu, pv, py, 0, + py, pu, pv, py, 0, this->source_width, src_height, this->source_width<<2, @@ -88,7 +88,7 @@ static void mlib_yuv420_argb32(yuv2rgb_t *this, dst_height = this->next_slice(this, &image); if (this->do_scale) { mlib_VideoColorYUV420seq_to_ARGBint((mlib_u32*)this->mlib_buffer, - py, pu, pv, py, 0, + py, pu, pv, py, 0, this->source_width, src_height, this->source_width<<2, @@ -101,7 +101,7 @@ static void mlib_yuv420_argb32(yuv2rgb_t *this, this->mlib_filter_type); } else { mlib_VideoColorYUV420seq_to_ARGBint((mlib_u32*)image, - py, pu, pv, py, 0, + py, pu, pv, py, 0, this->source_width, dst_height, this->rgb_stride, @@ -127,7 +127,7 @@ static void mlib_yuv420_abgr32(yuv2rgb_t *this, dst_height = this->next_slice (this, &image); if (this->do_scale) { mlib_VideoColorYUV420seq_to_ABGRint((mlib_u32*)this->mlib_buffer, - py, pu, pv, py, 0, + py, pu, pv, py, 0, this->source_width, src_height, this->source_width<<2, @@ -141,7 +141,7 @@ static void mlib_yuv420_abgr32(yuv2rgb_t *this, } else { mlib_VideoColorYUV420seq_to_ABGRint((mlib_u32*)image, - py, pu, pv, py, 0, + py, pu, pv, py, 0, this->source_width, dst_height, this->rgb_stride, diff --git a/src/video_out/yuv2rgb_mmx.c b/src/video_out/yuv2rgb_mmx.c index 20a9b5a00..46db48179 100644 --- a/src/video_out/yuv2rgb_mmx.c +++ b/src/video_out/yuv2rgb_mmx.c @@ -175,7 +175,7 @@ static inline void mmx_yuv2rgb (uint8_t * py, uint8_t * pu, uint8_t * pv, mmx_cs pmulhw_m2r (csc->V_green, mm4); // mm4 = v * v_green - + // slot @@ -399,7 +399,7 @@ static inline void mmx_unpack_24rgb (uint8_t * image, int cpu) pand_m2r (mmx_lorgb, mm6); psrlq_i2r (8, mm5); por_r2r(mm6, mm5); /* mm5 = 0x0000R1G1B1R0G0B0 */ - + movq_r2r (mm0, mm6); punpcklbw_r2r (mm2, mm6); punpckhwd_r2r (mm7, mm6); /* mm6 = 0x??R3G3B3??R2G2B2 */ @@ -474,13 +474,13 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this, i = width; img = image; do { mmx_yuv2rgb (py, pu, pv, this->table_mmx); - mmx_unpack_16rgb (img, cpu); + mmx_unpack_16rgb (img, cpu); py += 8; pu += 4; pv += 4; img += 16; } while (--i); - + py += y_stride; image += rgb_stride; if (height & 1) { @@ -502,7 +502,7 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); dst_height = this->next_slice (this, &image); @@ -518,19 +518,19 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this, /* printf ("i : %d\n",i); */ mmx_yuv2rgb (y_buf, u_buf, v_buf, this->table_mmx); - mmx_unpack_16rgb (img, cpu); + mmx_unpack_16rgb (img, cpu); y_buf += 8; u_buf += 4; v_buf += 4; img += 16; } while (--i); - + dy += this->step_dy; image += rgb_stride; while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (image, image-rgb_stride, this->dest_width*2); + xine_fast_memcpy (image, image-rgb_stride, this->dest_width*2); dy += this->step_dy; image += rgb_stride; @@ -544,23 +544,23 @@ static inline void yuv420_rgb16 (yuv2rgb_t *this, py += y_stride; - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { pu += uv_stride; pv += uv_stride; - + scale_line (pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768); } - } + } } static inline void yuv420_rgb15 (yuv2rgb_t *this, @@ -587,13 +587,13 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this, i = width; img = image; do { mmx_yuv2rgb (py, pu, pv, this->table_mmx); - mmx_unpack_15rgb (img, cpu); + mmx_unpack_15rgb (img, cpu); py += 8; pu += 4; pv += 4; img += 16; } while (--i); - + py += y_stride; image += rgb_stride; if (height & 1) { @@ -615,11 +615,11 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); - + dst_height = this->next_slice (this, &image); - + for (height = 0;; ) { y_buf = this->y_buffer; @@ -631,19 +631,19 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this, /* printf ("i : %d\n",i); */ mmx_yuv2rgb (y_buf, u_buf, v_buf, this->table_mmx); - mmx_unpack_15rgb (img, cpu); + mmx_unpack_15rgb (img, cpu); y_buf += 8; u_buf += 4; v_buf += 4; img += 16; } while (--i); - + dy += this->step_dy; image += rgb_stride; while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (image, image-rgb_stride, this->dest_width*2); + xine_fast_memcpy (image, image-rgb_stride, this->dest_width*2); dy += this->step_dy; image += rgb_stride; @@ -656,23 +656,23 @@ static inline void yuv420_rgb15 (yuv2rgb_t *this, dy -= 32768; py += y_stride; - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { pu += uv_stride; pv += uv_stride; - + scale_line (pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - + } height++; } while( dy>=32768 ); } - } + } } static inline void yuv420_rgb24 (yuv2rgb_t *this, @@ -725,7 +725,7 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); dst_height = this->next_slice (this, &image); @@ -742,13 +742,13 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this, /* printf ("i : %d\n",i); */ mmx_yuv2rgb (y_buf, u_buf, v_buf, this->table_mmx); - mmx_unpack_24rgb (img, cpu); + mmx_unpack_24rgb (img, cpu); y_buf += 8; u_buf += 4; v_buf += 4; img += 24; } while (--i); - + dy += this->step_dy; image += rgb_stride; @@ -766,14 +766,14 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this, do { dy -= 32768; py += y_stride; - - scale_line (py, this->y_buffer, + + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { pu += uv_stride; pv += uv_stride; - + scale_line (pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, @@ -783,7 +783,7 @@ static inline void yuv420_rgb24 (yuv2rgb_t *this, } while( dy>=32768 ); } - + } } @@ -837,11 +837,11 @@ static inline void yuv420_argb32 (yuv2rgb_t *this, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); dst_height = this->next_slice (this, &image); - + for (height = 0;; ) { y_buf = this->y_buffer; @@ -854,19 +854,19 @@ static inline void yuv420_argb32 (yuv2rgb_t *this, /* printf ("i : %d\n",i); */ mmx_yuv2rgb (y_buf, u_buf, v_buf, this->table_mmx); - mmx_unpack_32rgb (img, cpu); + mmx_unpack_32rgb (img, cpu); y_buf += 8; u_buf += 4; v_buf += 4; img += 32; } while (--i); - + dy += this->step_dy; image += rgb_stride; while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (image, image-rgb_stride, this->dest_width*4); + xine_fast_memcpy (image, image-rgb_stride, this->dest_width*4); dy += this->step_dy; image += rgb_stride; @@ -878,14 +878,14 @@ static inline void yuv420_argb32 (yuv2rgb_t *this, do { dy -= 32768; py += y_stride; - - scale_line (py, this->y_buffer, + + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { pu += uv_stride; pv += uv_stride; - + scale_line (pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, @@ -894,7 +894,7 @@ static inline void yuv420_argb32 (yuv2rgb_t *this, height++; } while( dy>=32768 ); } - + } } @@ -948,11 +948,11 @@ static inline void yuv420_abgr32 (yuv2rgb_t *this, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, this->dest_width >> 1, this->step_dx); - scale_line (py, this->y_buffer, + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); dst_height = this->next_slice (this, &image); - + for (height = 0;; ) { y_buf = this->y_buffer; @@ -965,19 +965,19 @@ static inline void yuv420_abgr32 (yuv2rgb_t *this, /* printf ("i : %d\n",i); */ mmx_yuv2rgb (y_buf, u_buf, v_buf, this->table_mmx); - mmx_unpack_32bgr (img, cpu); + mmx_unpack_32bgr (img, cpu); y_buf += 8; u_buf += 4; v_buf += 4; img += 32; } while (--i); - + dy += this->step_dy; image += rgb_stride; while (--dst_height > 0 && dy < 32768) { - xine_fast_memcpy (image, image-rgb_stride, this->dest_width*4); + xine_fast_memcpy (image, image-rgb_stride, this->dest_width*4); dy += this->step_dy; image += rgb_stride; @@ -989,14 +989,14 @@ static inline void yuv420_abgr32 (yuv2rgb_t *this, do { dy -= 32768; py += y_stride; - - scale_line (py, this->y_buffer, + + scale_line (py, this->y_buffer, this->dest_width, this->step_dx); if (height & 1) { pu += uv_stride; pv += uv_stride; - + scale_line (pu, this->u_buffer, this->dest_width >> 1, this->step_dx); scale_line (pv, this->v_buffer, @@ -1006,7 +1006,7 @@ static inline void yuv420_abgr32 (yuv2rgb_t *this, } while( dy>=32768 ); } - + } } @@ -1082,7 +1082,7 @@ static void mmx_abgr32 (yuv2rgb_t *this, uint8_t * image, void yuv2rgb_init_mmxext (yuv2rgb_factory_t *this) { - if (this->swapped) + if (this->swapped) return; /*no swapped pixel output upto now*/ switch (this->mode) { @@ -1106,7 +1106,7 @@ void yuv2rgb_init_mmxext (yuv2rgb_factory_t *this) { void yuv2rgb_init_mmx (yuv2rgb_factory_t *this) { - if (this->swapped) + if (this->swapped) return; /*no swapped pixel output upto now*/ switch (this->mode) { |