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.
99
* \param p_filter filter_t object
100
* \return new picture on success or NULL on failure
102
static inline picture_t *filter_NewPicture( filter_t *p_filter )
104
picture_t *p_picture = p_filter->pf_vout_buffer_new( p_filter );
106
msg_Warn( p_filter, "can't get output picture" );
111
* This function will release a picture create by filter_NewPicture.
112
* Provided for convenience.
114
* \param p_filter filter_t object
115
* \param p_picture picture to be deleted
117
static inline void filter_DeletePicture( filter_t *p_filter, picture_t *p_picture )
119
p_filter->pf_vout_buffer_del( p_filter, p_picture );
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.
128
* \param p_filter filter_t object
129
* \return new subpicture
131
static inline subpicture_t *filter_NewSubpicture( filter_t *p_filter )
133
subpicture_t *p_subpicture = p_filter->pf_sub_buffer_new( p_filter );
135
msg_Warn( p_filter, "can't get output subpicture" );
140
* This function will release a subpicture create by filter_NewSubicture.
141
* Provided for convenience.
143
* \param p_filter filter_t object
144
* \param p_subpicture to be released
146
static inline void filter_DeleteSubpicture( filter_t *p_filter, subpicture_t *p_subpicture )
148
p_filter->pf_sub_buffer_del( p_filter, p_subpicture );
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.
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
161
static inline block_t *filter_NewAudioBuffer( filter_t *p_filter, int i_size )
163
block_t *p_block = p_filter->pf_audio_buffer_new( p_filter, i_size );
165
msg_Warn( p_filter, "can't get output block" );
170
* Create a picture_t *(*)( filter_t *, picture_t * ) compatible wrapper
171
* using a void (*)( filter_t *, picture_t *, picture_t * ) function
173
* Currently used by the chroma video filters
175
#define VIDEO_FILTER_WRAPPER( name ) \
176
static picture_t *name ## _Filter ( filter_t *p_filter, \
179
picture_t *p_outpic = filter_NewPicture( p_filter ); \
182
picture_Release( p_pic ); \
186
name( p_filter, p_pic, p_outpic ); \
188
picture_CopyProperties( p_outpic, p_pic ); \
189
picture_Release( p_pic ); \
195
* Filter chain management API
196
* The filter chain management API is used to dynamically construct filters
197
* and add them in a chain.
200
typedef struct filter_chain_t filter_chain_t;
203
* Create new filter chain
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
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 )
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.
220
* \param p_chain pointer to filter chain
222
VLC_EXPORT( void, filter_chain_Delete, ( filter_chain_t * ) );
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.
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
232
VLC_EXPORT( void, filter_chain_Reset, ( filter_chain_t *, const es_format_t *, const es_format_t * ) );
235
* Append filter to the end of the chain.
237
* \param p_chain pointer to filter chain
238
* \param psz_name name of filter
240
* \param p_fmt_in input es_format_t
241
* \param p_fmt_out output es_format_t
242
* \return pointer to filter chain
244
VLC_EXPORT( filter_t *, filter_chain_AppendFilter, ( filter_chain_t *, const char *, config_chain_t *, const es_format_t *, const es_format_t * ) );
247
* Append new filter to filter chain from string.
249
* \param p_chain pointer to filter chain
250
* \param psz_string string of filters
251
* \return 0 for success
253
VLC_EXPORT( int, filter_chain_AppendFromString, ( filter_chain_t *, const char * ) );
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.
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
264
VLC_EXPORT( int, filter_chain_DeleteFilter, ( filter_chain_t *, filter_t * ) );
267
* Get filter by name of position in the filter chain.
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
274
VLC_EXPORT( filter_t *, filter_chain_GetFilter, ( filter_chain_t *, int, const char * ) );
277
* Get the number of filters in the filter chain.
279
* \param p_chain pointer to filter chain
280
* \return number of filters in this filter chain
282
VLC_EXPORT( int, filter_chain_GetLength, ( filter_chain_t * ) );
285
* Get last p_fmt_out in the chain.
287
* \param p_chain pointer to filter chain
288
* \return last p_fmt (es_format_t) of this filter chain
290
VLC_EXPORT( const es_format_t *, filter_chain_GetFmtOut, ( filter_chain_t * ) );
293
* Apply the filter chain to a video picture.
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
299
VLC_EXPORT( picture_t *, filter_chain_VideoFilter, ( filter_chain_t *, picture_t * ) );
302
* Apply the filter chain to a audio block.
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
308
VLC_EXPORT( block_t *, filter_chain_AudioFilter, ( filter_chain_t *, block_t * ) );
311
* Apply filter chain to subpictures.
313
* \param p_chain pointer to filter chain
314
* \param display_date of subpictures
316
VLC_EXPORT( void, filter_chain_SubFilter, ( filter_chain_t *, mtime_t ) );
97
318
#endif /* _VLC_FILTER_H */