summaryrefslogtreecommitdiffstats
path: root/libvo/mga_common.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-09 13:25:13 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-09 13:25:13 +0000
commit96bda1810f7f191cdae39ba8e533e0ad56517629 (patch)
tree085a95e0b0ff6f05651d8f207278d5a280afc72e /libvo/mga_common.c
parentbc4055d60c44f62fb162ccfd2f3a2b17f7451862 (diff)
downloadmpv-96bda1810f7f191cdae39ba8e533e0ad56517629.tar.bz2
mpv-96bda1810f7f191cdae39ba8e533e0ad56517629.tar.xz
some cleanup
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7680 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/mga_common.c')
-rw-r--r--libvo/mga_common.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index 8da4846880..6cacfe8c16 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -319,7 +319,33 @@ static uint32_t control(uint32_t request, void *data, ...)
}
-static int mga_init(){
+static int mga_init(int width,int height,unsigned int format){
+
+ switch(format){
+ case IMGFMT_YV12:
+ width+=width&1;height+=height&1;
+ mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
+ mga_vid_config.format=MGA_VID_FORMAT_I420; break;
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+ width+=width&1;height+=height&1;
+ mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
+ mga_vid_config.format=MGA_VID_FORMAT_YV12; break;
+ case IMGFMT_YUY2:
+ mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2;
+ mga_vid_config.format=MGA_VID_FORMAT_YUY2; break;
+ case IMGFMT_UYVY:
+ mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2;
+ mga_vid_config.format=MGA_VID_FORMAT_UYVY; break;
+ default:
+ printf("mga: invalid output format %0X\n",format);
+ return (-1);
+ }
+
+ mga_vid_config.src_width = width;
+ mga_vid_config.src_height= height;
+ mga_vid_config.dest_width = width;
+ mga_vid_config.dest_height= height;
mga_vid_config.num_frames=(vo_directrendering && !vo_doublebuffering)?1:3;
mga_vid_config.version=MGA_VID_VERSION;
@@ -329,7 +355,6 @@ static int mga_init(){
printf("Your mga_vid driver version is incompatible with this MPlayer version!\n");
return -1;
}
- ioctl(f,MGA_VID_ON,0);
printf("[mga] Using %d buffers.\n",mga_vid_config.num_frames);
@@ -343,15 +368,19 @@ static int mga_init(){
//clear the buffer
memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames);
+ ioctl(f,MGA_VID_ON,0);
+
return 0;
}
static int mga_uninit(){
+ if(f>=0){
ioctl( f,MGA_VID_OFF,0 );
munmap(frames[0],mga_vid_config.frame_size*mga_vid_config.num_frames);
close(f);
f = -1;
+ }
return 0;
}
@@ -366,6 +395,11 @@ static uint32_t preinit(const char *vo_subdevice)
printf("vo_mga: Couldn't open %s\n",devname);
return(-1);
}
+
+#ifdef VO_XMGA
+ if (!vo_init()) return -1;
+#endif
+
return 0;
}