Statistics
| Branch: | Revision:

ffmpeg / libavfilter / libmpcodecs / libvo / video_out.h @ e4852fb3

History | View | Annotate | Download (7.76 KB)

1
/*
2
 * Copyright (C) Aaron Holtzman - Aug 1999
3
 * Strongly modified, most parts rewritten: A'rpi/ESP-team - 2000-2001
4
 * (C) MPlayer developers
5
 *
6
 * This file is part of MPlayer.
7
 *
8
 * MPlayer 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 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * MPlayer 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 along
19
 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
20
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
 */
22

    
23
#ifndef MPLAYER_VIDEO_OUT_H
24
#define MPLAYER_VIDEO_OUT_H
25

    
26
#include <inttypes.h>
27
#include <stdarg.h>
28

    
29
//#include "sub/font_load.h"
30
#include "libmpcodecs/img_format.h"
31
//#include "vidix/vidix.h"
32

    
33
#define VO_EVENT_EXPOSE 1
34
#define VO_EVENT_RESIZE 2
35
#define VO_EVENT_KEYPRESS 4
36
#define VO_EVENT_REINIT 8
37
#define VO_EVENT_MOVE 16
38

    
39
/* Obsolete: VOCTRL_QUERY_VAA 1 */
40
/* does the device support the required format */
41
#define VOCTRL_QUERY_FORMAT 2
42
/* signal a device reset seek */
43
#define VOCTRL_RESET 3
44
/* true if vo driver can use GUI created windows */
45
#define VOCTRL_GUISUPPORT 4
46
#define VOCTRL_GUI_NOWINDOW 19
47
/* used to switch to fullscreen */
48
#define VOCTRL_FULLSCREEN 5
49
/* signal a device pause */
50
#define VOCTRL_PAUSE 7
51
/* start/resume playback */
52
#define VOCTRL_RESUME 8
53
/* libmpcodecs direct rendering: */
54
#define VOCTRL_GET_IMAGE 9
55
#define VOCTRL_DRAW_IMAGE 13
56
#define VOCTRL_SET_SPU_PALETTE 14
57
/* decoding ahead: */
58
#define VOCTRL_GET_NUM_FRAMES 10
59
#define VOCTRL_GET_FRAME_NUM  11
60
#define VOCTRL_SET_FRAME_NUM  12
61
#define VOCTRL_GET_PANSCAN 15
62
#define VOCTRL_SET_PANSCAN 16
63
/* equalizer controls */
64
#define VOCTRL_SET_EQUALIZER 17
65
#define VOCTRL_GET_EQUALIZER 18
66
//#define VOCTRL_GUI_NOWINDOW 19
67
/* Frame duplication */
68
#define VOCTRL_DUPLICATE_FRAME 20
69
// ... 21
70
#define VOCTRL_START_SLICE 21
71

    
72
#define VOCTRL_ONTOP 25
73
#define VOCTRL_ROOTWIN 26
74
#define VOCTRL_BORDER 27
75
#define VOCTRL_DRAW_EOSD 28
76
#define VOCTRL_GET_EOSD_RES 29
77

    
78
#define VOCTRL_SET_DEINTERLACE 30
79
#define VOCTRL_GET_DEINTERLACE 31
80

    
81
#define VOCTRL_UPDATE_SCREENINFO 32
82

    
83
// Vo can be used by xover
84
#define VOCTRL_XOVERLAY_SUPPORT 22
85

    
86
#define VOCTRL_XOVERLAY_SET_COLORKEY 24
87
typedef struct {
88
  uint32_t x11; // The raw x11 color
89
  uint16_t r,g,b;
90
} mp_colorkey_t;
91

    
92
#define VOCTRL_XOVERLAY_SET_WIN 23
93
typedef struct {
94
  int x,y;
95
  int w,h;
96
} mp_win_t;
97

    
98
#define VO_TRUE      1
99
#define VO_FALSE     0
100
#define VO_ERROR    -1
101
#define VO_NOTAVAIL -2
102
#define VO_NOTIMPL  -3
103

    
104
#define VOFLAG_FULLSCREEN         0x01
105
#define VOFLAG_MODESWITCHING      0x02
106
#define VOFLAG_SWSCALE            0x04
107
#define VOFLAG_FLIPPING           0x08
108
#define VOFLAG_HIDDEN             0x10  //< Use to create a hidden window
109
#define VOFLAG_STEREO             0x20  //< Use to create a stereo-capable window
110
#define VOFLAG_XOVERLAY_SUB_VO 0x10000
111

    
112
typedef struct vo_info_s
113
{
114
    /* driver name ("Matrox Millennium G200/G400" */
115
    const char *name;
116
    /* short name (for config strings) ("mga") */
117
    const char *short_name;
118
    /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
119
    const char *author;
120
    /* any additional comments */
121
    const char *comment;
122
} vo_info_t;
123

    
124
typedef struct vo_functions_s
125
{
126
    const vo_info_t *info;
127
    /*
128
     * Preinitializes driver (real INITIALIZATION)
129
     *   arg - currently it's vo_subdevice
130
     *   returns: zero on successful initialization, non-zero on error.
131
     */
132
    int (*preinit)(const char *arg);
133
    /*
134
     * Initialize (means CONFIGURE) the display driver.
135
     * params:
136
     *   width,height: image source size
137
     *   d_width,d_height: size of the requested window size, just a hint
138
     *   fullscreen: flag, 0=windowd 1=fullscreen, just a hint
139
     *   title: window title, if available
140
     *   format: fourcc of pixel format
141
     * returns : zero on successful initialization, non-zero on error.
142
     */
143
    int (*config)(uint32_t width, uint32_t height, uint32_t d_width,
144
                  uint32_t d_height, uint32_t fullscreen, char *title,
145
                  uint32_t format);
146

    
147
    /*
148
     * Control interface
149
     */
150
    int (*control)(uint32_t request, void *data, ...);
151

    
152
    /*
153
     * Display a new RGB/BGR frame of the video to the screen.
154
     * params:
155
     *   src[0] - pointer to the image
156
     */
157
    int (*draw_frame)(uint8_t *src[]);
158

    
159
    /*
160
     * Draw a planar YUV slice to the buffer:
161
     * params:
162
     *   src[3] = source image planes (Y,U,V)
163
     *   stride[3] = source image planes line widths (in bytes)
164
     *   w,h = width*height of area to be copied (in Y pixels)
165
     *   x,y = position at the destination image (in Y pixels)
166
     */
167
    int (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y);
168

    
169
    /*
170
     * Draws OSD to the screen buffer
171
     */
172
    void (*draw_osd)(void);
173

    
174
    /*
175
     * Blit/Flip buffer to the screen. Must be called after each frame!
176
     */
177
    void (*flip_page)(void);
178

    
179
    /*
180
     * This func is called after every frames to handle keyboard and
181
     * other events. It's called in PAUSE mode too!
182
     */
183
    void (*check_events)(void);
184

    
185
    /*
186
     * Closes driver. Should restore the original state of the system.
187
     */
188
    void (*uninit)(void);
189
} vo_functions_t;
190

    
191
const vo_functions_t* init_best_video_out(char** vo_list);
192
int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
193
                     uint32_t d_width, uint32_t d_height, uint32_t flags,
