video_out.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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. #ifndef MPLAYER_VIDEO_OUT_H
  23. #define MPLAYER_VIDEO_OUT_H
  24. #include <inttypes.h>
  25. #include <stdarg.h>
  26. //#include "sub/font_load.h"
  27. #include "../img_format.h"
  28. //#include "vidix/vidix.h"
  29. #define VO_EVENT_EXPOSE 1
  30. #define VO_EVENT_RESIZE 2
  31. #define VO_EVENT_KEYPRESS 4
  32. #define VO_EVENT_REINIT 8
  33. #define VO_EVENT_MOVE 16
  34. /* Obsolete: VOCTRL_QUERY_VAA 1 */
  35. /* does the device support the required format */
  36. #define VOCTRL_QUERY_FORMAT 2
  37. /* signal a device reset seek */
  38. #define VOCTRL_RESET 3
  39. /* true if vo driver can use GUI created windows */
  40. #define VOCTRL_GUISUPPORT 4
  41. #define VOCTRL_GUI_NOWINDOW 19
  42. /* used to switch to fullscreen */
  43. #define VOCTRL_FULLSCREEN 5
  44. /* signal a device pause */
  45. #define VOCTRL_PAUSE 7
  46. /* start/resume playback */
  47. #define VOCTRL_RESUME 8
  48. /* libmpcodecs direct rendering: */
  49. #define VOCTRL_GET_IMAGE 9
  50. #define VOCTRL_DRAW_IMAGE 13
  51. #define VOCTRL_SET_SPU_PALETTE 14
  52. /* decoding ahead: */
  53. #define VOCTRL_GET_NUM_FRAMES 10
  54. #define VOCTRL_GET_FRAME_NUM 11
  55. #define VOCTRL_SET_FRAME_NUM 12
  56. #define VOCTRL_GET_PANSCAN 15
  57. #define VOCTRL_SET_PANSCAN 16
  58. /* equalizer controls */
  59. #define VOCTRL_SET_EQUALIZER 17
  60. #define VOCTRL_GET_EQUALIZER 18
  61. //#define VOCTRL_GUI_NOWINDOW 19
  62. /* Frame duplication */
  63. #define VOCTRL_DUPLICATE_FRAME 20
  64. // ... 21
  65. #define VOCTRL_START_SLICE 21
  66. #define VOCTRL_ONTOP 25
  67. #define VOCTRL_ROOTWIN 26
  68. #define VOCTRL_BORDER 27
  69. #define VOCTRL_DRAW_EOSD 28
  70. #define VOCTRL_GET_EOSD_RES 29
  71. #define VOCTRL_SET_DEINTERLACE 30
  72. #define VOCTRL_GET_DEINTERLACE 31
  73. #define VOCTRL_UPDATE_SCREENINFO 32
  74. // Vo can be used by xover
  75. #define VOCTRL_XOVERLAY_SUPPORT 22
  76. #define VOCTRL_XOVERLAY_SET_COLORKEY 24
  77. typedef struct {
  78. uint32_t x11; // The raw x11 color
  79. uint16_t r,g,b;
  80. } mp_colorkey_t;
  81. #define VOCTRL_XOVERLAY_SET_WIN 23
  82. typedef struct {
  83. int x,y;
  84. int w,h;
  85. } mp_win_t;
  86. #define VO_TRUE 1
  87. #define VO_FALSE 0
  88. #define VO_ERROR -1
  89. #define VO_NOTAVAIL -2
  90. #define VO_NOTIMPL -3
  91. #define VOFLAG_FULLSCREEN 0x01
  92. #define VOFLAG_MODESWITCHING 0x02
  93. #define VOFLAG_SWSCALE 0x04
  94. #define VOFLAG_FLIPPING 0x08
  95. #define VOFLAG_HIDDEN 0x10 //< Use to create a hidden window
  96. #define VOFLAG_STEREO 0x20 //< Use to create a stereo-capable window
  97. #define VOFLAG_XOVERLAY_SUB_VO 0x10000
  98. typedef struct vo_info_s
  99. {
  100. /* driver name ("Matrox Millennium G200/G400" */
  101. const char *name;
  102. /* short name (for config strings) ("mga") */
  103. const char *short_name;
  104. /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
  105. const char *author;
  106. /* any additional comments */
  107. const char *comment;
  108. } vo_info_t;
  109. typedef struct vo_functions_s
  110. {
  111. const vo_info_t *info;
  112. /*
  113. * Preinitializes driver (real INITIALIZATION)
  114. * arg - currently it's vo_subdevice
  115. * returns: zero on successful initialization, non-zero on error.
  116. */
  117. int (*preinit)(const char *arg);
  118. /*
  119. * Initialize (means CONFIGURE) the display driver.
  120. * params:
  121. * width,height: image source size
  122. * d_width,d_height: size of the requested window size, just a hint
  123. * fullscreen: flag, 0=windowd 1=fullscreen, just a hint
  124. * title: window title, if available
  125. * format: fourcc of pixel format
  126. * returns : zero on successful initialization, non-zero on error.
  127. */
  128. int (*config)(uint32_t width, uint32_t height, uint32_t d_width,
  129. uint32_t d_height, uint32_t fullscreen, char *title,
  130. uint32_t format);
  131. /*
  132. * Control interface
  133. */
  134. int (*control)(uint32_t request, void *data, ...);
  135. /*
  136. * Display a new RGB/BGR frame of the video to the screen.
  137. * params:
  138. * src[0] - pointer to the image
  139. */
  140. int (*draw_frame)(uint8_t *src[]);
  141. /*
  142. * Draw a planar YUV slice to the buffer:
  143. * params:
  144. * src[3] = source image planes (Y,U,V)
  145. * stride[3] = source image planes line widths (in bytes)
  146. * w,h = width*height of area to be copied (in Y pixels)
  147. * x,y = position at the destination image (in Y pixels)
  148. */
  149. int (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y);
  150. /*
  151. * Draws OSD to the screen buffer
  152. */
  153. void (*draw_osd)(void);
  154. /*
  155. * Blit/Flip buffer to the screen. Must be called after each frame!
  156. */
  157. void (*flip_page)(void);
  158. /*
  159. * This func is called after every frames to handle keyboard and
  160. * other events. It's called in PAUSE mode too!
  161. */
  162. void (*check_events)(void);
  163. /*
  164. * Closes driver. Should restore the original state of the system.
  165. */
  166. void (*uninit)(void);
  167. } vo_functions_t;
  168. const vo_functions_t* init_best_video_out(char** vo_list);
  169. int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
  170. uint32_t d_width, uint32_t d_height, uint32_t flags,
  171. char *title, uint32_t format);
  172. void list_video_out(void);
  173. // NULL terminated array of all drivers
  174. extern const vo_functions_t* const video_out_drivers[];
  175. extern int vo_flags;
  176. extern int vo_config_count;
  177. extern int xinerama_screen;
  178. extern int xinerama_x;
  179. extern int xinerama_y;
  180. // correct resolution/bpp on screen: (should be autodetected by vo_init())
  181. extern int vo_depthonscreen;
  182. extern int vo_screenwidth;
  183. extern int vo_screenheight;
  184. // requested resolution/bpp: (-x -y -bpp options)
  185. extern int vo_dx;
  186. extern int vo_dy;
  187. extern int vo_dwidth;
  188. extern int vo_dheight;
  189. extern int vo_dbpp;
  190. extern int vo_grabpointer;
  191. extern int vo_doublebuffering;
  192. extern int vo_directrendering;
  193. extern int vo_vsync;
  194. extern int vo_fsmode;
  195. extern float vo_panscan;
  196. extern int vo_adapter_num;
  197. extern int vo_refresh_rate;
  198. extern int vo_keepaspect;
  199. extern int vo_rootwin;
  200. extern int vo_ontop;
  201. extern int vo_border;
  202. extern int vo_gamma_gamma;
  203. extern int vo_gamma_brightness;
  204. extern int vo_gamma_saturation;
  205. extern int vo_gamma_contrast;
  206. extern int vo_gamma_hue;
  207. extern int vo_gamma_red_intensity;
  208. extern int vo_gamma_green_intensity;
  209. extern int vo_gamma_blue_intensity;
  210. extern int vo_nomouse_input;
  211. extern int enable_mouse_movements;
  212. extern int vo_pts;
  213. extern float vo_fps;
  214. extern char *vo_subdevice;
  215. extern int vo_colorkey;
  216. extern char *vo_winname;
  217. extern char *vo_wintitle;
  218. extern int64_t WinID;
  219. typedef struct {
  220. float min;
  221. float max;
  222. } range_t;
  223. float range_max(range_t *r);
  224. int in_range(range_t *r, float f);
  225. range_t *str2range(char *s);
  226. extern char *monitor_hfreq_str;
  227. extern char *monitor_vfreq_str;
  228. extern char *monitor_dotclock_str;
  229. struct mp_keymap {
  230. int from;
  231. int to;
  232. };
  233. int lookup_keymap_table(const struct mp_keymap *map, int key);
  234. struct vo_rect {
  235. int left, right, top, bottom, width, height;
  236. };
  237. void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
  238. struct vo_rect *borders, const struct vo_rect *crop);
  239. void vo_mouse_movement(int posx, int posy);
  240. #endif /* MPLAYER_VIDEO_OUT_H */