Mercurial > mplayer.hg
diff libvo/vo_mga.c @ 56:cdb2e30be421
mga_vid fixes, code cleanup
author | arpi_esp |
---|---|
date | Thu, 08 Mar 2001 01:06:03 +0000 |
parents | 9d68da5d8a9a |
children | ba889a88ef91 |
line wrap: on
line diff
--- a/libvo/vo_mga.c Wed Mar 07 20:42:22 2001 +0000 +++ b/libvo/vo_mga.c Thu Mar 08 01:06:03 2001 +0000 @@ -49,20 +49,14 @@ "" }; -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 @@ 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 @@ 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; - - if (ioctl(f,MGA_VID_CONFIG,&mga_vid_config)) - { - perror("Error in mga_vid_config ioctl"); - } - ioctl(f,MGA_VID_ON,0); + + mga_vid_config.version=MGA_VID_VERSION; - 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*