summaryrefslogtreecommitdiffstats
path: root/libvo/mga_common.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-03-08 01:06:03 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-03-08 01:06:03 +0000
commit838cf97bcb165bff85a3b0f69e4bf416ecc415cf (patch)
treea9a82e31f4ab18cf35df42a5391592d54cd2d823 /libvo/mga_common.c
parent376833ee20e3426caee972e69bcf922486f4aaf8 (diff)
downloadmpv-838cf97bcb165bff85a3b0f69e4bf416ecc415cf.tar.bz2
mpv-838cf97bcb165bff85a3b0f69e4bf416ecc415cf.tar.xz
mga_vid fixes, code cleanup
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@57 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/mga_common.c')
-rw-r--r--libvo/mga_common.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index 96eb765c6a..4fc5084d60 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -1,7 +1,12 @@
// mga_vid drawing functions
-extern int mga_next_frame;
+static int mga_next_frame=0;
+
+static mga_vid_config_t mga_vid_config;
+static uint8_t *vid_data, *frames[4];
+static int f;
+
static void
write_frame_g200(uint8_t *y,uint8_t *cr, uint8_t *cb)
@@ -161,7 +166,7 @@ vo_mga_flip_page(void)
#if 1
ioctl(f,MGA_VID_FSEL,&mga_next_frame);
- mga_next_frame=(mga_next_frame+1)&3;
+ mga_next_frame=(mga_next_frame+1)%mga_vid_config.num_frames;
vid_data=frames[mga_next_frame];
#endif
@@ -218,3 +223,29 @@ query_format(uint32_t format)
return 0;
}
+static int mga_init(){
+ char *frame_mem;
+
+ mga_vid_config.num_frames=4;
+ mga_vid_config.version=MGA_VID_VERSION;
+ if (ioctl(f,MGA_VID_CONFIG,&mga_vid_config))
+ {
+ perror("Error in mga_vid_config ioctl");
+ return -1;
+ }
+ ioctl(f,MGA_VID_ON,0);
+
+ frames[0] = (char*)mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,f,0);
+ frames[1] = frames[0] + 1*mga_vid_config.frame_size;
+ frames[2] = frames[0] + 2*mga_vid_config.frame_size;
+ frames[3] = frames[0] + 3*mga_vid_config.frame_size;
+ mga_next_frame = 0;
+ vid_data = frames[mga_next_frame];
+
+ //clear the buffer
+ memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames);
+
+ return 0;
+
+}
+