1 /*****************************************************************************
2 * vlc_spu.h : subpicture unit
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 the VideoLAN team
7 * Authors: Gildas Bazin <gbazin@videolan.org>
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.
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.
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 *****************************************************************************/
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.
33 * Subpicture unit descriptor
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 */
43 filter_t *p_blend; /**< alpha blending module */
44 filter_t *p_text; /**< text renderer module */
45 filter_t *p_scale; /**< scaling module */
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 */
50 int i_margin; /**< force position of a subpicture */
51 vlc_bool_t b_force_palette; /**< force palette of subpicture */
52 uint8_t palette[4][4]; /**< forced palette */
54 int ( *pf_control ) ( spu_t *, int, va_list );
56 /* Supciture filters */
57 filter_t *pp_filter[10];
61 static inline int spu_vaControl( spu_t *p_spu, int i_query, va_list args )
63 if( p_spu->pf_control )
64 return p_spu->pf_control( p_spu, i_query, args );
69 static inline int spu_Control( spu_t *p_spu, int i_query, ... )
74 va_start( args, i_query );
75 i_result = spu_vaControl( p_spu, i_query, args );
82 SPU_CHANNEL_REGISTER, /* arg1= int * res= */
83 SPU_CHANNEL_CLEAR /* arg1= int res= */
87 * \addtogroup subpicture
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 );
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 * ) );
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_MakeRegion(a,b,c) __spu_MakeRegion(VLC_OBJECT(a),b,c)
103 VLC_EXPORT( subpicture_region_t *,__spu_MakeRegion, ( vlc_object_t *, video_format_t *, picture_t * ) );
104 #define spu_DestroyRegion(a,b) __spu_DestroyRegion(VLC_OBJECT(a),b)
105 VLC_EXPORT( void, __spu_DestroyRegion, ( vlc_object_t *, subpicture_region_t * ) );
107 VLC_EXPORT( subpicture_t *, spu_SortSubpictures, ( spu_t *, mtime_t ) );
108 VLC_EXPORT( void, spu_RenderSubpictures, ( spu_t *, video_format_t *, picture_t *, picture_t *, subpicture_t *, int, int ) );