~ubuntu-branches/ubuntu/maverick/vlc/maverick

« back to all changes in this revision

Viewing changes to include/vlc_filter.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-09-17 21:56:14 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20080917215614-tj0vx8xzd57e52t8
Tags: 0.9.2-1ubuntu1
* New Upstream Release, exception granted by
    - dktrkranz, norsetto, Hobbsee (via irc). LP: #270404

Changes done in ubuntu:

* add libxul-dev to build-depends
* make sure that vlc is build against libxul in configure. This doesn't
  change anything in the package, but makes it more robust if building
  in an 'unclean' chroot or when modifying the package.
* debian/control: make Vcs-* fields point to the motumedia branch
* add libx264-dev and libass-dev to build-depends
  LP: #210354, #199870
* actually enable libass support by passing --enable-libass to configure
* enable libdca: add libdca-dev to build depends and --enable-libdca
* install the x264 plugin.

Changes already in the pkg-multimedia branch in debian:

* don't install usr/share/vlc/mozilla in debian/mozilla-plugin-vlc.install  
* new upstream .desktop file now registers flash video mimetype LP: #261567
* add Xb-Npp-Applications to mozilla-plugin-vlc
* remove duplicate entries in debian/vlc-nox.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
 
 * vlc_filter.h: filter related structures
 
2
 * vlc_filter.h: filter related structures and functions
3
3
 *****************************************************************************
4
 
 * Copyright (C) 1999-2003 the VideoLAN team
5
 
 * $Id: 656f15954779cdec3bc04cb1ccab85aaa65dbbc3 $
 
4
 * Copyright (C) 1999-2008 the VideoLAN team
 
5
 * $Id: 88e7c94a5c293077ec9985d67e60ca9eec5b6b29 $
6
6
 *
7
7
 * Authors: Gildas Bazin <gbazin@videolan.org>
 
8
 *          Antoine Cellerier <dionoea at videolan dot org>
8
9
 *
9
10
 * This program is free software; you can redistribute it and/or modify
10
11
 * it under the terms of the GNU General Public License as published by
20
21
 * along with this program; if not, write to the Free Software
21
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22
23
 *****************************************************************************/
23
 
#ifndef _VLC_FILTER_H
24
 
#define _VLC_FILTER_H 1
 
24
 
 
25
#ifndef VLC_FILTER_H
 
26
#define VLC_FILTER_H 1
 
27
 
 
28
#include <vlc_es.h>
25
29
 
26
30
/**
27
31
 * \file
30
34
 
31
35
typedef struct filter_owner_sys_t filter_owner_sys_t;
32
36
 
33
 
/**
34
 
 * \defgroup filter Filter
35
 
 *
36
 
 * The structure describing a filter
37
 
 *
38
 
 * @{
39
 
 */
40
 
 
41
 
/*
42
 
 * BIG FAT WARNING : the code relies in the first 4 members of filter_t
43
 
 * and decoder_t to be the same, so if you have anything to add, do it
44
 
 * at the end of the structure.
 
37
/** Structure describing a filter
 
38
 * @warning BIG FAT WARNING : the code relies on the first 4 members of
 
39
 * filter_t and decoder_t to be the same, so if you have anything to add,
 
40
 * do it at the end of the structure.
45
41
 */
46
42
struct filter_t
47
43
{
56
52
 
57
53
    /* Output format of filter */
58
54
    es_format_t         fmt_out;
 
55
    bool                b_allow_fmt_out_change;
59
56
 
60
57
    /* Filter configuration */
61
 
    sout_cfg_t *        p_cfg;
 
58
    config_chain_t *    p_cfg;
62
59
 
63
60
    picture_t *         ( * pf_video_filter ) ( filter_t *, picture_t * );
64
61
    block_t *           ( * pf_audio_filter ) ( filter_t *, block_t * );
67
64
                                                int, int, int );
68
65
 
69
66
    subpicture_t *      ( *pf_sub_filter ) ( filter_t *, mtime_t );
