summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-07-25 13:12:23 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-07-25 13:12:23 +0000
commit6ee4bfccdb8da2c775a411a6279ef5def3c2f72d (patch)
tree7e41596952b1c8a95d5a36d809123248c075ab22 /libvo
parentac55131625d48bccf150efb6af7d1b7049a5818c (diff)
downloadmpv-6ee4bfccdb8da2c775a411a6279ef5def3c2f72d.tar.bz2
mpv-6ee4bfccdb8da2c775a411a6279ef5def3c2f72d.tar.xz
eq reworked
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6787 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_xv.c94
-rw-r--r--libvo/vo_xvidix.c29
-rw-r--r--libvo/vosub_vidix.c165
3 files changed, 192 insertions, 96 deletions
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 0683e37074..2de8412789 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -144,8 +144,8 @@ static int xv_set_eq(char *name, int value, int use_reset)
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 @@ static int xv_set_eq(char *name, int value, int use_reset)
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
@@ -829,6 +908,17 @@ static uint32_t control(uint32_t request, void *data, ...)
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;
}
diff --git a/libvo/vo_xvidix.c b/libvo/vo_xvidix.c
index 0127a78a76..89a2a3deff 100644
--- a/libvo/vo_xvidix.c
+++ b/libvo/vo_xvidix.c
@@ -174,13 +174,6 @@ static void set_window(int force_update,const vo_tune_info_t *info)
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 @@ static uint32_t control(uint32_t request, void *data, ...)
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;
diff --git a/libvo/vosub_vidix.c b/libvo/vosub_vidix.c
index 7b3f30a224..efbdff9788 100644
--- a/libvo/vosub_vidix.c
+++ b/libvo/vosub_vidix.c
@@ -59,20 +59,6 @@ static int vidix_get_oem_fx(vidix_oem_fx_t *info);
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 @@ int vidix_start(void)
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 @@ void vidix_term( void )
// ((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 @@ void vidix_flip_page(void)
}
}
-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 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned
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 @@ uint32_t vidix_query_fourcc(uint32_t format)
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 @@ static uint32_t vidix_get_image(mp_image_t *mpi)
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 @@ uint32_t vidix_control(uint32_t request, void *data, ...)
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 @@ int vidix_preinit(const char *drvname,void *server)
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;