2 * MltFilter.cpp - MLT Wrapper
3 * Copyright (C) 2004-2005 Charles Yates
4 * Author: Charles Yates <charles.yates@pandora.be>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "MltFilter.h"
24 #include "MltProfile.h"
27 Filter::Filter( Profile& profile, const char *id, const char *arg ) :
32 instance = mlt_factory_filter( profile.get_profile(), id, arg );
36 if ( strchr( id, ':' ) )
38 char *temp = strdup( id );
39 char *arg = strchr( temp, ':' ) + 1;
41 instance = mlt_factory_filter( profile.get_profile(), temp, arg );
46 instance = mlt_factory_filter( profile.get_profile(), id, NULL );
51 Filter::Filter( Service &filter ) :
54 if ( filter.type( ) == filter_type )
56 instance = ( mlt_filter )filter.get_service( );
61 Filter::Filter( Filter &filter ) :
62 Mlt::Service( filter ),
63 instance( filter.get_filter( ) )
68 Filter::Filter( mlt_filter filter ) :
76 mlt_filter_close( instance );
79 mlt_filter Filter::get_filter( )
84 mlt_service Filter::get_service( )
86 return mlt_filter_service( get_filter( ) );
89 int Filter::connect( Service &service, int index )
91 return mlt_filter_connect( get_filter( ), service.get_service( ), index );
94 void Filter::set_in_and_out( int in, int out )
96 mlt_filter_set_in_and_out( get_filter( ), in, out );
101 return mlt_filter_get_in( get_filter( ) );
104 int Filter::get_out( )
106 return mlt_filter_get_out( get_filter( ) );
109 int Filter::get_length( )
111 return mlt_filter_get_length( get_filter( ) );
114 int Filter::get_length2( Frame &frame )
116 return mlt_filter_get_length2( get_filter( ), frame.get_frame() );
119 int Filter::get_track( )
121 return mlt_filter_get_track( get_filter( ) );
124 int Filter::get_position( Frame &frame )
126 return mlt_filter_get_position( get_filter( ), frame.get_frame( ) );
129 double Filter::get_progress( Frame &frame )
131 return mlt_filter_get_progress( get_filter( ), frame.get_frame( ) );