OSDN Git Service

add tstools.
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / modules / video_out.h
1 /*\r
2  *                      GPAC - Multimedia Framework C SDK\r
3  *\r
4  *                      Copyright (c) Jean Le Feuvre 2000-2005\r
5  *                                      All rights reserved\r
6  *\r
7  *  This file is part of GPAC / modules interfaces\r
8  *\r
9  *  GPAC is free software; you can redistribute it and/or modify\r
10  *  it under the terms of the GNU Lesser General Public License as published by\r
11  *  the Free Software Foundation; either version 2, or (at your option)\r
12  *  any later version.\r
13  *   \r
14  *  GPAC is distributed in the hope that it will be useful,\r
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  *  GNU Lesser General Public License for more details.\r
18  *   \r
19  *  You should have received a copy of the GNU Lesser General Public\r
20  *  License along with this library; see the file COPYING.  If not, write to\r
21  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
22  *\r
23  */\r
24 \r
25 \r
26 /*\r
27 \r
28                 Note on video driver: this is not a graphics driver, the only thing requested from this driver\r
29         is accessing video memory and performing stretch of YUV and RGB on the backbuffer (bitmap node)\r
30         the graphics driver is a different entity that performs 2D rasterization\r
31 \r
32 */\r
33 \r
34 #ifndef _GF_MODULE_VIDEO_OUT_H_\r
35 #define _GF_MODULE_VIDEO_OUT_H_\r
36 \r
37 #ifdef __cplusplus\r
38 extern "C" {\r
39 #endif\r
40 \r
41 /*include module system*/\r
42 #include <gpac/module.h>\r
43 /*include event system*/\r
44 #include <gpac/events.h>\r
45 /*include framebuffer definition*/\r
46 #include <gpac/color.h>\r
47 \r
48 /*\r
49                 Video hardware output module\r
50 */\r
51 \r
52 enum\r
53 {\r
54         /*HW supports RGB->backbuffer blitting*/\r
55         GF_VIDEO_HW_HAS_RGB = (1<<1),\r
56         /*HW supports RGBA->backbuffer blitting*/\r
57         GF_VIDEO_HW_HAS_RGBA = (1<<2),\r
58         /*HW supports YUV->backbuffer blitting*/\r
59         GF_VIDEO_HW_HAS_YUV = (1<<3),\r
60         /*HW supports YUV overlays*/\r
61         GF_VIDEO_HW_HAS_YUV_OVERLAY = (1<<4),\r
62         /*HW supports OpenGL rendering. Whether this is OpenGL or OpenGL-ES depends on compilation settings\r
63         and cannot be changed at runtime*/\r
64         GF_VIDEO_HW_OPENGL = (1<<5),\r
65         /*HW supports OpenGL offscreen rendering. Whether this is OpenGL or OpenGL-ES depends on compilation settings\r
66         and cannot be changed at runtime*/\r
67         GF_VIDEO_HW_OPENGL_OFFSCREEN = (1<<6),\r
68         /*HW supports OpenGL offscreen rendering with alpha. Whether this is OpenGL or OpenGL-ES depends on compilation settings\r
69         and cannot be changed at runtime*/\r
70         GF_VIDEO_HW_OPENGL_OFFSCREEN_ALPHA = (1<<7),\r
71 };\r
72 \r
73 /*interface name and version for video output*/\r
74 #define GF_VIDEO_OUTPUT_INTERFACE       GF_4CC('G','V','O',0x04) \r
75 \r
76 /*\r
77                         video output interface\r
78 \r
79         the video output may run in 2 modes: 2D and 3D.\r
80 \r
81         ** the 2D video output works by accessing a backbuffer surface on the video mem board - \r
82         the app accesses to the surface through the GF_VideoSurface handler. \r
83         The module may support HW blitting of RGB or YUV data to backbuffer.\r
84 \r
85         ** the 3D video output only handles window management and openGL contexts setup.\r
86         The context shall be setup in Resize and SetFullScreen calls which are always happening in the main \r
87         rendering thread. This will take care of openGL context issues with multithreading\r
88 \r
89         By default all modules are required to be setup in 2D. If 3D is needed, a GF_EVENT_VIDEO_SETUP will\r
90         be sent with the desired configuration.\r
91 \r
92         Except Setup and Shutdown functions, all interface functions are called through the main compositor thread\r
93         or its user to avoid multithreading issues. Care must still be taken when handling events\r
94 */\r
95 typedef struct _video_out\r
96 {\r
97         /* interface declaration*/\r
98         GF_DECL_MODULE_INTERFACE\r
99 \r
100         /*setup system - if os_handle is NULL the driver shall create the output display (common case)\r
101         the other case is currently only used by child windows on win32 and winCE\r
102         @init_flags: a list of initialization flags as specified in user.h*/\r
103         GF_Err (*Setup)(struct _video_out *vout, void *os_handle, void *os_display, u32 init_flags);\r
104         /*shutdown system */\r
105         void (*Shutdown) (struct _video_out *vout);\r
106 \r
107         /*flush video: the video shall be presented to screen \r
108         the destination area to update is in client display coordinates (0,0) being top-left, (w,h) bottom-right\r
109         Note: dest is always NULL in 3D mode (buffer flip only)*/\r
110         GF_Err (*Flush) (struct _video_out *vout, GF_Window *dest);\r
111 \r
112         GF_Err (*SetFullScreen) (struct _video_out *vout, Bool fs_on, u32 *new_disp_width, u32 *new_disp_height);\r
113 \r
114         /*window events sent to output:\r
115         GF_EVENT_SET_CURSOR: sets cursor\r
116         GF_EVENT_SET_CAPTION: sets caption\r
117         GF_EVENT_SHOWHIDE: show/hide output window for self-managed output\r
118         GF_EVENT_SIZE:  inital window resize upon scene load\r
119         GF_EVENT_VIDEO_SETUP: all HW related setup:\r
120                 * for 2D output, this means resizing the backbuffer if needed (depending on HW constraints)\r
121                 * for 3D output, this means re-setup of OpenGL context (depending on HW constraints).\r
122                         * This can be a request for an offscreen rendering surface. If supported, this surface SHALL\r
123                         be readable through glReadPixels. If not supported, just return an error.\r
124                         Note that GPAC never uses more than one GL context (offscreen or main video)\r
125                         * Depending on windowing systems and implementations, it could be possible to resize a window \r
126                 without destroying the GL context. If the GL context is destroyed, the module should send an event\r
127                 of the same type to the player.\r
128         \r
129         This function is also called with a NULL event at the begining of each rendering cycle, in order to allow event \r
130         handling for modules uncapable of safe multithreading (eg X11)\r
131         */\r
132         GF_Err (*ProcessEvent)(struct _video_out *vout, GF_Event *event);\r
133 \r
134         /*pass events to user (assigned before setup) - return 1 if the event has been processed by GPAC \r
135         (eiher scene or navigation), 0 otherwise*/\r
136         void *evt_cbk_hdl;\r
137         Bool (*on_event)(void *hdl, GF_Event *event);\r
138 \r
139         /*\r
140                         All the following are 2D specific and are NEVER called in 3D mode\r
141         */\r
142         /*locks backbuffer video memory\r
143         do_lock: specifies whether backbuffer shall be locked or released\r
144         */\r
145         GF_Err (*LockBackBuffer)(struct _video_out *vout, GF_VideoSurface *video_info, Bool do_lock);\r
146 \r
147         /*lock video mem through OS context (only HDC for Win32 at the moment)\r
148         do_lock: specifies whether OS context shall be locked or released*/\r
149         void *(*LockOSContext)(struct _video_out *vout, Bool do_lock);\r
150 \r
151         /*blit surface src to backbuffer - if a window is not specified, the full surface is used\r
152         the blitter MUST support stretching and RGB24 sources. Support for YUV is indicated in the hw caps\r
153         of the driver. If none is supported, just set this function to NULL and let gpac performs software blitting.\r
154         Whenever this function fails, the blit will be performed in software mode\r
155         if is_overlay is set, this is an overlay on the video memory (Flush would have been called before)\r
156                 overlay_type 1: this is regular overlay without color keying\r
157                 overlay_type 2: this is overlay with color keying\r
158         */\r
159         GF_Err (*Blit)(struct _video_out *vout, GF_VideoSurface *video_src, GF_Window *src_wnd, GF_Window *dst_wnd, u32 overlay_type);\r
160 \r
161         /*set of above HW flags*/\r
162         u32 hw_caps;\r
163         /*main pixel format of video board (informative only)*/\r
164         u32 pixel_format;\r
165         /*yuv pixel format if HW YUV blitting is supported (informative only) */\r
166         u32 yuv_pixel_format;\r
167         /*maximum resolution of the screen*/\r
168         u32 max_screen_width, max_screen_height;\r
169         /* dpi of the screen*/\r
170         u32 dpi_x, dpi_y;\r
171 \r
172         /*overlay color key used by the hardware bliter - if not set, only top-level overlay can be used*/\r
173         u32 overlay_color_key;\r
174 #ifdef ENABLE_JOYSTICK\r
175         u32 centered_mode;\r
176 #endif\r
177 \r
178         /*driver private*/\r
179         void *opaque;\r
180 } GF_VideoOutput;\r
181 \r
182 \r
183 \r
184 #ifdef __cplusplus\r
185 }\r
186 #endif\r
187 \r
188 \r
189 #endif  /*_GF_MODULE_VIDEO_OUT_H_*/\r
190 \r