1
|
1 /*
|
|
2 * video_out.h
|
|
3 *
|
|
4 * Copyright (C) Aaron Holtzman - Aug 1999
|
|
5 *
|
|
6 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
|
|
7 *
|
|
8 * mpeg2dec is free software; you can redistribute it and/or modify
|
|
9 * it under the terms of the GNU General Public License as published by
|
|
10 * the Free Software Foundation; either version 2, or (at your option)
|
|
11 * any later version.
|
|
12 *
|
|
13 * mpeg2dec is distributed in the hope that it will be useful,
|
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 * GNU General Public License for more details.
|
|
17 *
|
|
18 * You should have received a copy of the GNU General Public License
|
|
19 * along with GNU Make; see the file COPYING. If not, write to
|
|
20 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
21 *
|
|
22 */
|
|
23
|
|
24 #ifdef __cplusplus
|
|
25 extern "C" {
|
|
26 #endif
|
|
27
|
|
28 #include <inttypes.h>
|
|
29
|
|
30 #define IMGFMT_YV12 0x32315659
|
|
31 //#define IMGFMT_YUY2 (('Y'<<24)|('U'<<16)|('Y'<<8)|'2')
|
|
32 #define IMGFMT_YUY2 (('2'<<24)|('Y'<<16)|('U'<<8)|'Y')
|
|
33
|
|
34 #define IMGFMT_RGB_MASK 0xFFFFFF00
|
|
35 #define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8))
|
|
36 #define IMGFMT_BGR_MASK 0xFFFFFF00
|
|
37 #define IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8))
|
|
38 #define IMGFMT_RGB15 (IMGFMT_RGB|15)
|
|
39 #define IMGFMT_RGB16 (IMGFMT_RGB|16)
|
|
40 #define IMGFMT_RGB24 (IMGFMT_RGB|24)
|
|
41 #define IMGFMT_RGB32 (IMGFMT_RGB|32)
|
|
42
|
|
43 typedef struct vo_info_s
|
|
44 {
|
|
45 /* driver name ("Matrox Millennium G200/G400" */
|
|
46 const char *name;
|
|
47 /* short name (for config strings) ("mga") */
|
|
48 const char *short_name;
|
|
49 /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
|
|
50 const char *author;
|
|
51 /* any additional comments */
|
|
52 const char *comment;
|
|
53 } vo_info_t;
|
|
54
|
|
55 typedef struct vo_image_buffer_s
|
|
56 {
|
|
57 uint32_t height;
|
|
58 uint32_t width;
|
|
59 uint32_t format;
|
|
60 uint8_t *base;
|
|
61 void *private;
|
|
62 } vo_image_buffer_t;
|
|
63
|
|
64 typedef struct vo_functions_s
|
|
65 {
|
|
66 /*
|
|
67 * Initialize the display driver.
|
|
68 *
|
|
69 * params : width == width of video to display.
|
|
70 * height == height of video to display.
|
|
71 * fullscreen == non-zero if driver should attempt to
|
|
72 * render in fullscreen mode. Zero if
|
|
73 * a windowed mode is requested. This is
|
|
74 * merely a request; if the driver can only do
|
|
75 * fullscreen (like fbcon) or windowed (like X11),
|
|
76 * than this param may be disregarded.
|
|
77 * title == string for titlebar of window. May be disregarded
|
|
78 * if there is no such thing as a window to your
|
|
79 * driver. Make a copy of this string, if you need it.
|
|
80 * format == desired fourCC code to use for image buffers
|
|
81 * returns : zero on successful initialization, non-zero on error.
|
|
82 * The program will probably respond to an error condition
|
|
83 * by terminating.
|
|
84 */
|
|
85
|
|
86 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);
|
|
87
|
|
88 uint32_t (*query_format)(uint32_t format);
|
|
89
|
|
90 /*
|
|
91 * Return driver information.
|
|
92 *
|
|
93 * params : none.
|
|
94 * returns : read-only pointer to a vo_info_t structure.
|
|
95 * Fields are non-NULL.
|
|
96 * Should not return NULL.
|
|
97 */
|
|
98
|
|
99 const vo_info_t* (*get_info)(void);
|
|
100
|
|
101 /*
|
|
102 * Display a new frame of the video to the screen. This may get called very
|
|
103 * rapidly, so the more efficient you can make your implementation of this
|
|
104 * function, the better.
|
|
105 *
|
|
106 * params : *src[] == An array with three elements. This is a YUV
|
|
107 * stream, with the Y plane in src[0], U in src[1],
|
|
108 * and V in src[2]. There is enough data for an image
|
|
109 * that is (WxH) pixels, where W and H are the width
|
|
110 * and height parameters that were previously passed
|
|
111 * to display_init().
|
|
112 * Information on the YUV format can be found at:
|
|
113 * http://www.webartz.com/fourcc/fccyuv.htm#IYUV
|
|
114 *
|
|
115 * returns : zero on successful rendering, non-zero on error.
|
|
116 * The program will probably respond to an error condition
|
|
117 * by terminating.
|
|
118 */
|
|
119
|
|
120 uint32_t (*draw_frame)(uint8_t *src[]);
|
|
121
|
|
122 /*
|
|
123 * Update a section of the offscreen buffer. A "slice" is an area of the
|
|
124 * video image that is 16 rows of pixels at the width of the video image.
|
|
125 * Position (0, 0) is the upper left corner of slice #0 (the first slice),
|
|
126 * and position (0, 15) is the lower right. The next slice, #1, is bounded
|
|
127 * by (0, 16) and (0, 31), and so on.
|
|
128 *
|
|
129 * Note that slices are not drawn directly to the screen, and should be
|
|
130 * buffered until your implementation of display_flip_page() (see below)
|
|
131 * is called.
|
|
132 *
|
|
133 * This may get called very rapidly, so the more efficient you can make your
|
|
134 * implementation of this function, the better.
|
|
135 *
|
|
136 * params : *src[] == see display_frame(), above. The data passed in this
|
|
137 * array is just what enough data to contain the
|
|
138 * new slice, and NOT the entire frame.
|
|
139 * slice_num == The index of the slice. Starts at 0, not 1.
|
|
140 *
|
|
141 * returns : zero on successful rendering, non-zero on error.
|
|
142 * The program will probably respond to an error condition
|
|
143 * by terminating.
|
|
144 */
|
|
145
|
|
146 // src[3] = source image planes (Y,U,V)
|
|
147 // stride[3] = source image planes line widths (in bytes)
|
|
148 // w,h = width*height of area to be copied (in Y pixels)
|
|
149 // x,y = position at the destination image (in Y pixels)
|
|
150
|
|
151 uint32_t (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y);
|
|
152
|
|
153 /*
|
|
154 * Draw the current image buffer to the screen. There may be several
|
|
155 * display_slice() calls before display_flip_page() is used. Note that
|
|
156 * display_frame does an implicit page flip, so you might or might not
|
|
157 * want to call this internally from your display_frame() implementation.
|
|
158 *
|
|
159 * This may get called very rapidly, so the more efficient you can make
|
|
160 * your implementation of this function, the better.
|
|
161 *
|
|
162 * params : void.
|
|
163 * returns : void.
|
|
164 */
|
|
165
|
|
166 void (*flip_page)(void);
|
|
167
|
|
168 void (*uninit)(void);
|
|
169
|
|
170 } vo_functions_t;
|
|
171
|
|
172 // NULL terminated array of all drivers
|
|
173 extern vo_functions_t* video_out_drivers[];
|
|
174
|
|
175
|
|
176 #ifdef X11_FULLSCREEN
|
|
177
|
|
178 // X11 keyboard codes
|
|
179 #include "wskeys.h"
|
|
180
|
|
181 extern int vo_depthonscreen;
|
|
182 extern int vo_screenwidth;
|
|
183 extern int vo_screenheight;
|
|
184 int vo_init( void );
|
|
185 //void vo_decoration( Display * vo_Display,Window w,int d );
|
|
186
|
|
187 extern int vo_eventhandler_pid;
|
|
188 void vo_kill_eventhandler();
|
|
189
|
|
190 #endif
|
|
191
|
|
192
|
|
193 #ifdef __cplusplus
|
|
194 }
|
|
195 #endif
|