summaryrefslogtreecommitdiffstats
path: root/libvo/vo_mga.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/vo_mga.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/vo_mga.c')
-rw-r--r--libvo/vo_mga.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/libvo/vo_mga.c b/libvo/vo_mga.c
index bd91eae003..49fbd236e8 100644
--- a/libvo/vo_mga.c
+++ b/libvo/vo_mga.c
@@ -49,20 +49,14 @@ static vo_info_t vo_info =
""
};
-static mga_vid_config_t mga_vid_config;
-static uint8_t *vid_data, *frames[4];
-static int f;
#include "mga_common.c"
static uint32_t
init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
{
- char *frame_mem;
- uint32_t frame_size;
f = open("/dev/mga_vid",O_RDWR);
-
if(f == -1)
{
fprintf(stderr,"Couldn't open /dev/mga_vid\n");
@@ -71,8 +65,10 @@ init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint3
switch(format){
case IMGFMT_YV12:
+ 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;
default:
fprintf(stderr,"mga: invalid output format %0X\n",format);
@@ -81,34 +77,14 @@ init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint3
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.dest_width = d_width;
-// (width<704)?704:width; // HACK
mga_vid_config.dest_height= d_height;
-// (height<576)?576:height; // HACK
mga_vid_config.x_org= 0; // (720-mga_vid_config.dest_width)/2;
mga_vid_config.y_org= 0; // (576-mga_vid_config.dest_height)/2;
+
+ mga_vid_config.version=MGA_VID_VERSION;
- if (ioctl(f,MGA_VID_CONFIG,&mga_vid_config))
- {
- perror("Error in mga_vid_config ioctl");
- }
- ioctl(f,MGA_VID_ON,0);
-
- frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
- frame_mem = (char*)mmap(0,frame_size*4,PROT_WRITE,MAP_SHARED,f,0);
- frames[0] = frame_mem;
- frames[1] = frame_mem + 1*frame_size;
- frames[2] = frame_mem + 2*frame_size;
- frames[3] = frame_mem + 3*frame_size;
- mga_next_frame = 0;
- vid_data = frames[mga_next_frame];
-
- //clear the buffer
- memset(frame_mem,0x80,frame_size*4);
-
- return 0;
+ return mga_init();
}
static const vo_info_t*