[Mplayer-cvslog] CVS: main/libvo vo_xv.c,1.109,1.110 vo_xvidix.c,1.47,1.48 vosub_vidix.c,1.49,1.50
Alex Beregszaszi
alex at mplayerhq.hu
Thu Jul 25 15:09:24 CEST 2002
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var/tmp.root/cvs-serv28170
Modified Files:
vo_xv.c vo_xvidix.c vosub_vidix.c
Log Message:
eq reworked
Index: vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- vo_xv.c 24 Jul 2002 18:19:39 -0000 1.109
+++ vo_xv.c 25 Jul 2002 13:09:16 -0000 1.110
@@ -144,8 +144,8 @@
mp_dbg(MSGT_VO, MSGL_V, "xv_set_eq called! (%s, %d, %d)\n", name, value, use_reset);
- /* get available attributes */
- attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany);
+ /* get available attributes */
+ attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany);
/* first pass try reset */
if(use_reset)
{
@@ -226,6 +226,85 @@
return(VO_FALSE);
}
+static int xv_get_eq(char *name, int *value)
+{
+ XvAttribute *attributes;
+ int howmany, xv_min, xv_max, xv_atom;
+ static int was_reset = 0;
+
+ *value = 0;
+
+ /* get available attributes */
+ attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany);
+ for (i = 0; i < howmany && attributes; i++)
+ {
+ if (attributes[i].flags & XvGettable)
+ {
+ xv_min = attributes[i].min_value;
+ xv_max = attributes[i].max_value;
+ xv_atom = XInternAtom(mDisplay, attributes[i].name, True);
+/* since we have SET_DEFAULTS first in our list, we can check if it's available
+ then trigger it if it's ok so that the other values are at default upon query */
+ if (xv_atom != None)
+ {
+ int val, port_value, port_min, port_max, port_mid;
+
+ XvGetPortAttribute(mDisplay, xv_port, xv_atom, &port_value);
+
+ port_min = xv_min;
+ port_max = xv_max;
+ port_mid = (port_min + port_max) / 2;
+
+ val = ((port_value - port_mid)*2000)/(port_max-port_min);
+
+ if(!strcmp(attributes[i].name,"XV_BRIGHTNESS") &&
+ (!strcasecmp(name, "brightness")))
+ *value = val;
+ else
+ if(!strcmp(attributes[i].name,"XV_CONTRAST") &&
+ (!strcasecmp(name, "contrast")))
+ *value = val;
+ else
+ if(!strcmp(attributes[i].name,"XV_SATURATION") &&
+ (!strcasecmp(name, "saturation")))
+ *value = val;
+ else
+ if(!strcmp(attributes[i].name,"XV_HUE") &&
+ (!strcasecmp(name, "hue")))
+ /* nasty nvidia detect */
+ {
+ if (port_min == 0 && port_max == 360)
+ {
+ if (port_value > port_mid-1)
+ val = (port_value - port_max + 1) * 1000 / port_mid;
+ else
+ val = port_value * 1000 / port_mid;
+ }
+ *value = val;
+ }
+ else
+ /* Note: since 22.01.2002 GATOS supports these attrs for radeons (NK) */
+ if(!strcmp(attributes[i].name,"XV_RED_INTENSITY") &&
+ (!strcasecmp(name, "red_intensity")))
+ *value = val;
+ else
+ if(!strcmp(attributes[i].name,"XV_GREEN_INTENSITY") &&
+ (!strcasecmp(name, "green_intensity")))
+ *value = val;
+ else
+ if(!strcmp(attributes[i].name,"XV_BLUE_INTENSITY") &&
+ (!strcasecmp(name, "blue_intensity")))
+ *value = val;
+ else continue;
+
+ mp_dbg(MSGT_VO, MSGL_V, "xv_get_eq called! (%s, %d)\n", name, *value);
+ return(VO_TRUE);
+ }
+ }
+ }
+ return(VO_FALSE);
+}
+
/*
* connect to server, create and map window,
* allocate colors and (shared) memory
@@ -828,6 +907,17 @@
va_end(ap);
return(xv_set_eq(data, value, 0));
+ }
+ case VOCTRL_GET_EQUALIZER:
+ {
+ va_list ap;
+ int *value;
+
+ va_start(ap, data);
+ value = va_arg(ap, int);
+ va_end(ap);
+
+ return(xv_get_eq(data, value));
}
}
return VO_NOTIMPL;
Index: vo_xvidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xvidix.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- vo_xvidix.c 19 Jul 2002 20:51:47 -0000 1.47
+++ vo_xvidix.c 25 Jul 2002 13:09:16 -0000 1.48
@@ -174,13 +174,6 @@
mp_msg(MSGT_VO, MSGL_V, "[xvidix] window properties: pos: %dx%d, size: %dx%d\n",
vo_dx, vo_dy, window_width, window_height);
-
- { // á.c.s. technologies (C) Pontscho
- vidix_video_eq_t eq;
- vo_vaa_t vo_vaa;
- if ( vidix_control( VOCTRL_QUERY_VAA,&vo_vaa) != VO_NOTIMPL )
- if ( vo_vaa.get_video_eq && vo_vaa.get_video_eq( &eq ) == 0 ) set_video_eq( eq.cap );
- }
/* mDrawColorKey: */
@@ -455,6 +448,28 @@
set_window( 0,&vtune );
}
return VO_TRUE;
+ case VOCTRL_SET_EQUALIZER:
+ {
+ va_list ap;
+ int value;
+
+ va_start(ap, data);
+ value = va_arg(ap, int);
+ va_end(ap);
+
+ return vidix_control(request, data, (int *)value);
+ }
+ case VOCTRL_GET_EQUALIZER:
+ {
+ va_list ap;
+ int *value;
+
+ va_start(ap, data);
+ value = va_arg(ap, int);
+ va_end(ap);
+
+ return vidix_control(request, data, value);
+ }
}
return vidix_control(request, data);
// return VO_NOTIMPL;
Index: vosub_vidix.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vosub_vidix.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- vosub_vidix.c 19 Jul 2002 20:51:47 -0000 1.49
+++ vosub_vidix.c 25 Jul 2002 13:09:16 -0000 1.50
@@ -59,20 +59,6 @@
static int vidix_set_oem_fx(const vidix_oem_fx_t *info);
static int vidix_set_deint(const vidix_deinterlace_t *info);
-static void vidix_query_vaa(vo_vaa_t *vaa)
-{
- memset(vaa,0,sizeof(vo_vaa_t));
- vaa->query_bes_da=vidix_get_bes_da;
- vaa->get_video_eq=vidix_get_video_eq;
- vaa->set_video_eq=vidix_set_video_eq;
- vaa->get_num_fx=vidix_get_num_fx;
- vaa->get_oem_fx=vidix_get_oem_fx;
- vaa->set_oem_fx=vidix_set_oem_fx;
- vaa->set_deint=vidix_set_deint;
-}
-
-static vidix_video_eq_t vid_eq;
-
int vidix_start(void)
{
int err;
@@ -82,39 +68,6 @@
return -1;
}
video_on=1;
- if (vidix_cap.flags & FLAG_EQUALIZER)
- {
- if(verbose > 1)
- {
- printf("vosub_vidix: vo_gamma_brightness=%i\n"
- "vosub_vidix: vo_gamma_saturation=%i\n"
- "vosub_vidix: vo_gamma_contrast=%i\n"
- "vosub_vidix: vo_gamma_hue=%i\n"
- "vosub_vidix: vo_gamma_red_intensity=%i\n"
- "vosub_vidix: vo_gamma_green_intensity=%i\n"
- "vosub_vidix: vo_gamma_blue_intensity=%i\n"
- ,vo_gamma_brightness
- ,vo_gamma_saturation
- ,vo_gamma_contrast
- ,vo_gamma_hue
- ,vo_gamma_red_intensity
- ,vo_gamma_green_intensity
- ,vo_gamma_blue_intensity);
- }
- /* To use full set of vid_eq.cap */
- if(vidix_get_video_eq(&vid_eq) == 0)
- {
- vid_eq.brightness = vo_gamma_brightness;
- vid_eq.saturation = vo_gamma_saturation;
- vid_eq.contrast = vo_gamma_contrast;
- vid_eq.hue = vo_gamma_hue;
- vid_eq.red_intensity = vo_gamma_red_intensity;
- vid_eq.green_intensity = vo_gamma_green_intensity;
- vid_eq.blue_intensity = vo_gamma_blue_intensity;
- vid_eq.flags = VEQ_FLG_ITU_R_BT_601;
- vidix_set_video_eq(&vid_eq);
- }
- }
return 0;
}
@@ -138,15 +91,6 @@
// ((vo_functions_t *)vo_server)->control=server_control;
}
-static uint32_t vidix_draw_slice_swYV12(uint8_t *image[], int stride[], int w,int h,int x,int y)
-{
- uint8_t *dest;
- dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y;
- dest += dstrides.y*y + x;
- yv12toyuy2(image[0], image[1], image[2], dest, w, h, stride[0], stride[1],dstrides.y);
- return 0;
-}
-
static uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y)
{
uint8_t *src;
@@ -363,17 +307,6 @@
}
}
-static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)
-{
- UNUSED(x0);
- UNUSED(y0);
- UNUSED(w);
- UNUSED(h);
- UNUSED(src);
- UNUSED(srca);
- UNUSED(stride);
-}
-
static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)
{
uint32_t apitch,bespitch;
@@ -420,7 +353,7 @@
vo_draw_alpha_rgb15(w,h,src,srca,stride,lvo_mem+y0*bespitch+2*x0,bespitch);
break;
default:
- draw_alpha_null(x0,y0,w,h,src,srca,stride);
+ return;
}
}
@@ -437,22 +370,7 @@
vidix_fourcc.fourcc = format;
vdlQueryFourcc(vidix_handler,&vidix_fourcc);
if (vidix_fourcc.depth == VID_DEPTH_NONE)
- {
- if(format == IMGFMT_YV12)
- {
- vidix_fourcc.fourcc = IMGFMT_YUY2;
- vdlQueryFourcc(vidix_handler,&vidix_fourcc);
- if (vidix_fourcc.depth == VID_DEPTH_NONE) return 0;
- else
- {
- vo_server->draw_slice = vidix_draw_slice_swYV12;
- forced_fourcc=IMGFMT_YUY2;
- printf("vosub_vidix: WARNING!!! Using YV12 to YUY2 SW convertion\n");
- return VFCAP_CSP_SUPPORTED|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN;
- }
- }
return 0;
- }
return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_HWSCALE_UP|VFCAP_HWSCALE_DOWN|VFCAP_OSD;
}
@@ -753,9 +671,6 @@
uint32_t vidix_control(uint32_t request, void *data, ...)
{
switch (request) {
- case VOCTRL_QUERY_VAA:
- vidix_query_vaa((vo_vaa_t*)data);
- return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
return vidix_query_fourcc(*((uint32_t*)data));
case VOCTRL_GET_IMAGE:
@@ -769,6 +684,81 @@
case VOCTRL_GET_NUM_FRAMES:
*(uint32_t *)data = vidix_play.num_frames;
return VO_TRUE;
+ case VOCTRL_SET_EQUALIZER:
+ {
+ va_list ap;
+ int value;
+ vidix_video_eq_t info;
+
+ if(!video_on) return VO_FALSE;
+ va_start(ap, data);
+ value = va_arg(ap, int);
+ va_end(ap);
+
+ /* vidix eq ranges are -1000..1000 */
+ if (!strcasecmp(data, "brightness"))
+ {
+ info.brightness = value*10;
+ info.cap |= VEQ_CAP_BRIGHTNESS;
+ }
+ else if (!strcasecmp(data, "contrast"))
+ {
+ info.contrast = value*10;
+ info.cap |= VEQ_CAP_CONTRAST;
+ }
+ else if (!strcasecmp(data, "saturation"))
+ {
+ info.saturation = value*10;
+ info.cap |= VEQ_CAP_SATURATION;
+ }
+ else if (!strcasecmp(data, "hue"))
+ {
+ info.hue = value*10;
+ info.cap |= VEQ_CAP_HUE;
+ }
+
+ if (vdlPlaybackSetEq(vidix_handler, &info) == 0)
+ return VO_TRUE;
+ return VO_FALSE;
+ }
+ case VOCTRL_GET_EQUALIZER:
+ {
+ va_list ap;
+ int *value;
+ vidix_video_eq_t info;
+
+ if(!video_on) return VO_FALSE;
+ if (vdlPlaybackSetEq(vidix_handler, &info) != 0)
+ return VO_FALSE;
+
+ va_start(ap, data);
+ value = va_arg(ap, int);
+ va_end(ap);
+
+ /* vidix eq ranges are -1000..1000 */
+ if (!strcasecmp(data, "brightness"))
+ {
+ if (info.cap & VEQ_CAP_BRIGHTNESS)
+ *value = info.brightness/10;
+ }
+ else if (!strcasecmp(data, "contrast"))
+ {
+ if (info.cap & VEQ_CAP_CONTRAST)
+ *value = info.contrast/10;
+ }
+ else if (!strcasecmp(data, "saturation"))
+ {
+ if (info.cap & VEQ_CAP_SATURATION)
+ *value = info.saturation/10;
+ }
+ else if (!strcasecmp(data, "hue"))
+ {
+ if (info.cap & VEQ_CAP_HUE)
+ *value = info.hue/10;
+ }
+
+ return VO_TRUE;
+ }
}
return VO_NOTIMPL;
// WARNING: we drop extra parameters (...) here!
@@ -798,7 +788,8 @@
printf("vosub_vidix: Couldn't get capability: %s\n",strerror(err));
return -1;
}
- printf("vosub_vidix: Using: %s by %s\n",vidix_cap.name,vidix_cap.author);
+ printf("VIDIX: Description: %s\n", vidix_cap.name);
+ printf("VIDIX: Author: %s\n", vidix_cap.author);
/* we are able to tune up this stuff depend on fourcc format */
((vo_functions_t *)server)->draw_slice=vidix_draw_slice;
((vo_functions_t *)server)->draw_frame=vidix_draw_frame;
More information about the MPlayer-cvslog
mailing list