]> git.sesse.net Git - vlc/blob - include/vlc_vout.h
Gives the needed DPB size when requesting a vout.
[vlc] / include / vlc_vout.h
1 /*****************************************************************************
2  * vlc_video.h: common video definitions
3  *****************************************************************************
4  * Copyright (C) 1999 - 2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Vincent Seguin <seguin@via.ecp.fr>
8  *          Samuel Hocevar <sam@via.ecp.fr>
9  *          Olivier Aubert <oaubert 47 videolan d07 org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 #ifndef VLC_VOUT_H_
27 #define VLC_VOUT_H_ 1
28
29 /**
30  * \file
31  * This file defines common video output structures and functions in vlc
32  */
33
34 #include <vlc_picture.h>
35 #include <vlc_filter.h>
36 #include <vlc_subpicture.h>
37
38 /*****************************************************************************
39  * Prototypes
40  *****************************************************************************/
41
42 /**
43  * \defgroup video_output Video Output
44  * This module describes the programming interface for video output threads.
45  * It includes functions allowing to open a new thread, send pictures to a
46  * thread, and destroy a previously opened video output thread.
47  * @{
48  */
49
50 /**
51  * Vout configuration
52  */
53 typedef struct {
54     vout_thread_t        *vout;
55     vlc_object_t         *input;
56     const video_format_t *fmt;
57     unsigned             dpb_size;
58 } vout_configuration_t;
59
60 /**
61  * Video ouput thread private structure
62  */
63 typedef struct vout_thread_sys_t vout_thread_sys_t;
64
65 /**
66  * Video output thread descriptor
67  *
68  * Any independent video output device, such as an X11 window or a GGI device,
69  * is represented by a video output thread, and described using the following
70  * structure.
71  */
72 struct vout_thread_t {
73     VLC_COMMON_MEMBERS
74
75     /* Private vout_thread data */
76     vout_thread_sys_t *p;
77 };
78
79 /* Alignment flags */
80 #define VOUT_ALIGN_LEFT         0x0001
81 #define VOUT_ALIGN_RIGHT        0x0002
82 #define VOUT_ALIGN_HMASK        0x0003
83 #define VOUT_ALIGN_TOP          0x0004
84 #define VOUT_ALIGN_BOTTOM       0x0008
85 #define VOUT_ALIGN_VMASK        0x000C
86
87 /* scaling factor (applied to i_zoom in vout_thread_t) */
88 #define ZOOM_FP_FACTOR          1000
89
90 /*****************************************************************************
91  * Prototypes
92  *****************************************************************************/
93
94 /**
95  * Returns a suitable vout or release the given one.
96  *
97  * If cfg->fmt is non NULL and valid, a vout will be returned, reusing cfg->vout
98  * is possible, otherwise it returns NULL.
99  * If cfg->vout is not used, it will be closed and released.
100  *
101  * You can release the returned value either by vout_Request or vout_Close()
102  * followed by a vlc_object_release() or shorter vout_CloseAndRelease()
103  *
104  * \param object a vlc object
105  * \param cfg the video configuration requested.
106  * \return a vout
107  */
108 VLC_EXPORT( vout_thread_t *, vout_Request, ( vlc_object_t *object, const vout_configuration_t *cfg ) );
109 #define vout_Request(a,b) vout_Request(VLC_OBJECT(a),b)
110
111 /**
112  * This function will close a vout created by vout_Request.
113  * The associated vout module is closed.
114  * Note: It is not released yet, you'll have to call vlc_object_release()
115  * or use the convenient vout_CloseAndRelease().
116  *
117  * \param p_vout the vout to close
118  */
119 VLC_EXPORT( void,            vout_Close,        ( vout_thread_t *p_vout ) );
120
121 /**
122  * This function will close a vout created by vout_Create
123  * and then release it.
124  *
125  * \param p_vout the vout to close and release
126  */
127 static inline void vout_CloseAndRelease( vout_thread_t *p_vout )
128 {
129     vout_Close( p_vout );
130     vlc_object_release( p_vout );
131 }
132
133 /**
134  * This function will handle a snapshot request.
135  *
136  * pp_image, pp_picture and p_fmt can be NULL otherwise they will be
137  * set with returned value in case of success.
138  *
139  * pp_image will hold an encoded picture in psz_format format.
140  *
141  * i_timeout specifies the time the function will wait for a snapshot to be
142  * available.
143  *
144  */
145 VLC_EXPORT( int, vout_GetSnapshot, ( vout_thread_t *p_vout,
146                                      block_t **pp_image, picture_t **pp_picture,
147                                      video_format_t *p_fmt,
148                                      const char *psz_format, mtime_t i_timeout ) );
149
150 /* */
151 VLC_EXPORT( picture_t *,     vout_GetPicture,     ( vout_thread_t * ) );
152 VLC_EXPORT( void,            vout_PutPicture,     ( vout_thread_t *, picture_t * ) );
153
154 VLC_EXPORT( void,            vout_HoldPicture,    ( vout_thread_t *, picture_t * ) );
155 VLC_EXPORT( void,            vout_ReleasePicture, ( vout_thread_t *, picture_t * ) );
156
157 /* */
158 VLC_EXPORT( void, vout_PutSubpicture,             ( vout_thread_t *, subpicture_t * ) );
159 VLC_EXPORT( int,  vout_RegisterSubpictureChannel, ( vout_thread_t * ) );
160 VLC_EXPORT( void, vout_FlushSubpictureChannel,    ( vout_thread_t *, int ) );
161
162 VLC_EXPORT( void, vout_EnableFilter, ( vout_thread_t *, const char *,bool , bool  ) );
163
164 /**@}*/
165
166 #endif /* _VLC_VIDEO_H */