annotate libvo/vo_mga.c @ 2050:18f4dd5d568f

-Wall warnings fixed
author arpi
date Tue, 02 Oct 2001 21:45:41 +0000
parents 248972c26eee
children 1f1880196a1c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 //#define memcpy(a,b,c)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 * video_out_mga.c
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * Copyright (C) Aaron Holtzman - Aug 1999
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 * mpeg2dec is free software; you can redistribute it and/or modify
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * the Free Software Foundation; either version 2, or (at your option)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 * any later version.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 * mpeg2dec is distributed in the hope that it will be useful,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 * GNU General Public License for more details.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 * along with GNU Make; see the file COPYING. If not, write to
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 #include "config.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 #include "video_out_internal.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 LIBVO_EXTERN(mga)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 #include <sys/ioctl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 #include <sys/mman.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 #include "drivers/mga_vid.h"
616
41d6eec69b60 clean up
pontscho
parents: 614
diff changeset
43 #include "sub.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 static vo_info_t vo_info =
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 "Matrox G200/G400 overlay (/dev/mga_vid)",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 "mga",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 "Aaron Holtzman <aholtzma@ess.engr.uvic.ca>",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 #include "mga_common.c"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 static uint32_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 {
1210
5cbbca64a5c9 vo_subdevice support
arpi_esp
parents: 616
diff changeset
59 char *devname=vo_subdevice?vo_subdevice:"/dev/mga_vid";
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60
1210
5cbbca64a5c9 vo_subdevice support
arpi_esp
parents: 616
diff changeset
61 f = open(devname,O_RDWR);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 if(f == -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 {
1210
5cbbca64a5c9 vo_subdevice support
arpi_esp
parents: 616
diff changeset
64 printf("Couldn't open %s\n",devname);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 return(-1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 switch(format){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 case IMGFMT_YV12:
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
70 mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 mga_vid_config.format=MGA_VID_FORMAT_YV12; break;
470
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 448
diff changeset
72 case IMGFMT_I420:
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 448
diff changeset
73 mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 448
diff changeset
74 mga_vid_config.format=MGA_VID_FORMAT_I420; break;
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 448
diff changeset
75 case IMGFMT_IYUV:
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 448
diff changeset
76 mga_vid_config.frame_size = ((width + 31) & ~31) * height + (((width + 31) & ~31) * height) / 2;
8e101a5d9dc2 I420/IYUV support
arpi_esp
parents: 448
diff changeset
77 mga_vid_config.format=MGA_VID_FORMAT_IYUV; break;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 case IMGFMT_YUY2:
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
79 mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 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
81 case IMGFMT_UYVY:
198b46b739d8 qrva eletbe nem kene cvs-t elbaszni inkabb ne nyuljatok hozza baz+
arpi_esp
parents: 213
diff changeset
82 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
83 mga_vid_config.format=MGA_VID_FORMAT_UYVY; break;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 default:
614
f83ec60bce49 fprintf(stderr converted to printf(
szabii
parents: 612
diff changeset
85 printf("mga: invalid output format %0X\n",format);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 return (-1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88
197
ba889a88ef91 colkey_on=0 fix
arpi_esp
parents: 56
diff changeset
89 mga_vid_config.colkey_on=0;
ba889a88ef91 colkey_on=0 fix
arpi_esp
parents: 56
diff changeset
90
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 mga_vid_config.src_width = width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 mga_vid_config.src_height= height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 mga_vid_config.dest_width = d_width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 mga_vid_config.dest_height= d_height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 mga_vid_config.x_org= 0; // (720-mga_vid_config.dest_width)/2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 mga_vid_config.y_org= 0; // (576-mga_vid_config.dest_height)/2;
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
97
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
98 mga_vid_config.version=MGA_VID_VERSION;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99
56
cdb2e30be421 mga_vid fixes, code cleanup
arpi_esp
parents: 47
diff changeset
100 return mga_init();
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 static const vo_info_t*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 get_info(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 return &vo_info;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 uninit(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 {
1637
248972c26eee fixed mga uninit
arpi
parents: 1501
diff changeset
112 mga_uninit();
248972c26eee fixed mga uninit
arpi
parents: 1501
diff changeset
113 printf("vo: uninit!\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1210
diff changeset
116 static void draw_osd(void)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1210
diff changeset
117 {
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1210
diff changeset
118 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
119 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1210
diff changeset
120
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
121 static void flip_page(void)
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
122 {
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
123 vo_mga_flip_page();
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
124 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
126
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
127 static void check_events(void)
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
128 {
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
129 }
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
130
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
131
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
132