Initial revision
[melted] / mlt++ / src / MltProducer.cpp
1 /**
2 * MltProducer.cpp - MLT Wrapper
3 * Copyright (C) 2004-2005 Charles Yates
4 * Author: Charles Yates <charles.yates@pandora.be>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program 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
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 #include "MltProducer.h"
22 using namespace Mlt;
23
24 mlt_service Producer::get_service( )
25 {
26 return mlt_producer_service( get_producer( ) );
27 }
28
29 int Producer::seek( mlt_position position )
30 {
31 return mlt_producer_seek( get_producer( ), position );
32 }
33
34 mlt_position Producer::position( )
35 {
36 return mlt_producer_position( get_producer( ) );
37 }
38
39 mlt_position Producer::frame( )
40 {
41 return mlt_producer_frame( get_producer( ) );
42 }
43
44 int Producer::set_speed( double speed )
45 {
46 return mlt_producer_set_speed( get_producer( ), speed );
47 }
48
49 double Producer::get_speed( )
50 {
51 return mlt_producer_get_speed( get_producer( ) );
52 }
53
54 double Producer::get_fps( )
55 {
56 return mlt_producer_get_fps( get_producer( ) );
57 }
58
59 int Producer::set_in_and_out( mlt_position in, mlt_position out )
60 {
61 return mlt_producer_set_in_and_out( get_producer( ), in, out );
62 }
63
64 mlt_position Producer::get_in( )
65 {
66 return mlt_producer_get_in( get_producer( ) );
67 }
68
69 mlt_position Producer::get_out( )
70 {
71 return mlt_producer_get_out( get_producer( ) );
72 }
73
74 mlt_position Producer::get_length( )
75 {
76 return mlt_producer_get_length( get_producer( ) );
77 }
78
79 mlt_position Producer::get_playtime( )
80 {
81 return mlt_producer_get_playtime( get_producer( ) );
82 }
83
84 mlt_producer ProducerInstance::get_producer( )
85 {
86 return instance;
87 }
88
89 ProducerInstance::ProducerInstance( char *id, char *service ) :
90 destroy( true ),
91 instance( NULL )
92 {
93 if ( id != NULL && service != NULL )
94 instance = mlt_factory_producer( id, service );
95 else
96 instance = mlt_factory_producer( "fezzik", id != NULL ? id : service );
97 }
98
99 ProducerInstance::ProducerInstance( mlt_producer producer ) :
100 destroy( false ),
101 instance( producer )
102 {
103 }
104
105 ProducerInstance::ProducerInstance( Producer &producer ) :
106 destroy( false ),
107 instance( producer.get_producer( ) )
108 {
109 }
110
111 ProducerInstance::~ProducerInstance( )
112 {
113 if ( destroy )
114 mlt_producer_close( instance );
115 }
116