70
 
    int                 ( *pf_render_text ) ( filter_t *, subpicture_region_t *, subpicture_region_t * );
 
67
    int                 ( *pf_render_text ) ( filter_t *, subpicture_region_t *,
 
68
                                              subpicture_region_t * );
 
69
    int                 ( *pf_render_html ) ( filter_t *, subpicture_region_t *,
 
70
                                              subpicture_region_t * );
71
71
 
72
72
    /*
73
73
     * Buffers allocation
79
79
    /* Video output callbacks */
80
80
    picture_t     * ( * pf_vout_buffer_new) ( filter_t * );
81
81
    void            ( * pf_vout_buffer_del) ( filter_t *, picture_t * );
82
 
    void            ( * pf_picture_link)    ( filter_t *, picture_t * );
83
 
    void            ( * pf_picture_unlink)  ( filter_t *, picture_t * );
 
82
    /* void            ( * pf_picture_link)    ( picture_t * );
 
83
    void            ( * pf_picture_unlink)  ( picture_t * ); */
84
84
 
85
85
    /* SPU output callbacks */
86
86
    subpicture_t *  ( * pf_sub_buffer_new) ( filter_t * );
91
91
};
92
92
 
93
93
/**
94
 
 * @}
95
 
 */
 
94
 * This function will return a new picture usable by p_filter as an output
 
95
 * buffer. You have to release it using filter_DeletePicture or by returning
 
96
 * it to the caller as a pf_video_filter return value.
 
97
 * Provided for convenience.
 
98
 *
 
99
 * \param p_filter filter_t object
 
100
 * \return new picture on success or NULL on failure
 
101
 */
 
102
static inline picture_t *filter_NewPicture( filter_t *p_filter )
 
103
{
 
104
    picture_t *p_picture = p_filter->pf_vout_buffer_new( p_filter );
 
105
    if( !p_picture )
 
106
        msg_Warn( p_filter, "can't get output picture" );
 
107
    return p_picture;
 
108
}
 
109
 
 
110
/**
 
111
 * This function will release a picture create by filter_NewPicture.
 
112
 * Provided for convenience.
 
113
 *
 
114
 * \param p_filter filter_t object
 
115
 * \param p_picture picture to be deleted
 
116
 */
 
117
static inline void filter_DeletePicture( filter_t *p_filter, picture_t *p_picture )
 
118
{
 
119
    p_filter->pf_vout_buffer_del( p_filter, p_picture );
 
120
}
 
121
 
 
122
/**
 
123
 * This function will return a new subpicture usable by p_filter as an output
 
124
 * buffer. You have to release it using filter_DeleteSubpicture or by returning
 
125
 * it to the caller as a pf_sub_filter return value.
 
126
 * Provided for convenience.
 
127
 *
 
128
 * \param p_filter filter_t object
 
129
 * \return new subpicture
 
130
 */
 
131
static inline subpicture_t *filter_NewSubpicture( filter_t *p_filter )
 
132
{
 
133
    subpicture_t *p_subpicture = p_filter->pf_sub_buffer_new( p_filter );
 
134
    if( !p_subpicture )
 
135
        msg_Warn( p_filter, "can't get output subpicture" );
 
136
    return p_subpicture;
 
137
}
 
138
 
 
139
/**
 
140
 * This function will release a subpicture create by filter_NewSubicture.
 
141
 * Provided for convenience.
 
142
 *
 
143
 * \param p_filter filter_t object
 
144
 * \param p_subpicture to be released
 
145
 */
 
146
static inline void filter_DeleteSubpicture( filter_t *p_filter, subpicture_t *p_subpicture )
 
147
{
 
148
    p_filter->pf_sub_buffer_del( p_filter, p_subpicture );
 
149
}
 
