00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef VLC_FILTER_H
00026 #define VLC_FILTER_H 1
00027
00028 #include <vlc_es.h>
00029 #include <vlc_picture.h>
00030 #include <vlc_subpicture.h>
00031 #include <vlc_mouse.h>
00032
00033
00034
00035
00036
00037
00038 typedef struct filter_owner_sys_t filter_owner_sys_t;
00039
00040
00041
00042
00043
00044
00045 struct filter_t
00046 {
00047 VLC_COMMON_MEMBERS
00048
00049
00050 module_t * p_module;
00051 filter_sys_t * p_sys;
00052
00053
00054 es_format_t fmt_in;
00055
00056
00057 es_format_t fmt_out;
00058 bool b_allow_fmt_out_change;
00059
00060
00061 config_chain_t * p_cfg;
00062
00063 union
00064 {
00065 struct
00066 {
00067 picture_t * (*pf_filter) ( filter_t *, picture_t * );
00068 void (*pf_flush)( filter_t * );
00069 picture_t * (*pf_buffer_new) ( filter_t * );
00070 void (*pf_buffer_del) ( filter_t *, picture_t * );
00071
00072
00073
00074
00075
00076
00077
00078
00079 int (*pf_mouse)( filter_t *, vlc_mouse_t *,
00080 const vlc_mouse_t *p_old,
00081 const vlc_mouse_t *p_new );
00082 } video;
00083 #define pf_video_filter u.video.pf_filter
00084 #define pf_video_flush u.video.pf_flush
00085 #define pf_video_mouse u.video.pf_mouse
00086 #define pf_video_buffer_new u.video.pf_buffer_new
00087 #define pf_video_buffer_del u.video.pf_buffer_del
00088
00089 struct
00090 {
00091 block_t * (*pf_filter) ( filter_t *, block_t * );
00092 } audio;
00093 #define pf_audio_filter u.audio.pf_filter
00094
00095 struct
00096 {
00097 void (*pf_blend) ( filter_t *, picture_t *,
00098 const picture_t *, int, int, int );
00099 } blend;
00100 #define pf_video_blend u.blend.pf_blend
00101
00102 struct
00103 {
00104 subpicture_t * (*pf_source) ( filter_t *, mtime_t );
00105 subpicture_t * (*pf_buffer_new)( filter_t * );
00106 void (*pf_buffer_del)( filter_t *, subpicture_t * );
00107 int (*pf_mouse) ( filter_t *,
00108 const vlc_mouse_t *p_old,
00109 const vlc_mouse_t *p_new,
00110 const video_format_t * );
00111 } sub;
00112 #define pf_sub_source u.sub.pf_source
00113 #define pf_sub_buffer_new u.sub.pf_buffer_new
00114 #define pf_sub_buffer_del u.sub.pf_buffer_del
00115 #define pf_sub_mouse u.sub.pf_mouse
00116
00117 struct
00118 {
00119 subpicture_t * (*pf_filter) ( filter_t *, subpicture_t * );
00120 } subf;
00121 #define pf_sub_filter u.subf.pf_filter
00122
00123 struct
00124 {
00125 int (*pf_text) ( filter_t *, subpicture_region_t *,
00126 subpicture_region_t *,
00127 const vlc_fourcc_t * );
00128 int (*pf_html) ( filter_t *, subpicture_region_t *,
00129 subpicture_region_t *,
00130 const vlc_fourcc_t * );
00131 } render;
00132 #define pf_render_text u.render.pf_text
00133 #define pf_render_html u.render.pf_html
00134
00135 } u;
00136
00137
00138
00139 int (*pf_get_attachments)( filter_t *, input_attachment_t ***, int * );
00140
00141
00142 filter_owner_sys_t *p_owner;
00143 };
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154 static inline picture_t *filter_NewPicture( filter_t *p_filter )
00155 {
00156 picture_t *p_picture = p_filter->pf_video_buffer_new( p_filter );
00157 if( !p_picture )
00158 msg_Warn( p_filter, "can't get output picture" );
00159 return p_picture;
00160 }
00161
00162
00163
00164
00165
00166
00167
00168
00169 static inline void filter_DeletePicture( filter_t *p_filter, picture_t *p_picture )
00170 {
00171 p_filter->pf_video_buffer_del( p_filter, p_picture );
00172 }
00173
00174
00175
00176
00177 static inline void filter_FlushPictures( filter_t *p_filter )
00178 {
00179 if( p_filter->pf_video_flush )
00180 p_filter->pf_video_flush( p_filter );
00181 }
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 static inline subpicture_t *filter_NewSubpicture( filter_t *p_filter )
00193 {
00194 subpicture_t *p_subpicture = p_filter->pf_sub_buffer_new( p_filter );
00195 if( !p_subpicture )
00196 msg_Warn( p_filter, "can't get output subpicture" );
00197 return p_subpicture;
00198 }
00199
00200
00201
00202
00203
00204
00205
00206
00207 static inline void filter_DeleteSubpicture( filter_t *p_filter, subpicture_t *p_subpicture )
00208 {
00209 p_filter->pf_sub_buffer_del( p_filter, p_subpicture );
00210 }
00211
00212 #define filter_NewAudioBuffer block_New
00213
00214
00215
00216
00217
00218
00219 static inline int filter_GetInputAttachments( filter_t *p_filter,
00220 input_attachment_t ***ppp_attachment,
00221 int *pi_attachment )
00222 {
00223 if( !p_filter->pf_get_attachments )
00224 return VLC_EGENERIC;
00225 return p_filter->pf_get_attachments( p_filter,
00226 ppp_attachment, pi_attachment );
00227 }
00228
00229
00230
00231
00232
00233
00234
00235 VLC_API filter_t * filter_NewBlend( vlc_object_t *, const video_format_t *p_dst_chroma ) VLC_USED;
00236
00237
00238
00239
00240
00241 VLC_API int filter_ConfigureBlend( filter_t *, int i_dst_width, int i_dst_height, const video_format_t *p_src );
00242
00243
00244
00245
00246
00247
00248 VLC_API int filter_Blend( filter_t *, picture_t *p_dst, int i_dst_x, int i_dst_y, const picture_t *p_src, int i_alpha );
00249
00250
00251
00252
00253 VLC_API void filter_DeleteBlend( filter_t * );
00254
00255
00256
00257
00258
00259
00260
00261 #define VIDEO_FILTER_WRAPPER( name ) \
00262 static picture_t *name ## _Filter ( filter_t *p_filter, \
00263 picture_t *p_pic ) \
00264 { \
00265 picture_t *p_outpic = filter_NewPicture( p_filter ); \
00266 if( p_outpic ) \
00267 { \
00268 name( p_filter, p_pic, p_outpic ); \
00269 picture_CopyProperties( p_outpic, p_pic ); \
00270 } \
00271 picture_Release( p_pic ); \
00272 return p_outpic; \
00273 }
00274
00275
00276
00277
00278
00279
00280
00281 typedef struct filter_chain_t filter_chain_t;
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294 VLC_API filter_chain_t * filter_chain_New( vlc_object_t *, const char *, bool, int (*)( filter_t *, void * ), void (*)( filter_t * ), void * ) VLC_USED;
00295 #define filter_chain_New( a, b, c, d, e, f ) filter_chain_New( VLC_OBJECT( a ), b, c, d, e, f )
00296
00297
00298
00299
00300
00301
00302
00303 VLC_API void filter_chain_Delete( filter_chain_t * );
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313 VLC_API void filter_chain_Reset( filter_chain_t *, const es_format_t *, const es_format_t * );
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325 VLC_API filter_t * filter_chain_AppendFilter( filter_chain_t *, const char *, config_chain_t *, const es_format_t *, const es_format_t * );
00326
00327
00328
00329
00330
00331
00332
00333
00334 VLC_API int filter_chain_AppendFromString( filter_chain_t *, const char * );
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345 VLC_API int filter_chain_DeleteFilter( filter_chain_t *, filter_t * );
00346
00347
00348
00349
00350
00351
00352
00353 VLC_API int filter_chain_GetLength( filter_chain_t * );
00354
00355
00356
00357
00358
00359
00360
00361 VLC_API const es_format_t * filter_chain_GetFmtOut( filter_chain_t * );
00362
00363
00364
00365
00366
00367
00368
00369
00370 VLC_API picture_t * filter_chain_VideoFilter( filter_chain_t *, picture_t * );
00371
00372
00373
00374
00375 VLC_API void filter_chain_VideoFlush( filter_chain_t * );
00376
00377
00378
00379
00380
00381
00382
00383
00384 VLC_API block_t * filter_chain_AudioFilter( filter_chain_t *, block_t * );
00385
00386
00387
00388
00389
00390
00391
00392 VLC_API void filter_chain_SubSource( filter_chain_t *, mtime_t );
00393
00394
00395
00396
00397
00398
00399
00400
00401 VLC_API subpicture_t * filter_chain_SubFilter( filter_chain_t *, subpicture_t * );
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411 VLC_API int filter_chain_MouseFilter( filter_chain_t *, vlc_mouse_t *, const vlc_mouse_t * );
00412
00413
00414
00415
00416
00417
00418 VLC_API int filter_chain_MouseEvent( filter_chain_t *, const vlc_mouse_t *, const video_format_t * );
00419
00420 #endif
00421