]> git.sesse.net Git - vlc/blob - include/vlc_vout.h
Made video_format_t vout_Create/Request parameter const.
[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  * Video ouput thread private structure
52  */
53 typedef struct vout_thread_sys_t vout_thread_sys_t;
54
55 /**
56  * Video output thread descriptor
57  *
58  * Any independent video output device, such as an X11 window or a GGI device,
59  * is represented by a video output thread, and described using the following
60  * structure.
61  */
62 struct vout_thread_t
63 {
64     VLC_COMMON_MEMBERS
65
66     /* Private vout_thread data */
67     vout_thread_sys_t *p;
68 };
69
70 /* Alignment flags */
71 #define VOUT_ALIGN_LEFT         0x0001
72 #define VOUT_ALIGN_RIGHT        0x0002
73 #define VOUT_ALIGN_HMASK        0x0003
74 #define VOUT_ALIGN_TOP          0x0004
75 #define VOUT_ALIGN_BOTTOM       0x0008
76 #define VOUT_ALIGN_VMASK        0x000C
77
78 /* scaling factor (applied to i_zoom in vout_thread_t) */
79 #define ZOOM_FP_FACTOR          1000
80
81 /*****************************************************************************
82  * Prototypes
83  *****************************************************************************/
84
85 /**
86  * This function will
87  *  - returns a suitable vout (if requested by a non NULL p_fmt)
88  *  - recycles an old vout (if given) by either destroying it or by saving it
89  *  for latter usage.
90  *
91  * The purpose of this function is to avoid unnecessary creation/destruction of
92  * vout (and to allow optional vout reusing).
93  *
94  * You can call vout_Request on a vout created by vout_Create or by a previous
95  * call to vout_Request.
96  * You can release the returned value either by vout_Request or vout_Close()
97  * followed by a vlc_object_release() or shorter vout_CloseAndRelease()
98  *
99  * \param p_this a vlc object
100  * \param p_vout a vout candidate
101  * \param p_fmt the video format requested or NULL
102  * \return a vout if p_fmt is non NULL and the request is successfull, NULL
103  * otherwise
104  */
105 VLC_EXPORT( vout_thread_t *, vout_Request, ( vlc_object_t *p_this, vout_thread_t *p_vout, const video_format_t *p_fmt ) );
106 #define vout_Request(a,b,c) vout_Request(VLC_OBJECT(a),b,c)
107
108 /**
109  * This function will create a suitable vout for a given p_fmt. It will never
110  * reuse an already existing unused vout.
111  *
112  * You have to call either vout_Close or vout_Request on the returned value
113  * \param p_this a vlc object to which the returned vout will be attached
114  * \param p_fmt the video format requested
115  * \return a vout if the request is successfull, NULL otherwise
116  */
117 VLC_EXPORT( vout_thread_t *, vout_Create, ( vlc_object_t *p_this, const video_format_t *p_fmt ) );
118 #define vout_Create(a,b) vout_Create(VLC_OBJECT(a),b)
119
120 /**
121  * This function will close a vout created by vout_Create or vout_Request.
122  * The associated vout module is closed.
123  * Note: It is not released yet, you'll have to call vlc_object_release()
124  * or use the convenient vout_CloseAndRelease().
125  *
126  * \param p_vout the vout to close
127  */
128 VLC_EXPORT( void,            vout_Close,        ( vout_thread_t *p_vout ) );
129
130 /**
131  * This function will close a vout created by vout_Create
132  * and then release it.
133  *
134  * \param p_vout the vout to close and release
135  */
136 static inline void vout_CloseAndRelease( vout_thread_t *p_vout )
137 {
138     vout_Close( p_vout );
139     vlc_object_release( p_vout );
140 }
141
142 /**
143  * This function will handle a snapshot request.
144  *
145  * pp_image, pp_picture and p_fmt can be NULL otherwise they will be
146  * set with returned value in case of success.
147  *
148  * pp_image will hold an encoded picture in psz_format format.
149  *
150  * i_timeout specifies the time the function will wait for a snapshot to be
151  * available.
152  *
153  */
154 VLC_EXPORT( int, vout_GetSnapshot, ( vout_thread_t *p_vout,
155                                      block_t **pp_image, picture_t **pp_picture,
156                                      video_format_t *p_fmt,
157                                      const char *psz_format, mtime_t i_timeout ) );
158
159 /* */
160 VLC_EXPORT( picture_t *,     vout_GetPicture,     ( vout_thread_t * ) );
161 VLC_EXPORT( void,            vout_PutPicture,     ( vout_thread_t *, picture_t * ) );
162
163 VLC_EXPORT( void,            vout_HoldPicture,    ( vout_thread_t *, picture_t * ) );
164 VLC_EXPORT( void,            vout_ReleasePicture, ( vout_thread_t *, picture_t * ) );
165
166 /* */
167 VLC_EXPORT( void, vout_PutSubpicture,             ( vout_thread_t *, subpicture_t * ) );
168 VLC_EXPORT( int,  vout_RegisterSubpictureChannel, ( vout_thread_t * ) );
169 VLC_EXPORT( void, vout_FlushSubpictureChannel,    ( vout_thread_t *, int ) );
170
171 /**
172  * Return the spu_t object associated to a vout_thread_t.
173  *
174  * The return object is valid only as long as the vout is. You must not
175  * release the spu_t object returned.
176  * It cannot return NULL so no need to check.
177  */
178 VLC_EXPORT( spu_t *, vout_GetSpu, ( vout_thread_t * ) );
179
180 VLC_EXPORT( void, vout_EnableFilter, ( vout_thread_t *, const char *,bool , bool  ) );
181
182 /**@}*/
183
184 #endif /* _VLC_VIDEO_H */