summaryrefslogtreecommitdiffstats
path: root/libvo/mga_common.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-10 03:37:26 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-03-10 03:37:26 +0000
commit879062aac03ea79f90312f2f24f0cdb408ce5378 (patch)
tree707b57962125d79ea38d412ec6e5c0d9211b2a90 /libvo/mga_common.c
parentbf5be677e2dc6962f07f32798883a384b21fec76 (diff)
downloadmpv-879062aac03ea79f90312f2f24f0cdb408ce5378.tar.bz2
mpv-879062aac03ea79f90312f2f24f0cdb408ce5378.tar.xz
video_eq support - applied brightness/contrast patch by Brian J. Murrell
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5015 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/mga_common.c')
-rw-r--r--libvo/mga_common.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index cbf137374e..e25c331a6d 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -29,6 +29,42 @@ static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned
}
}
+static int mga_set_video_eq( const vidix_video_eq_t *info)
+{
+
+ uint32_t luma;
+ float factor = 256.0 / 2000;
+
+ luma = ((int)(info->brightness * factor) << 16) +
+ ((int)(info->contrast * factor) & 0xFFFF);
+ if (ioctl(f,MGA_VID_SET_LUMA,luma)) {
+ perror("Error in mga_vid_config ioctl()");
+ printf("Could not set luma values in the kernel module!\n");
+ return -1;
+ }
+ return 0;
+
+}
+
+static int mga_get_video_eq( vidix_video_eq_t *info)
+{
+
+ uint32_t luma;
+ float factor = 2000.0 / 256;
+
+ if (ioctl(f,MGA_VID_GET_LUMA,&luma)) {
+ perror("Error in mga_vid_config ioctl()");
+ printf("Could not get luma values from the kernel module!\n");
+ return -1;
+ }
+ info->brightness = (luma >> 16) * factor;
+ info->cap |= VEQ_CAP_BRIGHTNESS;
+
+ info->contrast = (luma & 0xFFFF) * factor;
+ info->cap |= VEQ_CAP_CONTRAST;
+
+ return 0;
+}
//static void
//write_slice_g200(uint8_t *y,uint8_t *cr, uint8_t *cb,uint32_t slice_num)
@@ -230,9 +266,18 @@ query_format(uint32_t format)
return 0;
}
+static void query_vaa(vo_vaa_t *vaa)
+{
+ memset(vaa,0,sizeof(vo_vaa_t));
+ vaa->get_video_eq = mga_get_video_eq;
+ vaa->set_video_eq = mga_set_video_eq;
+}
static uint32_t control(uint32_t request, void *data, ...)
{
switch (request) {
+ case VOCTRL_QUERY_VAA:
+ query_vaa((vo_vaa_t*)data);
+ return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
case VOCTRL_GET_IMAGE: