1 /**
2  * MltMultitrack.h - Multitrack wrapper
3  * Copyright (C) 2004-2015 Meltytech, LLC
4  * Author: Charles Yates <charles.yates@gmail.com>
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20 
21 #include "MltMultitrack.h"
22 #include "MltProducer.h"
23 using namespace Mlt;
24 
Multitrack(mlt_multitrack multitrack)25 Multitrack::Multitrack( mlt_multitrack multitrack ) :
26 	instance( multitrack )
27 {
28 	inc_ref( );
29 }
30 
Multitrack(Service & multitrack)31 Multitrack::Multitrack( Service &multitrack ) :
32 	instance( NULL )
33 {
34 	if ( multitrack.type( ) == mlt_service_multitrack_type )
35 	{
36 		instance = ( mlt_multitrack )multitrack.get_service( );
37 		inc_ref( );
38 	}
39 }
40 
Multitrack(Multitrack & multitrack)41 Multitrack::Multitrack( Multitrack &multitrack ) :
42 	Mlt::Producer( multitrack ),
43 	instance( multitrack.get_multitrack( ) )
44 {
45 	inc_ref( );
46 }
47 
~Multitrack()48 Multitrack::~Multitrack( )
49 {
50 	mlt_multitrack_close( instance );
51 }
52 
get_multitrack()53 mlt_multitrack Multitrack::get_multitrack( )
54 {
55 	return instance;
56 }
57 
get_producer()58 mlt_producer Multitrack::get_producer( )
59 {
60 	return mlt_multitrack_producer( get_multitrack( ) );
61 }
62 
connect(Producer & producer,int index)63 int Multitrack::connect( Producer &producer, int index )
64 {
65 	return mlt_multitrack_connect( get_multitrack( ), producer.get_producer( ), index );
66 }
67 
insert(Producer & producer,int index)68 int Multitrack::insert( Producer &producer, int index )
69 {
70 	return mlt_multitrack_insert( get_multitrack( ), producer.get_producer( ), index );
71 }
72 
disconnect(int index)73 int Multitrack::disconnect( int index )
74 {
75 	return mlt_multitrack_disconnect( get_multitrack(), index );
76 }
77 
clip(mlt_whence whence,int index)78 int Multitrack::clip( mlt_whence whence, int index )
79 {
80 	return mlt_multitrack_clip( get_multitrack( ), whence, index );
81 }
82 
count()83 int Multitrack::count( )
84 {
85 	return mlt_multitrack_count( get_multitrack( ) );
86 }
87 
track(int index)88 Producer *Multitrack::track( int index )
89 {
90 	return new Producer( mlt_multitrack_track( get_multitrack( ), index ) );
91 }
92 
refresh()93 void Multitrack::refresh( )
94 {
95 	return mlt_multitrack_refresh( get_multitrack( ) );
96 }
97