Mercurial > mplayer.hg
annotate libvo/vo_mga.c @ 32507:97738e6f82dc
Use IMGFMT to compare instead of PIX_FMT to avoid issues
with the "JPEG" formats like PIX_FMT_YUVJ422P.
author | reimar |
---|---|
date | Sat, 06 Nov 2010 21:49:49 +0000 |
parents | fbe5c829c69b |
children | 5d3f93051de9 |
rev | line source |
---|---|
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
1 /* |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
2 * video output through mga_vid kernel driver |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
3 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
4 * This file is part of MPlayer. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
5 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
6 * MPlayer is free software; you can redistribute it and/or modify |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
9 * (at your option) any later version. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
10 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
11 * MPlayer is distributed in the hope that it will be useful, |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
14 * GNU General Public License for more details. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
15 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
16 * You should have received a copy of the GNU General Public License along |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
25220
diff
changeset
|
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
1 | 19 */ |
20 | |
21 #include <stdio.h> | |
22 #include <stdlib.h> | |
23 #include <string.h> | |
24 | |
25 #include "config.h" | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
26 #include "mp_msg.h" |
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
27 #include "help_mp.h" |
1 | 28 #include "video_out.h" |
29 #include "video_out_internal.h" | |
30 | |
31 #include <sys/ioctl.h> | |
32 #include <unistd.h> | |
33 #include <fcntl.h> | |
34 #include <sys/mman.h> | |
4595
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
35 #include <linux/fb.h> |
1 | 36 |
37 #include "drivers/mga_vid.h" | |
32467 | 38 #include "sub/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
|
39 #include "aspect.h" |
1 | 40 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
41 static const vo_info_t info = |
1 | 42 { |
7679 | 43 "Matrox G200/G4x0/G550 overlay (/dev/mga_vid)", |
1 | 44 "mga", |
7679 | 45 "A'rpi", |
46 "Based on some code by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>" | |
1 | 47 }; |
48 | |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
49 const LIBVO_EXTERN(mga) |
1 | 50 |
31364
317649676214
Rename libvo/mga_common.c --> libvo/mga_template.c.
diego
parents:
30633
diff
changeset
|
51 #include "mga_template.c" |
1 | 52 |
4595
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
53 #define FBDEV "/dev/fb0" |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
54 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15218
diff
changeset
|
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) |
1 | 56 { |
57 | |
5433 | 58 // if (f >= 0) mga_uninit(); |
4595
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
59 if(!vo_screenwidth || !vo_screenheight) { |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
60 int fd; |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
61 struct fb_var_screeninfo fbinfo; |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
62 |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
63 if(-1 != (fd = open(FBDEV, O_RDONLY))) { |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
64 if(0 == ioctl(fd, FBIOGET_VSCREENINFO, &fbinfo)) { |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
65 if(!vo_screenwidth) vo_screenwidth = fbinfo.xres; |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
66 if(!vo_screenheight) vo_screenheight = fbinfo.yres; |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
67 } else { |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
68 perror("FBIOGET_VSCREENINFO"); |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
69 } |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
70 close(fd); |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
71 } else { |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
72 perror(FBDEV); |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
73 } |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
74 } |
6f54ae46ac27
screensize from fbdev ioctl - patch by Jason Lunz <j@falooley.org>
arpi
parents:
4592
diff
changeset
|
75 |
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
|
76 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
|
77 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
|
78 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
|
79 aspect_save_screenres(vo_screenwidth,vo_screenheight); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
80 |
15218
090c8df3f6fe
100l to Jindrich! Changing the parameter name in the body, too.
rathann
parents:
15212
diff
changeset
|
81 if(flags&VOFLAG_FULLSCREEN) { /* -fs */ |
2318 | 82 aspect(&d_width,&d_height,A_ZOOM); |
5987 | 83 vo_fs = VO_TRUE; |
84 } else { | |
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
|
85 aspect(&d_width,&d_height,A_NOZOOM); |
5987 | 86 vo_fs = VO_FALSE; |
87 } | |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
88 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_MGA_AspectResized,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
|
89 } |
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 |
9994 | 91 vo_dwidth=d_width; vo_dheight=d_height; |
1 | 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; | |
2351
c53969b13353
Added image centering, now only screenblanking and hiding the cursor is missing.
atmos4
parents:
2319
diff
changeset
|
96 if(vo_screenwidth && vo_screenheight){ |
c53969b13353
Added image centering, now only screenblanking and hiding the cursor is missing.
atmos4
parents:
2319
diff
changeset
|
97 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
|
98 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
|
99 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28446
diff
changeset
|
100 |
7679 | 101 return mga_init(width,height,format); |
1 | 102 } |
103 | |
7679 | 104 static void uninit(void) |
1 | 105 { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
106 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_MGA_Uninit); |
7679 | 107 mga_uninit(); |
1 | 108 } |
109 | |
31 | 110 static void flip_page(void) |
111 { | |
112 vo_mga_flip_page(); | |
113 } | |
1 | 114 |
31 | 115 |
116 static void check_events(void) | |
117 { | |
118 } |