1 /**
2  * \file mlt_filter.h
3  * \brief abstraction for all filter services
4  * \see mlt_filter_s
5  *
6  * Copyright (C) 2003-2014 Meltytech, LLC
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22 
23 #ifndef MLT_FILTER_H
24 #define MLT_FILTER_H
25 
26 #include "mlt_service.h"
27 
28 /** \brief Filter abstract service class
29  *
30  * A filter is a service that may modify the output of a single producer.
31  *
32  * \extends mlt_service_s
33  * \properties \em track the index of the track of a multitrack on which the filter is applied
34  * \properties \em service a reference to the service to which this filter is attached.
35  * \properties \em disable Set this to disable the filter while keeping it in the object model.
36  * Currently this is not cleared when the filter is detached.
37  */
38 
39 struct mlt_filter_s
40 {
41 	/** We're implementing service here */
42 	struct mlt_service_s parent;
43 
44 	/** public virtual */
45 	void ( *close )( mlt_filter );
46 
47 	/** protected filter method */
48 	mlt_frame ( *process )( mlt_filter, mlt_frame );
49 
50 	/** Protected */
51 	void *child;
52 };
53 
54 #define MLT_FILTER_SERVICE( filter )		( &( filter )->parent )
55 #define MLT_FILTER_PROPERTIES( filter )		MLT_SERVICE_PROPERTIES( MLT_FILTER_SERVICE( filter ) )
56 
57 extern int mlt_filter_init( mlt_filter self, void *child );
58 extern mlt_filter mlt_filter_new( );
59 extern mlt_service mlt_filter_service( mlt_filter self );
60 extern mlt_properties mlt_filter_properties( mlt_filter self );
61 extern mlt_frame mlt_filter_process( mlt_filter self, mlt_frame that );
62 extern int mlt_filter_connect( mlt_filter self, mlt_service producer, int index );
63 extern void mlt_filter_set_in_and_out( mlt_filter self, mlt_position in, mlt_position out );
64 extern int mlt_filter_get_track( mlt_filter self );
65 extern mlt_position mlt_filter_get_in( mlt_filter self );
66 extern mlt_position mlt_filter_get_out( mlt_filter self );
67 extern mlt_position mlt_filter_get_length( mlt_filter self );
68 extern mlt_position mlt_filter_get_length2( mlt_filter self, mlt_frame frame );
69 extern mlt_position mlt_filter_get_position( mlt_filter self, mlt_frame frame );
70 extern double mlt_filter_get_progress( mlt_filter self, mlt_frame frame );
71 extern void mlt_filter_close( mlt_filter );
72 
73 #endif
74