annotate libvo/video_out.h @ 18:531d58007138

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