150
 
 
151
/**
 
152
 * This function will return a new audio buffer usable by p_filter as an
 
153
 * output buffer. You have to release it using block_Release or by returning
 
154
 * it to the caller as a pf_audio_filter return value.
 
155
 * Provided for convenience.
 
156
 *
 
157
 * \param p_filter filter_t object
 
158
 * \param i_size size of audio buffer requested
 
159
 * \return block to be used as audio output buffer
 
160
 */
 
161
static inline block_t *filter_NewAudioBuffer( filter_t *p_filter, int i_size )
 
162
{
 
163
    block_t *p_block = p_filter->pf_audio_buffer_new( p_filter, i_size );
 
164
    if( !p_block )
 
165
        msg_Warn( p_filter, "can't get output block" );
 
166
    return p_block;
 
167
}
 
168
 
 
169
/**
 
170
 * Create a picture_t *(*)( filter_t *, picture_t * ) compatible wrapper
 
171
 * using a void (*)( filter_t *, picture_t *, picture_t * ) function
 
172
 *
 
173
 * Currently used by the chroma video filters
 
174
 */
 
175
#define VIDEO_FILTER_WRAPPER( name )                                    \
 
176
    static picture_t *name ## _Filter ( filter_t *p_filter,             \
 
177
                                        picture_t *p_pic )              \
 
178
    {                                                                   \
 
179
        picture_t *p_outpic = filter_NewPicture( p_filter );            \
 
180
        if( !p_outpic )                                                 \
 
181
        {                                                               \
 
182
            picture_Release( p_pic );                                   \
 
183
            return NULL;                                                \
 
184
        }                                                               \
 
185
                                                                        \
 
186
        name( p_filter, p_pic, p_outpic );                              \
 
187
                                                                        \
 
188
        picture_CopyProperties( p_outpic, p_pic );                      \
 
189
        picture_Release( p_pic );                                       \
 
190
                                                                        \
 
191
        return p_outpic;                                                \
 
192
    }
 
193
 
 
194
/**
 
195
 * Filter chain management API
 
196
 * The filter chain management API is used to dynamically construct filters
 
197
 * and add them in a chain.
 
198
 */
 
199
 
 
200
typedef struct filter_chain_t filter_chain_t;
 
201
 
 
202
/**
 
203
 * Create new filter chain
 
204
 *
 
205
 * \param p_object pointer to a vlc object
 
206
 * \param psz_capability vlc capability of filters in filter chain
 
207
 * \param b_allow_format_fmt_change allow changing of fmt
 
208
 * \param pf_buffer_allocation_init callback function to initialize buffer allocations
 
209
 * \param pf_buffer_allocation_clear callback function to clear buffer allocation initialization
 
210
 * \param p_buffer_allocation_data pointer to private allocation data
 
211
 * \return pointer to a filter chain
 
212
 */
 
213
VLC_EXPORT( filter_chain_t *, __filter_chain_New, ( vlc_object_t *, const char *, bool, int (*)( filter_t *, void * ), void (*)( filter_t * ), void *  ) );
 
214
#define filter_chain_New( a, b, c, d, e, f ) __filter_chain_New( VLC_OBJECT( a ), b, c, d, e, f )
 
215
 
 
216
/**
 
217
 * Delete filter chain will delete all filters in the chain and free all
 
218
 * allocated data. The pointer to the filter chain is then no longer valid.
 
219
 *
 
220
 * \param p_chain pointer to filter chain
 
221
 */
 
222
VLC_EXPORT( void, filter_chain_Delete, ( filter_chain_t * ) );
 
223
 
 
224
/**
 
225
 * Reset filter chain will delete all filters in the chain and
 
226
 * reset p_fmt_in and p_fmt_out to the new values.
 
227
 *
 
228
 * \param p_chain pointer to filter chain
 
229
 * \param p_fmt_in new fmt_in params
 
230
 * \param p_fmt_out new fmt_out params
 
231
 */
 
232
VLC_EXPORT( void, filter_chain_Reset, ( filter_chain_t *, const es_format_t *, const es_format_t * ) );
 
