]> git.sesse.net Git - mlt/blob - src/mlt++/MltTransition.cpp
Fix doc error for mlt_playlist_is_blank().
[mlt] / src / mlt++ / MltTransition.cpp
1 /**
2  * MltTransition.cpp - MLT Wrapper
3  * Copyright (C) 2004-2005 Charles Yates
4  * Author: Charles Yates <charles.yates@pandora.be>
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include <stdlib.h>
22 #include <string.h>
23 #include "MltTransition.h"
24 #include "MltProfile.h"
25 #include "MltProducer.h"
26 using namespace Mlt;
27
28 Transition::Transition( Profile& profile, const char *id, const char *arg ) :
29         instance( NULL )
30 {
31         if ( arg != NULL )
32         {
33                 instance = mlt_factory_transition( profile.get_profile(), id, arg );
34         }
35         else
36         {
37                 if ( strchr( id, ':' ) )
38                 {
39                         char *temp = strdup( id );
40                         char *arg = strchr( temp, ':' ) + 1;
41                         *( arg - 1 ) = '\0';
42                         instance = mlt_factory_transition( profile.get_profile(), temp, arg );
43                         free( temp );
44                 }
45                 else
46                 {
47                         instance = mlt_factory_transition( profile.get_profile(), id, NULL );
48                 }
49         }
50 }
51
52 Transition::Transition( Service &transition ) :
53         instance( NULL )
54 {
55         if ( transition.type( ) == transition_type )
56         {
57                 instance = ( mlt_transition )transition.get_service( );
58                 inc_ref( );
59         }
60 }
61
62 Transition::Transition( Transition &transition ) :
63         Mlt::Service( transition ),
64         instance( transition.get_transition( ) )
65 {
66         inc_ref( );
67 }
68
69 Transition::Transition( mlt_transition transition ) :
70         instance( transition )
71 {
72         inc_ref( );
73 }
74
75 Transition::~Transition( )
76 {
77         mlt_transition_close( instance );
78 }
79
80 mlt_transition Transition::get_transition( )
81 {
82         return instance;
83 }
84
85 mlt_service Transition::get_service( )
86 {
87         return mlt_transition_service( get_transition( ) );
88 }
89
90 void Transition::set_in_and_out( int in, int out )
91 {
92         mlt_transition_set_in_and_out( get_transition( ), in, out );
93 }
94
95 int Transition::connect( Producer &producer, int a_track, int b_track )
96 {
97         return mlt_transition_connect( get_transition(), producer.get_service(), a_track, b_track );
98 }
99
100 int Transition::get_a_track( )
101 {
102         return mlt_transition_get_a_track( get_transition() );
103 }
104
105 int Transition::get_b_track( )
106 {
107         return mlt_transition_get_b_track( get_transition() );
108 }
109
110 int Transition::get_in( )
111 {
112         return mlt_transition_get_in( get_transition() );
113 }
114
115 int Transition::get_out( )
116 {
117         return mlt_transition_get_out( get_transition() );
118 }
119
120 int Transition::get_length( )
121 {
122         return mlt_transition_get_length( get_transition( ) );
123 }
124
125 int Transition::get_position( Frame &frame )
126 {
127         return mlt_transition_get_position( get_transition( ), frame.get_frame( ) );
128 }
129
130 double Transition::get_progress( Frame &frame )
131 {
132         return mlt_transition_get_progress( get_transition( ), frame.get_frame( ) );
133 }
134
135 double Transition::get_progress_delta( Frame &frame )
136 {
137         return mlt_transition_get_progress_delta( get_transition( ), frame.get_frame( ) );
138 }