Mercurial > mplayer.hg
annotate libvo/vo_mga.c @ 4905:eb1a28f1236a
yuy2 support disabled to workaround stupid colorspace selection
author | michael |
---|---|
date | Fri, 01 Mar 2002 12:42:12 +0000 |
parents | c35d7ce151b3 |
children | 2cc47599b571 |
rev | line source |
---|---|
1 | 1 |
2 //#define memcpy(a,b,c) | |
3 | |
4 /* | |
5 * video_out_mga.c | |
6 * | |
7 * Copyright (C) Aaron Holtzman - Aug 1999 | |
8 * | |
9 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. | |
10 * | |
11 * mpeg2dec is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2, or (at your option) | |
14 * any later version. | |
15 * | |
16 * mpeg2dec is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with GNU Make; see the file COPYING. If not, write to | |
23 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 * | |
25 */ | |
26 | |
27 #include <stdio.h> | |
28 #include <stdlib.h> | |
29 #include <string.h> | |
30 | |
31 #include "config.h" | |
32 #include "video_out.h" | |
33 #include "video_out_internal.h" | |
34 | |
35 LIBVO_EXTERN(mga) | |
36 | |
37 #include <sys/ioctl.h> | |
38 #include <unistd.h> | |
39 #include <fcntl.h> | |
40 #include <sys/mman.h> | |
4595
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
41 #include <linux/fb.h> |
1 | 42 |
43 #include "drivers/mga_vid.h" | |
616 | 44 #include "sub.h" |
2317
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
45 #include "aspect.h" |
1 | 46 |
47 static vo_info_t vo_info = | |
48 { | |
49 "Matrox G200/G400 overlay (/dev/mga_vid)", | |
50 "mga", | |
51 "Aaron Holtzman <aholtzma@ess.engr.uvic.ca>", | |
52 "" | |
53 }; | |
54 | |
55 | |
56 #include "mga_common.c" | |
57 | |
4595
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
58 #define FBDEV "/dev/fb0" |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
59 |
1 | 60 static uint32_t |
4447
87447fe383a1
change init to config in vo_mga like in the other vo_ modules -- fixes crash caused by the changeover
rfelker
parents:
4433
diff
changeset
|
61 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format,const vo_tune_info_t *info) |
1 | 62 { |
1210 | 63 char *devname=vo_subdevice?vo_subdevice:"/dev/mga_vid"; |
1 | 64 |
4595
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
65 if(!vo_screenwidth || !vo_screenheight) { |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
66 int fd; |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
67 struct fb_var_screeninfo fbinfo; |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
68 |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
69 if(-1 != (fd = open(FBDEV, O_RDONLY))) { |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
70 if(0 == ioctl(fd, FBIOGET_VSCREENINFO, &fbinfo)) { |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
71 if(!vo_screenwidth) vo_screenwidth = fbinfo.xres; |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
72 if(!vo_screenheight) vo_screenheight = fbinfo.yres; |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
73 } else { |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
74 perror("FBIOGET_VSCREENINFO"); |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
75 } |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
76 close(fd); |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
77 } else { |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
78 perror(FBDEV); |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
79 } |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
80 } |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
81 |
2317
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
82 if(vo_screenwidth && vo_screenheight){ |
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
83 aspect_save_orig(width,height); |
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
84 aspect_save_prescale(d_width,d_height); |
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
85 aspect_save_screenres(vo_screenwidth,vo_screenheight); |
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
86 |
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
87 if(fullscreen&0x01) /* -fs */ |
2318 | 88 aspect(&d_width,&d_height,A_ZOOM); |
2317
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
89 else |
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
90 aspect(&d_width,&d_height,A_NOZOOM); |
2319 | 91 printf("vo_mga aspect(): resized to %dx%d\n",d_width,d_height); |
2317
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
92 } |
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
93 |
1f1880196a1c
Aspect support for vo_mga, you need to use -screenw and -screenh to set your current screen res. Untested!
atmos4
parents:
1637
diff
changeset
|
94 |
1210 | 95 f = open(devname,O_RDWR); |
1 | 96 if(f == -1) |
97 { | |
1210 | 98 printf("Couldn't open %s\n",devname); |
1 | 99 return(-1); |
100 } | |
101 | |
102 switch(format){ | |
103 case IMGFMT_YV12: | |
56 | 104 mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2; |
1 | 105 mga_vid_config.format=MGA_VID_FORMAT_YV12; break; |
470 | 106 case IMGFMT_I420: |
107 mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2; | |
108 mga_vid_config.format=MGA_VID_FORMAT_I420; break; | |
109 case IMGFMT_IYUV: | |
110 mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2; | |
111 mga_vid_config.format=MGA_VID_FORMAT_IYUV; break; | |
1 | 112 case IMGFMT_YUY2: |
56 | 113 mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2; |
1 | 114 mga_vid_config.format=MGA_VID_FORMAT_YUY2; break; |
448
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
213
diff
changeset
|
115 case IMGFMT_UYVY: |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
213
diff
changeset
|
116 mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2; |
198b46b739d8
qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents:
213
diff
changeset
|
117 mga_vid_config.format=MGA_VID_FORMAT_UYVY; break; |
1 | 118 default: |
614 | 119 printf("mga: invalid output format %0X\n",format); |
1 | 120 return (-1); |
121 } | |
122 | |
197 | 123 mga_vid_config.colkey_on=0; |
124 | |
1 | 125 mga_vid_config.src_width = width; |
126 mga_vid_config.src_height= height; | |
127 mga_vid_config.dest_width = d_width; | |
128 mga_vid_config.dest_height= d_height; | |
129 mga_vid_config.x_org= 0; // (720-mga_vid_config.dest_width)/2; | |
130 mga_vid_config.y_org= 0; // (576-mga_vid_config.dest_height)/2; | |
2351
c53969b13353
Added image centering, now only screenblanking and hiding the cursor is missing.
atmos4
parents:
2319
diff
changeset
|
131 if(vo_screenwidth && vo_screenheight){ |
c53969b13353
Added image centering, now only screenblanking and hiding the cursor is missing.
atmos4
parents:
2319
diff
changeset
|
132 mga_vid_config.x_org=(vo_screenwidth-d_width)/2; |
c53969b13353
Added image centering, now only screenblanking and hiding the cursor is missing.
atmos4
parents:
2319
diff
changeset
|
133 mga_vid_config.y_org=(vo_screenheight-d_height)/2; |
c53969b13353
Added image centering, now only screenblanking and hiding the cursor is missing.
atmos4
parents:
2319
diff
changeset
|
134 } |
56 | 135 |
136 mga_vid_config.version=MGA_VID_VERSION; | |
1 | 137 |
56 | 138 return mga_init(); |
1 | 139 } |
140 | |
141 static const vo_info_t* | |
142 get_info(void) | |
143 { | |
144 return &vo_info; | |
145 } | |
146 | |
147 static void | |
148 uninit(void) | |
149 { | |
1637 | 150 mga_uninit(); |
151 printf("vo: uninit!\n"); | |
1 | 152 } |
153 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1210
diff
changeset
|
154 static void draw_osd(void) |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1210
diff
changeset
|
155 { |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1210
diff
changeset
|
156 vo_draw_text(mga_vid_config.src_width,mga_vid_config.src_height,draw_alpha); |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1210
diff
changeset
|
157 } |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1210
diff
changeset
|
158 |
31 | 159 static void flip_page(void) |
160 { | |
161 vo_mga_flip_page(); | |
162 } | |
1 | 163 |
31 | 164 |
165 static void check_events(void) | |
166 { | |
167 } | |
168 | |
4352 | 169 static uint32_t preinit(const char *arg) |
170 { | |
171 return 0; | |
172 } | |
31 | 173 |
4596 | 174 static uint32_t control(uint32_t request, void *data, ...) |
4352 | 175 { |
4592
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4447
diff
changeset
|
176 switch (request) { |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4447
diff
changeset
|
177 case VOCTRL_QUERY_FORMAT: |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4447
diff
changeset
|
178 return query_format(*((uint32_t*)data)); |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4447
diff
changeset
|
179 } |
5fbfd8545c3b
query_ stuff replaced by new control() - patch by David Holm
arpi
parents:
4447
diff
changeset
|
180 return VO_NOTIMPL; |
4352 | 181 } |