00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef VLC_VOUT_DISPLAY_H
00025 #define VLC_VOUT_DISPLAY_H 1
00026
00027
00028
00029
00030
00031
00032 #include <vlc_es.h>
00033 #include <vlc_picture.h>
00034 #include <vlc_picture_pool.h>
00035 #include <vlc_subpicture.h>
00036 #include <vlc_keys.h>
00037 #include <vlc_mouse.h>
00038 #include <vlc_vout_window.h>
00039
00040
00041
00042
00043
00044
00045 typedef struct vout_display_t vout_display_t;
00046 typedef struct vout_display_sys_t vout_display_sys_t;
00047 typedef struct vout_display_owner_t vout_display_owner_t;
00048 typedef struct vout_display_owner_sys_t vout_display_owner_sys_t;
00049
00050
00051
00052
00053 typedef enum
00054 {
00055 VOUT_DISPLAY_ALIGN_CENTER,
00056
00057 VOUT_DISPLAY_ALIGN_LEFT,
00058 VOUT_DISPLAY_ALIGN_RIGHT,
00059
00060 VOUT_DISPLAY_ALIGN_TOP,
00061 VOUT_DISPLAY_ALIGN_BOTTOM,
00062 } vout_display_align_t;
00063
00064
00065
00066
00067 enum {
00068 VOUT_WINDOW_STATE_NORMAL=0,
00069 VOUT_WINDOW_STATE_ABOVE=1,
00070 VOUT_WINDOW_STATE_BELOW=2,
00071 VOUT_WINDOW_STACK_MASK=3,
00072 };
00073
00074
00075
00076
00077 typedef struct {
00078 bool is_fullscreen;
00079
00080
00081 struct {
00082
00083 const char *title;
00084
00085
00086 unsigned width;
00087 unsigned height;
00088
00089
00090 struct {
00091 unsigned num;
00092 unsigned den;
00093 } sar;
00094 } display;
00095
00096
00097 struct {
00098 int horizontal;
00099 int vertical;
00100 } align;
00101
00102
00103 bool is_display_filled;
00104
00105
00106
00107
00108 struct {
00109 int num;
00110 int den;
00111 } zoom;
00112
00113 } vout_display_cfg_t;
00114
00115
00116
00117
00118
00119
00120
00121
00122 typedef struct {
00123 bool is_slow;
00124 bool has_double_click;
00125 bool has_hide_mouse;
00126 bool has_pictures_invalid;
00127 bool has_event_thread;
00128 } vout_display_info_t;
00129
00130
00131
00132
00133 enum {
00134
00135
00136 VOUT_DISPLAY_HIDE_MOUSE,
00137
00138
00139
00140
00141 VOUT_DISPLAY_RESET_PICTURES,
00142
00143
00144
00145 VOUT_DISPLAY_CHANGE_FULLSCREEN,
00146
00147
00148
00149 VOUT_DISPLAY_CHANGE_WINDOW_STATE,
00150
00151
00152
00153 VOUT_DISPLAY_CHANGE_DISPLAY_SIZE,
00154
00155
00156
00157 VOUT_DISPLAY_CHANGE_DISPLAY_FILLED,
00158
00159
00160
00161 VOUT_DISPLAY_CHANGE_ZOOM,
00162
00163
00164
00165 VOUT_DISPLAY_CHANGE_SOURCE_ASPECT,
00166
00167
00168
00169
00170
00171 VOUT_DISPLAY_CHANGE_SOURCE_CROP,
00172
00173
00174 VOUT_DISPLAY_GET_OPENGL,
00175 };
00176
00177
00178
00179
00180
00181
00182
00183 enum {
00184
00185
00186
00187
00188 VOUT_DISPLAY_EVENT_PICTURES_INVALID,
00189
00190 VOUT_DISPLAY_EVENT_FULLSCREEN,
00191 VOUT_DISPLAY_EVENT_WINDOW_STATE,
00192
00193 VOUT_DISPLAY_EVENT_DISPLAY_SIZE,
00194
00195
00196 VOUT_DISPLAY_EVENT_CLOSE,
00197 VOUT_DISPLAY_EVENT_KEY,
00198
00199
00200
00201
00202
00203 VOUT_DISPLAY_EVENT_MOUSE_STATE,
00204
00205
00206 VOUT_DISPLAY_EVENT_MOUSE_MOVED,
00207 VOUT_DISPLAY_EVENT_MOUSE_PRESSED,
00208 VOUT_DISPLAY_EVENT_MOUSE_RELEASED,
00209 VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK,
00210 };
00211
00212
00213
00214
00215 struct vout_display_owner_t {
00216
00217
00218 vout_display_owner_sys_t *sys;
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231 void (*event)(vout_display_t *, int, va_list);
00232
00233
00234
00235
00236
00237
00238 vout_window_t *(*window_new)(vout_display_t *, const vout_window_cfg_t *);
00239 void (*window_del)(vout_display_t *, vout_window_t *);
00240 };
00241
00242 struct vout_display_t {
00243 VLC_COMMON_MEMBERS
00244
00245
00246 module_t *module;
00247
00248
00249
00250
00251
00252
00253
00254 const vout_display_cfg_t *cfg;
00255
00256
00257
00258
00259
00260
00261 video_format_t source;
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272 video_format_t fmt;
00273
00274
00275
00276
00277
00278 vout_display_info_t info;
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289 picture_pool_t *(*pool)(vout_display_t *, unsigned count);
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299 void (*prepare)(vout_display_t *, picture_t *);
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309 void (*display)(vout_display_t *, picture_t *);
00310
00311
00312 int (*control)(vout_display_t *, int, va_list);
00313
00314
00315 void (*manage)(vout_display_t *);
00316
00317
00318
00319
00320
00321 vout_display_sys_t *sys;
00322
00323
00324
00325
00326
00327 vout_display_owner_t owner;
00328 };
00329
00330 static inline void vout_display_SendEvent(vout_display_t *vd, int query, ...)
00331 {
00332 va_list args;
00333 va_start(args, query);
00334 vd->owner.event(vd, query, args);
00335 va_end(args);
00336 }
00337
00338 static inline void vout_display_SendEventDisplaySize(vout_display_t *vd, int width, int height, bool is_fullscreen)
00339 {
00340 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_DISPLAY_SIZE, width, height, is_fullscreen);
00341 }
00342 static inline void vout_display_SendEventPicturesInvalid(vout_display_t *vd)
00343 {
00344 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_PICTURES_INVALID);
00345 }
00346 static inline void vout_display_SendEventClose(vout_display_t *vd)
00347 {
00348 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_CLOSE);
00349 }
00350 static inline void vout_display_SendEventKey(vout_display_t *vd, int key)
00351 {
00352 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_KEY, key);
00353 }
00354 static inline void vout_display_SendEventFullscreen(vout_display_t *vd, bool is_fullscreen)
00355 {
00356 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_FULLSCREEN, is_fullscreen);
00357 }
00358 static inline void vout_display_SendWindowState(vout_display_t *vd, unsigned state)
00359 {
00360 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_WINDOW_STATE, state);
00361 }
00362
00363 static inline void vout_display_SendEventMouseState(vout_display_t *vd, int x, int y, int button_mask)
00364 {
00365 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_STATE, x, y, button_mask);
00366 }
00367 static inline void vout_display_SendEventMouseMoved(vout_display_t *vd, int x, int y)
00368 {
00369 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_MOVED, x, y);
00370 }
00371 static inline void vout_display_SendEventMousePressed(vout_display_t *vd, int button)
00372 {
00373 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_PRESSED, button);
00374 }
00375 static inline void vout_display_SendEventMouseReleased(vout_display_t *vd, int button)
00376 {
00377 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_RELEASED, button);
00378 }
00379 static inline void vout_display_SendEventMouseDoubleClick(vout_display_t *vd)
00380 {
00381 vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_MOUSE_DOUBLE_CLICK);
00382 }
00383
00384
00385
00386
00387
00388
00389 static inline vout_window_t *vout_display_NewWindow(vout_display_t *vd, const vout_window_cfg_t *cfg)
00390 {
00391 return vd->owner.window_new(vd, cfg);
00392 }
00393
00394
00395
00396
00397 static inline void vout_display_DeleteWindow(vout_display_t *vd,
00398 vout_window_t *window)
00399 {
00400 vd->owner.window_del(vd, window);
00401 }
00402
00403
00404
00405
00406
00407
00408
00409 VLC_EXPORT( void, vout_display_GetDefaultDisplaySize, (unsigned *width, unsigned *height, const video_format_t *source, const vout_display_cfg_t *) );
00410
00411
00412
00413
00414
00415 typedef struct {
00416 int x;
00417 int y;
00418 unsigned width;
00419 unsigned height;
00420 } vout_display_place_t;
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432 VLC_EXPORT( void, vout_display_PlacePicture, (vout_display_place_t *place, const video_format_t *source, const vout_display_cfg_t *cfg, bool do_clipping) );
00433
00434 #endif
00435