194
                     char *title, uint32_t format);
195
void list_video_out(void);
196

    
197
// NULL terminated array of all drivers
198
extern const vo_functions_t* const video_out_drivers[];
199

    
200
extern int vo_flags;
201

    
202
extern int vo_config_count;
203

    
204
extern int xinerama_screen;
205
extern int xinerama_x;
206
extern int xinerama_y;
207

    
208
// correct resolution/bpp on screen:  (should be autodetected by vo_init())
209
extern int vo_depthonscreen;
210
extern int vo_screenwidth;
211
extern int vo_screenheight;
212

    
213
// requested resolution/bpp:  (-x -y -bpp options)
214
extern int vo_dx;
215
extern int vo_dy;
216
extern int vo_dwidth;
217
extern int vo_dheight;
218
extern int vo_dbpp;
219

    
220
extern int vo_grabpointer;
221
extern int vo_doublebuffering;
222
extern int vo_directrendering;
223
extern int vo_vsync;
224
extern int vo_fs;
225
extern int vo_fsmode;
226
extern float vo_panscan;
227
extern int vo_adapter_num;
228
extern int vo_refresh_rate;
229
extern int vo_keepaspect;
230
extern int vo_rootwin;
231
extern int vo_ontop;
232
extern int vo_border;
233

    
234
extern int vo_gamma_gamma;
235
extern int vo_gamma_brightness;
236
extern int vo_gamma_saturation;
237
extern int vo_gamma_contrast;
238
extern int vo_gamma_hue;
239
extern int vo_gamma_red_intensity;
240
extern int vo_gamma_green_intensity;
241
extern int vo_gamma_blue_intensity;
242

    
243
extern int vo_nomouse_input;
244
extern int enable_mouse_movements;
245

    
246
extern int vo_pts;
247
extern float vo_fps;
248

    
249
extern char *vo_subdevice;
250

    
251
extern int vo_colorkey;
252

    
253
extern char *vo_winname;
254
extern char *vo_wintitle;
255

    
256
extern int64_t WinID;
257

    
258
typedef struct {
259
        float min;
260
        float max;
261
        } range_t;
262

    
263
float range_max(range_t *r);
264
int in_range(range_t *r, float f);
265
range_t *str2range(char *s);
266
extern char *monitor_hfreq_str;
267
extern char *monitor_vfreq_str;
268
extern char *monitor_dotclock_str;
269

    
270
struct mp_keymap {
271
  int from;
272
  int to;
273
};
274
int lookup_keymap_table(const struct mp_keymap *map, int key);
275
struct vo_rect {
276
  int left, right, top, bottom, width, height;
277
};
278
void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
279
                        struct vo_rect *borders, const struct vo_rect *crop);
280
void vo_mouse_movement(int posx, int posy);
281

    
282
static inline int aspect_scaling(void)
283
{
284
  return vo_fs;
285
}
286

    
287
#endif /* MPLAYER_VIDEO_OUT_H */