annotate libvo/video_out.h @ 4662:90cf53f47ab7

minor rounding bugfix in the aspect stuff
author michael
date Mon, 11 Feb 2002 14:04:31 +0000
parents 09198a119e39
children 95fa3901cafc
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
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
5 * Strongly modified, most parts rewritten: A'rpi/ESP-team - 2000-2001
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 #include <inttypes.h>
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
10 #include <stdarg.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 31
diff changeset
12 #include "font_load.h"
408
b61c5c4484f8 - applied overlay patch by Jens H
atmosfear
parents: 388
diff changeset
13 #include "img_format.h"
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
14 #include "../vidix/vidix.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
16 #define VO_EVENT_EXPOSE 1
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
17 #define VO_EVENT_RESIZE 2
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
18 #define VO_EVENT_KEYPRESS 4
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
19
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
20 /* takes a pointer to a vo_vaa_s struct */
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
21 #define VOCTRL_QUERY_VAA 1
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
22 /* takes a pointer to uint32_t fourcc */
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
23 #define VOCTRL_QUERY_FORMAT 2
4618
09198a119e39 added voctrl_guisupport and fixed some typos
alex
parents: 4592
diff changeset
24 /* signal a device reset (seek/pause) */
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
25 #define VOCTRL_RESET 3
4618
09198a119e39 added voctrl_guisupport and fixed some typos
alex
parents: 4592
diff changeset
26 /* true if vo driver can use GUI created windows */
09198a119e39 added voctrl_guisupport and fixed some typos
alex
parents: 4592
diff changeset
27 #define VOCTRL_GUISUPPORT 4
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
28
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
29 #define VO_TRUE 1
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
30 #define VO_FALSE 0
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
31 #define VO_ERROR -1
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
32 #define VO_NOTAVAIL -2
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
33 #define VO_NOTIMPL -3
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
34
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 typedef struct vo_info_s
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 /* driver name ("Matrox Millennium G200/G400" */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 const char *name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 /* short name (for config strings) ("mga") */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 const char *short_name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 const char *author;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 /* any additional comments */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 const char *comment;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 } vo_info_t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
47 /* Direct access to BES */
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
48 typedef struct bes_da_s
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
49 {
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
50 vidix_rect_t dest; /* This field should be filled by x,y,w,h
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
51 from vidix:src but pitches from
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
52 vidix:dest */
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
53 int flags; /* Probably will work only when flag == 0 */
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
54 /* memory model */
4618
09198a119e39 added voctrl_guisupport and fixed some typos
alex
parents: 4592
diff changeset
55 unsigned frame_size; /* destination frame size */
09198a119e39 added voctrl_guisupport and fixed some typos
alex
parents: 4592
diff changeset
56 unsigned num_frames; /* number of available frames */
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
57 unsigned offsets[VID_PLAY_MAXFRAMES]; /* relative offset of each frame from begin of video memory */
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
58 vidix_yuv_t offset; /* relative offsets within frame for yuv planes */
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
59 void* dga_addr; /* linear address of BES */
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
60 }bes_da_t;
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
61
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
62 /*
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
63 Video Accelearted Architecture.
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
64 Every field of this structure can be set to NULL that means that
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
65 features is not supported
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
66 */
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
67 typedef struct vo_vaa_s
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
68 {
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
69 uint32_t flags; /* currently undefined */
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
70 /*
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
71 * Query Direct Access to BES
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
72 * info - information to be filled
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
73 * returns: 0 on success errno on error.
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
74 */
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
75 int (*query_bes_da)(bes_da_t *info);
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
76 int (*get_video_eq)(vidix_video_eq_t *info);
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
77 int (*set_video_eq)(const vidix_video_eq_t *info);
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
78 int (*get_num_fx)(unsigned *info);
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
79 int (*get_oem_fx)(vidix_oem_fx_t *info);
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
80 int (*set_oem_fx)(const vidix_oem_fx_t *info);
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
81 int (*set_deint)(const vidix_deinterlace_t *info);
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
82 }vo_vaa_t;
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
83
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
84 /* Misc info to tuneup vo driver */
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
85 typedef struct vo_tune_info_s
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
86 {
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
87 int pitch[3]; /* Should be 0 if unknown else power of 2 */
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
88 }vo_tune_info_t;
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
89
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 typedef struct vo_functions_s
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 {
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
92 /*
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
93 * Preinitializes driver (real INITIALIZATION)
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
94 * arg - currently it's vo_subdevice
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
95 * returns: zero on successful initialization, non-zero on error.
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
96 */
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
97 uint32_t (*preinit)(const char *arg);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 /*
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 3201
diff changeset
99 * Initialize (means CONFIGURE) the display driver.
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
100 * params:
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
101 * width,height: image source size
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
102 * d_width,d_height: size of the requested window size, just a hint
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
103 * fullscreen: flag, 0=windowd 1=fullscreen, just a hint
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
104 * title: window title, if available
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
105 * format: fourcc of pixel format
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
106 * returns : zero on successful initialization, non-zero on error.
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 */
4433
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
108 uint32_t (*config)(uint32_t width, uint32_t height, uint32_t d_width,
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
109 uint32_t d_height, uint32_t fullscreen, char *title,
df8e0f71cc3c new info for tuning
nick
parents: 4352
diff changeset
110 uint32_t format,const vo_tune_info_t *);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
112 /*
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
113 * Control interface
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
114 */
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
115 uint32_t (*control)(uint32_t request, void *data, ...);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 * Return driver information.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 * returns : read-only pointer to a vo_info_t structure.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 const vo_info_t* (*get_info)(void);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 /*
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
124 * Display a new RGB/BGR frame of the video to the screen.
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
125 * params:
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
126 * src[0] - pointer to the image
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 uint32_t (*draw_frame)(uint8_t *src[]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 /*
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
131 * Draw a planar YUV slice to the buffer:
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
132 * params:
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
133 * src[3] = source image planes (Y,U,V)
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
134 * stride[3] = source image planes line widths (in bytes)
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
135 * w,h = width*height of area to be copied (in Y pixels)
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
136 * x,y = position at the destination image (in Y pixels)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 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
139
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1326
diff changeset
140 /*
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1326
diff changeset
141 * Draws OSD to the screen buffer
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1326
diff changeset
142 */
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1326
diff changeset
143 void (*draw_osd)(void);
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1326
diff changeset
144
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 /*
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
146 * Blit/Flip buffer to the screen. Must be called after each frame!
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 void (*flip_page)(void);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
150 /*
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
151 * This func is called after every frames to handle keyboard and
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
152 * other events. It's called in PAUSE mode too!
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
153 */
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
154 void (*check_events)(void);
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
155
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
156 /*
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
157 * Closes driver. Should restore the original state of the system.
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
158 */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 void (*uninit)(void);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 } vo_functions_t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162
1142
6b6c173d050f added prototype of vo_format_name
al3x
parents: 408
diff changeset
163 char *vo_format_name(int format);
1326
76478d16903d added prototype of vo_init()
arpi
parents: 1268
diff changeset
164 int vo_init(void);
76478d16903d added prototype of vo_init()
arpi
parents: 1268
diff changeset
165
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 // NULL terminated array of all drivers
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 extern vo_functions_t* video_out_drivers[];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168
4618
09198a119e39 added voctrl_guisupport and fixed some typos
alex
parents: 4592
diff changeset
169 // correct resolution/bpp on screen: (should be autodetected by vo_init())
388
ccb5ebfaaeac -bpp changes
arpi_esp
parents: 218
diff changeset
170 extern int vo_depthonscreen;
ccb5ebfaaeac -bpp changes
arpi_esp
parents: 218
diff changeset
171 extern int vo_screenwidth;
ccb5ebfaaeac -bpp changes
arpi_esp
parents: 218
diff changeset
172 extern int vo_screenheight;
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 31
diff changeset
173
388
ccb5ebfaaeac -bpp changes
arpi_esp
parents: 218
diff changeset
174 // requested resolution/bpp: (-x -y -bpp options)
ccb5ebfaaeac -bpp changes
arpi_esp
parents: 218
diff changeset
175 extern int vo_dwidth;
ccb5ebfaaeac -bpp changes
arpi_esp
parents: 218
diff changeset
176 extern int vo_dheight;
ccb5ebfaaeac -bpp changes
arpi_esp
parents: 218
diff changeset
177 extern int vo_dbpp;
ccb5ebfaaeac -bpp changes
arpi_esp
parents: 218
diff changeset
178
1268
9877eaacff9e extern vo_doublebuffering cleanup
arpi
parents: 1184
diff changeset
179 extern int vo_doublebuffering;
9877eaacff9e extern vo_doublebuffering cleanup
arpi
parents: 1184
diff changeset
180 extern int vo_fsmode;
9877eaacff9e extern vo_doublebuffering cleanup
arpi
parents: 1184
diff changeset
181
2707
97efb75dceb8 vo_pts added
arpi
parents: 1501
diff changeset
182 extern int vo_pts;
3201
039a973b3dda Newest DXR3 patch (improved 1.0rc2) by David Holm.
atmos4
parents: 2707
diff changeset
183 extern float vo_fps;
2707
97efb75dceb8 vo_pts added
arpi
parents: 1501
diff changeset
184
1184
e8c3f89ecd96 vo_subdevice implemented
al3x
parents: 1142
diff changeset
185 extern char *vo_subdevice;
e8c3f89ecd96 vo_subdevice implemented
al3x
parents: 1142
diff changeset
186