codec: jpeg: fix sanity checks
[vlc.git] / include / vlc_vout.h
blob3dd50b1676bfae137d52fa6a57207b751af9d29c
1 /*****************************************************************************
2 * vlc_vout.h: common video definitions
3 *****************************************************************************
4 * Copyright (C) 1999 - 2008 VLC authors and VideoLAN
5 * $Id$
7 * Authors: Vincent Seguin <seguin@via.ecp.fr>
8 * Samuel Hocevar <sam@via.ecp.fr>
9 * Olivier Aubert <oaubert 47 videolan d07 org>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2.1 of the License, or
14 * (at your option) any later version.
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 Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program; if not, write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
26 #ifndef VLC_VOUT_H_
27 #define VLC_VOUT_H_ 1
29 #include <vlc_es.h>
30 #include <vlc_picture.h>
31 #include <vlc_subpicture.h>
33 /**
34 * \defgroup output Output
35 * \defgroup video_output Video output
36 * \ingroup output
37 * Video rendering, output and window management
39 * This module describes the programming interface for video output threads.
40 * It includes functions allowing to open a new thread, send pictures to a
41 * thread, and destroy a previously opened video output thread.
42 * @{
43 * \file
44 * Video output thread interface
47 /**
48 * Vout configuration
50 typedef struct {
51 vout_thread_t *vout;
52 vlc_object_t *input;
53 bool change_fmt;
54 const video_format_t *fmt;
55 unsigned dpb_size;
56 } vout_configuration_t;
58 /**
59 * Video output thread private structure
61 typedef struct vout_thread_sys_t vout_thread_sys_t;
63 /**
64 * Video output thread descriptor
66 * Any independent video output device, such as an X11 window or a GGI device,
67 * is represented by a video output thread, and described using the following
68 * structure.
70 struct vout_thread_t {
71 VLC_COMMON_MEMBERS
73 /* Private vout_thread data */
74 vout_thread_sys_t *p;
77 /* Alignment flags */
78 #define VOUT_ALIGN_LEFT 0x0001
79 #define VOUT_ALIGN_RIGHT 0x0002
80 #define VOUT_ALIGN_HMASK 0x0003
81 #define VOUT_ALIGN_TOP 0x0004
82 #define VOUT_ALIGN_BOTTOM 0x0008
83 #define VOUT_ALIGN_VMASK 0x000C
85 /**
86 * Viewpoints
88 struct vlc_viewpoint_t {
89 float yaw; /* yaw in degrees */
90 float pitch; /* pitch in degrees */
91 float roll; /* roll in degrees */
92 float fov; /* field of view in degrees */
95 static inline void vlc_viewpoint_init( vlc_viewpoint_t *p_vp )
97 p_vp->yaw = p_vp->pitch = p_vp->roll = 0.0f;
98 p_vp->fov = FIELD_OF_VIEW_DEGREES_DEFAULT;
101 /*****************************************************************************
102 * Prototypes
103 *****************************************************************************/
106 * Returns a suitable vout or release the given one.
108 * If cfg->fmt is non NULL and valid, a vout will be returned, reusing cfg->vout
109 * is possible, otherwise it returns NULL.
110 * If cfg->vout is not used, it will be closed and released.
112 * You can release the returned value either by vout_Request or vout_Close()
113 * followed by a vlc_object_release() or shorter vout_CloseAndRelease()
115 * \param object a vlc object
116 * \param cfg the video configuration requested.
117 * \return a vout
119 VLC_API vout_thread_t * vout_Request( vlc_object_t *object, const vout_configuration_t *cfg );
120 #define vout_Request(a,b) vout_Request(VLC_OBJECT(a),b)
123 * This function will close a vout created by vout_Request.
124 * The associated vout module is closed.
125 * Note: It is not released yet, you'll have to call vlc_object_release()
126 * or use the convenient vout_CloseAndRelease().
128 * \param p_vout the vout to close
130 VLC_API void vout_Close( vout_thread_t *p_vout );
133 * This function will close a vout created by vout_Create
134 * and then release it.
136 * \param p_vout the vout to close and release
138 static inline void vout_CloseAndRelease( vout_thread_t *p_vout )
140 vout_Close( p_vout );
141 vlc_object_release( p_vout );
145 * This function will handle a snapshot request.
147 * pp_image, pp_picture and p_fmt can be NULL otherwise they will be
148 * set with returned value in case of success.
150 * pp_image will hold an encoded picture in psz_format format.
152 * i_timeout specifies the time the function will wait for a snapshot to be
153 * available.
156 VLC_API int vout_GetSnapshot( vout_thread_t *p_vout,
157 block_t **pp_image, picture_t **pp_picture,
158 video_format_t *p_fmt,
159 const char *psz_format, mtime_t i_timeout );
161 VLC_API void vout_ChangeAspectRatio( vout_thread_t *p_vout,
162 unsigned int i_num, unsigned int i_den );
164 /* */
165 VLC_API picture_t * vout_GetPicture( vout_thread_t * );
166 VLC_API void vout_PutPicture( vout_thread_t *, picture_t * );
168 /* Subpictures channels ID */
169 #define VOUT_SPU_CHANNEL_OSD 1 /* OSD channel is automatically cleared */
170 #define VOUT_SPU_CHANNEL_AVAIL_FIRST 8 /* Registerable channels from this offset */
172 /* */
173 VLC_API void vout_PutSubpicture( vout_thread_t *, subpicture_t * );
174 VLC_API int vout_RegisterSubpictureChannel( vout_thread_t * );
175 VLC_API void vout_FlushSubpictureChannel( vout_thread_t *, int );
177 /**@}*/
179 #endif /* _VLC_VIDEO_H */