1 /*****************************************************************************
2 * vlc_video.h: common video definitions
3 *****************************************************************************
4 * Copyright (C) 1999 - 2008 the VideoLAN team
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
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.
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.
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 *****************************************************************************/
31 * This file defines common video output structures and functions in vlc
34 #include <vlc_picture.h>
35 #include <vlc_filter.h>
36 #include <vlc_subpicture.h>
39 * Video picture heap, either render (to store pictures used
40 * by the decoder) or output (to store pictures displayed by the vout plugin)
44 int i_pictures; /**< current heap size */
47 picture_t* pp_picture[VOUT_MAX_PICTURES]; /**< pictures */
48 int i_last_used_pic; /**< last used pic in heap */
51 /*****************************************************************************
53 *****************************************************************************/
56 * \defgroup video_output Video Output
57 * This module describes the programming interface for video output threads.
58 * It includes functions allowing to open a new thread, send pictures to a
59 * thread, and destroy a previously opened video output thread.
64 * Video ouput thread private structure
66 typedef struct vout_thread_sys_t vout_thread_sys_t;
69 * Video output thread descriptor
71 * Any independent video output device, such as an X11 window or a GGI device,
72 * is represented by a video output thread, and described using the following
79 video_format_t fmt_render; /* render format (from the decoder) */
80 video_format_t fmt_in; /* input (modified render) format */
81 video_format_t fmt_out; /* output format (for the video output) */
83 /* Private vout_thread data */
88 #define VOUT_ALIGN_LEFT 0x0001
89 #define VOUT_ALIGN_RIGHT 0x0002
90 #define VOUT_ALIGN_HMASK 0x0003
91 #define VOUT_ALIGN_TOP 0x0004
92 #define VOUT_ALIGN_BOTTOM 0x0008
93 #define VOUT_ALIGN_VMASK 0x000C
95 /* scaling factor (applied to i_zoom in vout_thread_t) */
96 #define ZOOM_FP_FACTOR 1000
98 /*****************************************************************************
100 *****************************************************************************/
104 * - returns a suitable vout (if requested by a non NULL p_fmt)
105 * - recycles an old vout (if given) by either destroying it or by saving it
108 * The purpose of this function is to avoid unnecessary creation/destruction of
109 * vout (and to allow optional vout reusing).
111 * You can call vout_Request on a vout created by vout_Create or by a previous
112 * call to vout_Request.
113 * You can release the returned value either by vout_Request or vout_Close()
114 * followed by a vlc_object_release() or shorter vout_CloseAndRelease()
116 * \param p_this a vlc object
117 * \param p_vout a vout candidate
118 * \param p_fmt the video format requested or NULL
119 * \return a vout if p_fmt is non NULL and the request is successfull, NULL
122 VLC_EXPORT( vout_thread_t *, vout_Request, ( vlc_object_t *p_this, vout_thread_t *p_vout, video_format_t *p_fmt ) );
123 #define vout_Request(a,b,c) vout_Request(VLC_OBJECT(a),b,c)
126 * This function will create a suitable vout for a given p_fmt. It will never
127 * reuse an already existing unused vout.
129 * You have to call either vout_Close or vout_Request on the returned value
130 * \param p_this a vlc object to which the returned vout will be attached
131 * \param p_fmt the video format requested
132 * \return a vout if the request is successfull, NULL otherwise
134 VLC_EXPORT( vout_thread_t *, vout_Create, ( vlc_object_t *p_this, video_format_t *p_fmt ) );
135 #define vout_Create(a,b) vout_Create(VLC_OBJECT(a),b)
138 * This function will close a vout created by vout_Create or vout_Request.
139 * The associated vout module is closed.
140 * Note: It is not released yet, you'll have to call vlc_object_release()
141 * or use the convenient vout_CloseAndRelease().
143 * \param p_vout the vout to close
145 VLC_EXPORT( void, vout_Close, ( vout_thread_t *p_vout ) );
148 * This function will close a vout created by vout_Create
149 * and then release it.
151 * \param p_vout the vout to close and release
153 static inline void vout_CloseAndRelease( vout_thread_t *p_vout )
155 vout_Close( p_vout );
156 vlc_object_release( p_vout );
160 * This function will handle a snapshot request.
162 * pp_image, pp_picture and p_fmt can be NULL otherwise they will be
163 * set with returned value in case of success.
165 * pp_image will hold an encoded picture in psz_format format.
167 * i_timeout specifies the time the function will wait for a snapshot to be
171 VLC_EXPORT( int, vout_GetSnapshot, ( vout_thread_t *p_vout,
172 block_t **pp_image, picture_t **pp_picture,
173 video_format_t *p_fmt,
174 const char *psz_format, mtime_t i_timeout ) );
177 VLC_EXPORT( picture_t *, vout_CreatePicture, ( vout_thread_t *, bool, bool, unsigned int ) );
178 VLC_EXPORT( void, vout_DestroyPicture, ( vout_thread_t *, picture_t * ) );
179 VLC_EXPORT( void, vout_DisplayPicture, ( vout_thread_t *, picture_t * ) );
180 VLC_EXPORT( void, vout_LinkPicture, ( vout_thread_t *, picture_t * ) );
181 VLC_EXPORT( void, vout_UnlinkPicture, ( vout_thread_t *, picture_t * ) );
184 * Return the spu_t object associated to a vout_thread_t.
186 * The return object is valid only as long as the vout is. You must not
187 * release the spu_t object returned.
188 * It cannot return NULL so no need to check.
190 VLC_EXPORT( spu_t *, vout_GetSpu, ( vout_thread_t * ) );
192 VLC_EXPORT( void, vout_EnableFilter, ( vout_thread_t *, const char *,bool , bool ) );
196 #endif /* _VLC_VIDEO_H */