]> git.sesse.net Git - vlc/blob - include/vlc_spu.h
* ../include/vlc_spu.h: fixed typo that was triggering a segfault with --enable-memor...
[vlc] / include / vlc_spu.h
1 /*****************************************************************************
2  * vlc_spu.h : subpicture unit
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /**
25  * \defgroup spu Subpicture Unit
26  * This module describes the programming interface for the subpicture unit.
27  * It includes functions allowing to create/destroy an spu, create/destroy
28  * subpictures and render them.
29  * @{
30  */
31
32 /**
33  * Subpicture unit descriptor
34  */
35 struct spu_t
36 {
37     VLC_COMMON_MEMBERS
38
39     vlc_mutex_t  subpicture_lock;                  /**< subpicture heap lock */
40     subpicture_t p_subpicture[VOUT_MAX_SUBPICTURES];        /**< subpictures */
41     int i_channel;             /**< number of subpicture channels registered */
42
43     filter_t *p_blend;                            /**< alpha blending module */
44     filter_t *p_text;                              /**< text renderer module */
45     filter_t *p_scale;                                   /**< scaling module */
46
47     vlc_bool_t b_force_crop;               /**< force cropping of subpicture */
48     int i_crop_x, i_crop_y, i_crop_width, i_crop_height;       /**< cropping */
49
50     int i_margin;                        /**< force position of a subpicture */
51     vlc_bool_t b_force_alpha;         /**< force alpha palette of subpicture */
52     uint8_t pi_alpha[4];                           /**< forced alpha palette */
53
54     int ( *pf_control ) ( spu_t *, int, va_list );
55
56     /* Supciture filters */
57     filter_t *pp_filter[10];
58     int      i_filter;
59 };
60
61 static inline int spu_vaControl( spu_t *p_spu, int i_query, va_list args )
62 {
63     if( p_spu->pf_control )
64         return p_spu->pf_control( p_spu, i_query, args );
65     else
66         return VLC_EGENERIC;
67 }
68
69 static inline int spu_Control( spu_t *p_spu, int i_query, ... )
70 {
71     va_list args;
72     int i_result;
73
74     va_start( args, i_query );
75     i_result = spu_vaControl( p_spu, i_query, args );
76     va_end( args );
77     return i_result;
78 }
79
80 enum spu_query_e
81 {
82     SPU_CHANNEL_REGISTER,         /* arg1= int *   res=    */
83     SPU_CHANNEL_CLEAR             /* arg1= int     res=    */
84 };
85
86 /**
87  * \addtogroup subpicture
88  * @{
89  */
90 #define spu_Create(a) __spu_Create(VLC_OBJECT(a))
91 VLC_EXPORT( spu_t *, __spu_Create, ( vlc_object_t * ) );
92 VLC_EXPORT( int, spu_Init, ( spu_t * ) );
93 VLC_EXPORT( void, spu_Destroy, ( spu_t * ) );
94 void spu_Attach( spu_t *, vlc_object_t *, vlc_bool_t );
95
96 VLC_EXPORT( subpicture_t *, spu_CreateSubpicture, ( spu_t * ) );
97 VLC_EXPORT( void, spu_DestroySubpicture, ( spu_t *, subpicture_t * ) );
98 VLC_EXPORT( void, spu_DisplaySubpicture, ( spu_t *, subpicture_t * ) );
99
100 #define spu_CreateRegion(a,b) __spu_CreateRegion(VLC_OBJECT(a),b)
101 VLC_EXPORT( subpicture_region_t *,__spu_CreateRegion, ( vlc_object_t *, video_format_t * ) );
102 #define spu_DestroyRegion(a,b) __spu_DestroyRegion(VLC_OBJECT(a),b)
103 VLC_EXPORT( void, __spu_DestroyRegion, ( vlc_object_t *, subpicture_region_t * ) );
104
105 VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t ) );
106 VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *,  video_format_t *, picture_t *, picture_t *, subpicture_t *, int, int ) );
107
108 /** @}*/
109 /**
110  * @}
111  */