233
 
 
234
/**
 
235
 * Append filter to the end of the chain.
 
236
 *
 
237
 * \param p_chain pointer to filter chain
 
238
 * \param psz_name name of filter
 
239
 * \param p_cfg
 
240
 * \param p_fmt_in input es_format_t
 
241
 * \param p_fmt_out output es_format_t
 
242
 * \return pointer to filter chain
 
243
 */
 
244
VLC_EXPORT( filter_t *, filter_chain_AppendFilter, ( filter_chain_t *, const char *, config_chain_t *, const es_format_t *, const es_format_t * ) );
 
245
 
 
246
/**
 
247
 * Append new filter to filter chain from string.
 
248
 *
 
249
 * \param p_chain pointer to filter chain
 
250
 * \param psz_string string of filters
 
251
 * \return 0 for success
 
252
 */
 
253
VLC_EXPORT( int, filter_chain_AppendFromString, ( filter_chain_t *, const char * ) );
 
254
 
 
255
/**
 
256
 * Delete filter from filter chain. This function also releases the filter
 
257
 * object and unloads the filter modules. The pointer to p_filter is no
 
258
 * longer valid after this function successfully returns.
 
259
 *
 
260
 * \param p_chain pointer to filter chain
 
261
 * \param p_filter pointer to filter object
 
262
 * \return VLC_SUCCESS on succes, else VLC_EGENERIC
 
263
 */
 
264
VLC_EXPORT( int, filter_chain_DeleteFilter, ( filter_chain_t *, filter_t * ) );
 
265
 
 
266
/**
 
267
 * Get filter by name of position in the filter chain.
 
268
 *
 
269
 * \param p_chain pointer to filter chain
 
270
 * \param i_position position of filter in filter chain
 
271
 * \param psz_name name of filter to get
 
272
 * \return filter object based on position or name provided
 
273
 */
 
274
VLC_EXPORT( filter_t *, filter_chain_GetFilter, ( filter_chain_t *, int, const char * ) );
 
275
 
 
276
/**
 
277
 * Get the number of filters in the filter chain.
 
278
 *
 
279
 * \param p_chain pointer to filter chain
 
280
 * \return number of filters in this filter chain
 
281
 */
 
282
VLC_EXPORT( int, filter_chain_GetLength, ( filter_chain_t * ) );
 
283
 
 
284
/**
 
285
 * Get last p_fmt_out in the chain.
 
286
 *
 
287
 * \param p_chain pointer to filter chain
 
288
 * \return last p_fmt (es_format_t) of this filter chain
 
289
 */
 
290
VLC_EXPORT( const es_format_t *, filter_chain_GetFmtOut, ( filter_chain_t * ) );
 
291
 
 
292
/**
 
293
 * Apply the filter chain to a video picture.
 
294
 *
 
295
 * \param p_chain pointer to filter chain
 
296
 * \param p_picture picture to apply filters on
 
297
 * \return modified picture after applying all video filters
 
298
 */
 
299
VLC_EXPORT( picture_t *, filter_chain_VideoFilter, ( filter_chain_t *, picture_t * ) );
 
300
 
 
301
/**
 
302
 * Apply the filter chain to a audio block.
 
303
 *
 
304
 * \param p_chain pointer to filter chain
 
305
 * \param p_block audio frame to apply filters on
 
306
 * \return modified audio frame after applying all audio filters
 
307
 */
 
308
VLC_EXPORT( block_t *, filter_chain_AudioFilter, ( filter_chain_t *, block_t * ) );
 
309
 
 
310
/**
 
311
 * Apply filter chain to subpictures.
 
312
 *
 
313
 * \param p_chain pointer to filter chain
 
314
 * \param display_date of subpictures
 
315
 */
 
316
VLC_EXPORT( void, filter_chain_SubFilter, ( filter_chain_t *, mtime_t ) );
96
317
 
97
318
#endif /* _VLC_FILTER_H */
 
319