Translation system changes part 2: replace macros by strings
[mplayer/glamo.git] / libvo / vo_mga.c
blob3f730fe5d429e5fd4c548bdcc2d51127aa0d21c6
1 /*
2 * video output through mga_vid kernel driver
4 * This file is part of MPlayer.
6 * MPlayer is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * MPlayer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
25 #include "config.h"
26 #include "mp_msg.h"
27 #include "help_mp.h"
28 #include "video_out.h"
29 #include "video_out_internal.h"
31 #include <sys/ioctl.h>
32 #include <unistd.h>
33 #include <fcntl.h>
34 #include <sys/mman.h>
35 #include <linux/fb.h>
37 #include "drivers/mga_vid.h"
38 #include "sub.h"
39 #include "aspect.h"
41 static const vo_info_t info =
43 "Matrox G200/G4x0/G550 overlay (/dev/mga_vid)",
44 "mga",
45 "A'rpi",
46 "Based on some code by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>"
49 const LIBVO_EXTERN(mga)
51 #include "mga_common.c"
53 #define FBDEV "/dev/fb0"
55 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
58 // if (f >= 0) mga_uninit();
59 if(!vo_screenwidth || !vo_screenheight) {
60 int fd;
61 struct fb_var_screeninfo fbinfo;
63 if(-1 != (fd = open(FBDEV, O_RDONLY))) {
64 if(0 == ioctl(fd, FBIOGET_VSCREENINFO, &fbinfo)) {
65 if(!vo_screenwidth) vo_screenwidth = fbinfo.xres;
66 if(!vo_screenheight) vo_screenheight = fbinfo.yres;
67 } else {
68 perror("FBIOGET_VSCREENINFO");
70 close(fd);
71 } else {
72 perror(FBDEV);
76 if(vo_screenwidth && vo_screenheight){
77 aspect_save_orig(width,height);
78 aspect_save_prescale(d_width,d_height);
79 aspect_save_screenres(vo_screenwidth,vo_screenheight);
81 if(flags&VOFLAG_FULLSCREEN) { /* -fs */
82 aspect(&d_width,&d_height,A_ZOOM);
83 vo_fs = VO_TRUE;
84 } else {
85 aspect(&d_width,&d_height,A_NOZOOM);
86 vo_fs = VO_FALSE;
88 mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_MGA] aspect(): resized to %dx%d.\n",d_width,d_height);
91 vo_dwidth=d_width; vo_dheight=d_height;
92 mga_vid_config.dest_width = d_width;
93 mga_vid_config.dest_height= d_height;
94 mga_vid_config.x_org= 0; // (720-mga_vid_config.dest_width)/2;
95 mga_vid_config.y_org= 0; // (576-mga_vid_config.dest_height)/2;
96 if(vo_screenwidth && vo_screenheight){
97 mga_vid_config.x_org=(vo_screenwidth-d_width)/2;
98 mga_vid_config.y_org=(vo_screenheight-d_height)/2;
101 return mga_init(width,height,format);
104 static void uninit(void)
106 mp_tmsg(MSGT_VO,MSGL_INFO, "[VO] uninit!\n");
107 mga_uninit();
110 static void flip_page(void)
112 vo_mga_flip_page();
116 static void check_events(void)