diff options
Diffstat (limited to 'src/video_out/video_out_xv.c')
-rw-r--r-- | src/video_out/video_out_xv.c | 391 |
1 files changed, 122 insertions, 269 deletions
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index bea6e75e6..1a546d2b5 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -63,12 +63,11 @@ */ #include "xine.h" -#include "video_out.h" -#include "xine_internal.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> /* #include "overlay.h" */ -#include "deinterlace.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xineutils.h> +#include <xine/vo_scale.h> #include "x11osd.h" #include "xv_common.h" @@ -137,10 +136,6 @@ struct xv_driver_s { /* all scaling information goes here */ vo_scale_t sc; - xv_frame_t deinterlace_frame; - int deinterlace_method; - int deinterlace_enabled; - int use_colorkey; uint32_t colorkey; @@ -161,6 +156,9 @@ struct xv_driver_s { void *user_data; + /* color matrix switching */ + int cm_active, cm_state; + Atom cm_atom; }; typedef struct { @@ -170,6 +168,10 @@ typedef struct { xine_t *xine; } xv_class_t; +/* import common color matrix stuff */ +#define CM_DRIVER_T xv_driver_t +#include "color_matrix.c" + static int gX11Fail; VIDEO_DEVICE_XV_DECL_BICUBIC_TYPES; @@ -296,8 +298,9 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, if (image == NULL ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: XvShmCreateImage failed\n" - "video_out_xv: => not using MIT Shared Memory extension.\n")); + _("%s: XvShmCreateImage failed\n"), LOG_MODULE); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("%s: => not using MIT Shared Memory extension.\n"), LOG_MODULE); this->use_shm = 0; goto finishShmTesting; } @@ -322,16 +325,18 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, if (image->data_size==0) { xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: XvShmCreateImage returned a zero size\n" - "video_out_xv: => not using MIT Shared Memory extension.\n")); + _("%s: XvShmCreateImage returned a zero size\n"), LOG_MODULE); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("%s: => not using MIT Shared Memory extension.\n"), LOG_MODULE); this->use_shm = 0; goto finishShmTesting; } if (shminfo->shmid < 0 ) { xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: shared memory error in shmget: %s\n" - "video_out_xv: => not using MIT Shared Memory extension.\n"), strerror(errno)); + _("%s: shared memory error in shmget: %s\n"), LOG_MODULE, strerror(errno)); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("%s: => not using MIT Shared Memory extension.\n"), LOG_MODULE); this->use_shm = 0; goto finishShmTesting; } @@ -340,14 +345,14 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, if (shminfo->shmaddr == NULL) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xv: shared memory error (address error NULL)\n"); + LOG_MODULE ": shared memory error (address error NULL)\n"); this->use_shm = 0; goto finishShmTesting; } if (shminfo->shmaddr == ((char *) -1)) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xv: shared memory error (address error)\n"); + LOG_MODULE ": shared memory error (address error)\n"); this->use_shm = 0; goto finishShmTesting; } @@ -361,12 +366,13 @@ static XvImage *create_ximage (xv_driver_t *this, XShmSegmentInfo *shminfo, shmctl(shminfo->shmid, IPC_RMID, 0); if (gX11Fail) { - xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: x11 error during shared memory XImage creation\n" - "video_out_xv: => not using MIT Shared Memory extension.\n")); shmdt (shminfo->shmaddr); shmctl (shminfo->shmid, IPC_RMID, 0); shminfo->shmid = -1; + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("%s: x11 error during shared memory XImage creation\n"), LOG_MODULE); + xprintf(this->xine, XINE_VERBOSITY_LOG, + _("%s: => not using MIT Shared Memory extension.\n"), LOG_MODULE); this->use_shm = 0; goto finishShmTesting; } @@ -449,7 +455,7 @@ static void xv_update_frame_format (vo_driver_t *this_gen, || (frame->req_height != height) || (frame->format != format)) { - /* printf ("video_out_xv: updating frame to %d x %d (ratio=%d, format=%08x)\n",width,height,ratio_code,format); */ + /* printf (LOG_MODULE ": updating frame to %d x %d (ratio=%d, format=%08x)\n",width,height,ratio_code,format); */ LOCK_DISPLAY(this); @@ -495,120 +501,6 @@ static void xv_update_frame_format (vo_driver_t *this_gen, frame->ratio = ratio; } -#define DEINTERLACE_CROMA -static void xv_deinterlace_frame (xv_driver_t *this) { - uint8_t *recent_bitmaps[VO_NUM_RECENT_FRAMES]; - xv_frame_t *frame = this->recent_frames[0]; - int i; - int xvscaling; - - xvscaling = (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) ? 2 : 1; - - if (!this->deinterlace_frame.image - || (frame->width != this->deinterlace_frame.width) - || (frame->height != this->deinterlace_frame.height ) - || (frame->format != this->deinterlace_frame.format) - || (frame->ratio != this->deinterlace_frame.ratio)) { - LOCK_DISPLAY(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); - this->deinterlace_frame.width = frame->width; - this->deinterlace_frame.height = frame->height; - this->deinterlace_frame.format = frame->format; - this->deinterlace_frame.ratio = frame->ratio; - - UNLOCK_DISPLAY(this); - } - - - if ( this->deinterlace_method != DEINTERLACE_ONEFIELDXV ) { -#ifdef DEINTERLACE_CROMA - - /* I don't think this is the right way to do it (deinterlacing croma by croma info). - DScaler deinterlaces croma together with luma, but it's easier for them because - they have that components 1:1 at the same table. - */ - for( i = 0; i < VO_NUM_RECENT_FRAMES; i++ ) - if( this->recent_frames[i] && this->recent_frames[i]->width == frame->width && - this->recent_frames[i]->height == frame->height ) - recent_bitmaps[i] = this->recent_frames[i]->image->data + this->deinterlace_frame.image->width*frame->height; - else - recent_bitmaps[i] = NULL; - - deinterlace_yuv( this->deinterlace_frame.image->data+this->deinterlace_frame.image->width*frame->height, - recent_bitmaps, this->deinterlace_frame.image->width/2, frame->height/2, this->deinterlace_method ); - for( i = 0; i < VO_NUM_RECENT_FRAMES; i++ ) - if( this->recent_frames[i] && this->recent_frames[i]->width == frame->width && - this->recent_frames[i]->height == frame->height ) - recent_bitmaps[i] = this->recent_frames[i]->image->data + this->deinterlace_frame.image->width*frame->height*5/4; - else - recent_bitmaps[i] = NULL; - - deinterlace_yuv( this->deinterlace_frame.image->data+this->deinterlace_frame.image->width*frame->height*5/4, - recent_bitmaps, this->deinterlace_frame.image->width/2, frame->height/2, this->deinterlace_method ); - -#else - - /* know bug: we are not deinterlacing Cb and Cr */ - xine_fast_memcpy(this->deinterlace_frame.image->data + frame->width*frame->height, - frame->image->data + frame->width*frame->height, - frame->width*frame->height*1/2); - -#endif - - for( i = 0; i < VO_NUM_RECENT_FRAMES; i++ ) - if( this->recent_frames[i] && this->recent_frames[i]->width == frame->width && - this->recent_frames[i]->height == frame->height ) - recent_bitmaps[i] = this->recent_frames[i]->image->data; - else - recent_bitmaps[i] = NULL; - - deinterlace_yuv( this->deinterlace_frame.image->data, recent_bitmaps, - this->deinterlace_frame.image->width, frame->height, this->deinterlace_method ); - } - else { - /* - dirty and cheap deinterlace method: we give half of the lines to xv - driver and let it scale for us. - note that memcpy's below don't seem to impact much on performance, - specially when fast memcpys are available. - */ - uint8_t *dst, *src; - - dst = this->deinterlace_frame.image->data; - src = this->recent_frames[0]->image->data; - for( i = 0; i < frame->height; i+=2 ) { - xine_fast_memcpy(dst,src,frame->width); - dst += frame->width; - src += 2 * frame->width; - } - - dst = this->deinterlace_frame.image->data + frame->width * frame->height / 2; - src = this->recent_frames[0]->image->data + frame->width * frame->height; - for( i = 0; i < frame->height; i+=4 ) { - xine_fast_memcpy(dst,src,frame->width / 2); - dst += frame->width / 2; - src += frame->width; - } - - dst = this->deinterlace_frame.image->data + frame->width * frame->height * 5 / 8; - src = this->recent_frames[0]->image->data + frame->width * frame->height * 5 / 4; - for( i = 0; i < frame->height; i+=4 ) { - xine_fast_memcpy(dst,src,frame->width / 2); - dst += frame->width / 2; - src += frame->width; - } - } - - this->cur_frame = &this->deinterlace_frame; -} - static void xv_clean_output_area (xv_driver_t *this) { int i; @@ -656,14 +548,6 @@ static void xv_compute_ideal_size (xv_driver_t *this) { static void xv_compute_output_size (xv_driver_t *this) { _x_vo_scale_compute_output_size( &this->sc ); - - /* onefield_xv divide by 2 the number of lines */ - if (this->deinterlace_enabled - && (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) - && this->cur_frame && (this->cur_frame->format == XINE_IMGFMT_YV12)) { - this->sc.displayed_height = this->sc.displayed_height / 2 - 1; - this->sc.displayed_yoffset = this->sc.displayed_yoffset / 2; - } } static void xv_overlay_begin (vo_driver_t *this_gen, @@ -792,10 +676,24 @@ static double timeOfDay() static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { xv_driver_t *this = (xv_driver_t *) this_gen; xv_frame_t *frame = (xv_frame_t *) frame_gen; + int cm; /* - printf ("video_out_xv: xv_display_frame...\n"); + printf (LOG_MODULE ": xv_display_frame...\n"); */ + cm = cm_from_frame (frame_gen); + if (cm != this->cm_active) { + this->cm_active = cm; + cm = (0xc00c >> cm) & 1; + if (this->cm_atom != None) { + LOCK_DISPLAY(this); + XvSetPortAttribute (this->display, this->xv_port, this->cm_atom, cm); + UNLOCK_DISPLAY(this); + xprintf (this->xine, XINE_VERBOSITY_LOG, "video_out_xv: color_matrix %s\n", + cm_names[cm ? 2 : 10]); + } + } + /* * queue frames (deinterlacing) * free old frames @@ -821,17 +719,6 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { } /* - * deinterlace frame if necessary - * (currently only working for YUV images) - */ - - if (this->deinterlace_enabled && this->deinterlace_method - && frame->format == XINE_IMGFMT_YV12 - && (deinterlace_yuv_supported( this->deinterlace_method ) == 1 - || this->deinterlace_method == DEINTERLACE_ONEFIELDXV)) - xv_deinterlace_frame (this); - - /* * tell gui that we are about to display a frame, * ask for offset and output size */ @@ -877,7 +764,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { } /* - printf ("video_out_xv: xv_display_frame... done\n"); + printf (LOG_MODULE ": xv_display_frame... done\n"); */ } @@ -907,7 +794,7 @@ static int xv_get_property (vo_driver_t *this_gen, int property) { break; } - lprintf("video_out_xv: property #%d = %d\n", property, this->props[property].value); + lprintf(LOG_MODULE ": property #%d = %d\n", property, this->props[property].value); return this->props[property].value; } @@ -927,6 +814,8 @@ static int xv_set_property (vo_driver_t *this_gen, int property, int value) { xv_driver_t *this = (xv_driver_t *) this_gen; + printf("xv_set_property: property=%d, value=%d\n", property, value ); + if ((property < 0) || (property >= VO_NUM_PROPERTIES)) return 0; if (this->props[property].atom != None) { @@ -951,24 +840,13 @@ static int xv_set_property (vo_driver_t *this_gen, else { switch (property) { - case VO_PROP_INTERLACED: - this->props[property].value = value; - xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: VO_PROP_INTERLACED(%d)\n", this->props[property].value); - this->deinterlace_enabled = value; - if (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) { - xv_compute_ideal_size (this); - 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, - "video_out_xv: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); + LOG_MODULE ": VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); this->sc.user_ratio = value; xv_compute_ideal_size (this); @@ -980,7 +858,7 @@ static int xv_set_property (vo_driver_t *this_gen, if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: VO_PROP_ZOOM_X = %d\n", this->props[property].value); + LOG_MODULE ": VO_PROP_ZOOM_X = %d\n", this->props[property].value); this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; @@ -994,7 +872,7 @@ static int xv_set_property (vo_driver_t *this_gen, if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { this->props[property].value = value; xprintf(this->xine, XINE_VERBOSITY_LOG, - "video_out_xv: VO_PROP_ZOOM_Y = %d\n", this->props[property].value); + LOG_MODULE ": VO_PROP_ZOOM_Y = %d\n", this->props[property].value); this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; @@ -1100,15 +978,6 @@ static int xv_gui_data_exchange (vo_driver_t *this_gen, rect->y = y1; rect->w = x2-x1; rect->h = y2-y1; - - /* onefield_xv divide by 2 the number of lines */ - if (this->deinterlace_enabled - && (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) - && (this->cur_frame->format == XINE_IMGFMT_YV12)) { - rect->y = rect->y * 2; - rect->h = rect->h * 2; - } - } break; @@ -1165,17 +1034,9 @@ 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, - this->deinterlace_frame.image); - UNLOCK_DISPLAY(this); - this->deinterlace_frame.image = NULL; - } - LOCK_DISPLAY(this); if(XvUngrabPort (this->display, this->xv_port, CurrentTime) != Success) { - xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: xv_exit: XvUngrabPort() failed.\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": xv_exit: XvUngrabPort() failed.\n"); } XFreeGC(this->display, this->gc); UNLOCK_DISPLAY(this); @@ -1195,6 +1056,8 @@ static void xv_dispose (vo_driver_t *this_gen) { _x_alphablend_free(&this->alphablend_extra_data); + cm_close (this); + free (this); } @@ -1220,9 +1083,9 @@ static int xv_check_yv12 (Display *display, XvPortID port) { /* called xlocked */ static void xv_check_capability (xv_driver_t *this, int property, XvAttribute attr, int base_id, - char *config_name, - char *config_desc, - char *config_help) { + const char *config_name, + const char *config_desc, + const char *config_help) { int int_default; cfg_entry_t *entry; const char *str_prop = attr.name; @@ -1241,7 +1104,7 @@ static void xv_check_capability (xv_driver_t *this, this->props[property].atom, &int_default); xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_xv: port attribute %s (%d) value is %d\n", str_prop, property, int_default); + LOG_MODULE ": port attribute %s (%d) value is %d\n", str_prop, property, int_default); /* disable autopaint colorkey by default */ /* might be overridden using config entry */ @@ -1286,13 +1149,6 @@ static void xv_check_capability (xv_driver_t *this, } } else this->props[property].value = int_default; - -} - -static void xv_update_deinterlace(void *this_gen, xine_cfg_entry_t *entry) { - xv_driver_t *this = (xv_driver_t *) this_gen; - - this->deinterlace_method = entry->num_value; } static void xv_update_attr (void *this_gen, xine_cfg_entry_t *entry, @@ -1400,6 +1256,8 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * XvAdaptorInfo *adaptor_info; unsigned int adaptor_num; xv_prefertype prefer_type; + unsigned int nencode = 0; + XvEncodingInfo *encodings = NULL; this = (xv_driver_t *) calloc(1, sizeof(xv_driver_t)); if (!this) @@ -1422,7 +1280,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * LOCK_DISPLAY(this); if (Success != XvQueryExtension(this->display, &ver,&rel, &req, &ev,&err)) { - xprintf (class->xine, XINE_VERBOSITY_LOG, _("video_out_xv: Xv extension not present.\n")); + xprintf (class->xine, XINE_VERBOSITY_LOG, _("%s: Xv extension not present.\n"), LOG_MODULE); UNLOCK_DISPLAY(this); return NULL; } @@ -1432,7 +1290,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * */ if (Success != XvQueryAdaptors(this->display,DefaultRootWindow(this->display), &adaptors, &adaptor_info)) { - xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: XvQueryAdaptors failed.\n"); + xprintf(class->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": XvQueryAdaptors failed.\n"); UNLOCK_DISPLAY(this); return NULL; } @@ -1466,8 +1324,9 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * if (!xv_port) { 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")); + _("%s: Xv extension is present but I couldn't find a usable yuv12 port.\n" + "\tLooks like your graphics hardware driver doesn't support Xv?!\n"), + LOG_MODULE); /* XvFreeAdaptorInfo (adaptor_info); this crashed on me (gb)*/ UNLOCK_DISPLAY(this); @@ -1475,8 +1334,8 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * } 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, + _("%s: using Xv port %ld from adaptor %s for hardware " + "colour space conversion and scaling.\n"), LOG_MODULE, xv_port, adaptor_info[adaptor_num].name); UNLOCK_DISPLAY(this); @@ -1491,10 +1350,8 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * LOCK_DISPLAY(this); this->gc = XCreateGC (this->display, this->drawable, 0, NULL); UNLOCK_DISPLAY(this); - this->capabilities = VO_CAP_CROP; + this->capabilities = VO_CAP_CROP | VO_CAP_ZOOM_X | VO_CAP_ZOOM_Y; this->use_shm = 1; - this->deinterlace_method = 0; - this->deinterlace_frame.image = NULL; this->use_colorkey = 0; this->colorkey = 0; this->xoverlay = NULL; @@ -1502,6 +1359,8 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * this->x11_old_error_handler = NULL; this->xine = class->xine; + this->cm_atom = None; + LOCK_DISPLAY(this); XAllocNamedColor (this->display, DefaultColormap(this->display, this->screen), @@ -1535,12 +1394,13 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * this->props[i].this = this; } - this->props[VO_PROP_INTERLACED].value = 0; this->sc.user_ratio = this->props[VO_PROP_ASPECT_RATIO].value = XINE_VO_ASPECT_AUTO; this->props[VO_PROP_ZOOM_X].value = 100; this->props[VO_PROP_ZOOM_Y].value = 100; + cm_init (this); + /* * check this adaptor's capabilities */ @@ -1559,34 +1419,50 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * 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"); + xprintf (this->xine, XINE_VERBOSITY_NONE, LOG_MODULE ": ignoring broken XV_HUE settings on NVidia cards\n"); } else { + this->capabilities |= VO_CAP_HUE; xv_check_capability (this, VO_PROP_HUE, attr[k], adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); } } else if(!strcmp(name, "XV_SATURATION")) { + this->capabilities |= VO_CAP_SATURATION; xv_check_capability (this, VO_PROP_SATURATION, attr[k], adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); } else if(!strcmp(name, "XV_BRIGHTNESS")) { + this->capabilities |= VO_CAP_BRIGHTNESS; xv_check_capability (this, VO_PROP_BRIGHTNESS, attr[k], adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); } else if(!strcmp(name, "XV_CONTRAST")) { + this->capabilities |= VO_CAP_CONTRAST; xv_check_capability (this, VO_PROP_CONTRAST, attr[k], adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); } else if(!strcmp(name, "XV_GAMMA")) { + this->capabilities |= VO_CAP_GAMMA; xv_check_capability (this, VO_PROP_GAMMA, attr[k], adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); + } else if(!strcmp(name, "XV_ITURBT_709")) { + LOCK_DISPLAY(this); + this->cm_atom = XInternAtom (this->display, name, False); + if (this->cm_atom != None) { + XvGetPortAttribute (this->display, this->xv_port, this->cm_atom, &this->cm_active); + this->cm_active = this->cm_active ? 2 : 10; + this->capabilities |= VO_CAP_COLOR_MATRIX; + } + UNLOCK_DISPLAY(this); } else if(!strcmp(name, "XV_COLORKEY")) { + this->capabilities |= VO_CAP_COLORKEY; xv_check_capability (this, VO_PROP_COLORKEY, attr[k], adaptor_info[adaptor_num].base_id, "video.device.xv_colorkey", VIDEO_DEVICE_XV_COLORKEY_HELP); } else if(!strcmp(name, "XV_AUTOPAINT_COLORKEY")) { + this->capabilities |= VO_CAP_AUTOPAINT_COLORKEY; xv_check_capability (this, VO_PROP_AUTOPAINT_COLORKEY, attr[k], adaptor_info[adaptor_num].base_id, "video.device.xv_autopaint_colorkey", @@ -1630,7 +1506,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * XFree(attr); } else - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_xv: no port attributes defined.\n"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": no port attributes defined.\n"); XvFreeAdaptorInfo(adaptor_info); /* @@ -1648,16 +1524,21 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * fo[i].id, (char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar"); - if (fo[i].id == XINE_IMGFMT_YV12) { + switch (fo[i].id) { + case XINE_IMGFMT_YV12: this->xv_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: this adaptor supports the yv12 format.\n")); - } else if (fo[i].id == XINE_IMGFMT_YUY2) { + _("%s: this adaptor supports the %s format.\n"), LOG_MODULE, "YV12"); + break; + case XINE_IMGFMT_YUY2: this->xv_format_yuy2 = fo[i].id; this->capabilities |= VO_CAP_YUY2; xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_xv: this adaptor supports the yuy2 format.\n")); + _("%s: this adaptor supports the %s format.\n"), LOG_MODULE, "YUY2"); + break; + default: + break; } } @@ -1668,6 +1549,26 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * } /* + * check max. supported image size + */ + + XvQueryEncodings(this->display, xv_port, &nencode, &encodings); + if (encodings) { + int n; + for (n = 0; n < nencode; n++) { + if (!strcmp(encodings[n].name, "XV_IMAGE")) { + xprintf(this->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": max XvImage size %li x %li\n", + encodings[n].width, encodings[n].height); + this->props[VO_PROP_MAX_VIDEO_WIDTH].value = encodings[n].width; + this->props[VO_PROP_MAX_VIDEO_HEIGHT].value = encodings[n].height; + break; + } + } + XvFreeEncodingInfo(encodings); + } + + /* * try to create a shared image * to find out if MIT shm really works, using supported format */ @@ -1682,39 +1583,6 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP, 10, xv_update_xv_pitch_alignment, this); - this->deinterlace_method = - config->register_enum (config, "video.output.xv_deinterlace_method", 4, - deinterlace_methods, - _("deinterlace method (deprecated)"), - _("This config setting is deprecated. You should use the new deinterlacing " - "post processing settings instead.\n\n" - "From the old days of analog television, where the even and odd numbered " - "lines of a video frame would be displayed at different times comes the " - "idea to increase motion smoothness by also recording the lines at " - "different times. This is called \"interlacing\". But unfortunately, " - "todays displays show the even and odd numbered lines as one complete frame " - "all at the same time (called \"progressive display\"), which results in " - "ugly frame errors known as comb artifacts. Software deinterlacing is an " - "approach to reduce these artifacts. The individual values are:\n\n" - "none\n" - "Disables software deinterlacing.\n\n" - "bob\n" - "Interpolates between the lines for moving parts of the image.\n\n" - "weave\n" - "Similar to bob, but with a tendency to preserve the full resolution, " - "better for high detail in low movement scenes.\n\n" - "greedy\n" - "Very good adaptive deinterlacer, but needs a lot of CPU power.\n\n" - "onefield\n" - "Always interpolates and reduces vertical resolution.\n\n" - "onefieldxv\n" - "Same as onefield, but does the interpolation in hardware.\n\n" - "linearblend\n" - "Applies a slight vertical blur to remove the comb artifacts. Good results " - "with medium CPU usage."), - 10, xv_update_deinterlace, this); - this->deinterlace_enabled = 0; - LOCK_DISPLAY(this); if(this->use_colorkey==1) { this->xoverlay = x11osd_create (this->xine, this->display, this->screen, @@ -1753,28 +1621,13 @@ static vo_driver_t *open_plugin_old (video_driver_class_t *class_gen, const void /* * class functions */ - -static char* get_identifier (video_driver_class_t *this_gen) { - return "Xv"; -} - -static char* get_description (video_driver_class_t *this_gen) { - return _("xine video output plugin using the MIT X video extension"); -} - -static void dispose_class (video_driver_class_t *this_gen) { - xv_class_t *this = (xv_class_t *) this_gen; - - free (this); -} - static void *init_class (xine_t *xine, void *visual_gen) { xv_class_t *this = (xv_class_t *) calloc(1, sizeof(xv_class_t)); this->driver_class.open_plugin = open_plugin_old; - this->driver_class.get_identifier = get_identifier; - this->driver_class.get_description = get_description; - this->driver_class.dispose = dispose_class; + this->driver_class.identifier = "Xv"; + this->driver_class.description = N_("xine video output plugin using the MIT X video extension"); + this->driver_class.dispose = default_video_driver_class_dispose; this->config = xine->config; this->xine = xine; @@ -1806,7 +1659,7 @@ static const vo_info_t vo_info_xv_2 = { const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 21, "xv", XINE_VERSION_CODE, &vo_info_xv, init_class }, - { PLUGIN_VIDEO_OUT, 21, "xv", XINE_VERSION_CODE, &vo_info_xv_2, init_class_2 }, + { PLUGIN_VIDEO_OUT, 22, "xv", XINE_VERSION_CODE, &vo_info_xv, init_class }, + { PLUGIN_VIDEO_OUT, 22, "xv", XINE_VERSION_CODE, &vo_info_xv_2, init_class_2 }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; |