More cleanups
[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 Producer::Producer( ) :
25 destroy( false ),
26 instance( NULL )
27 {
28 }
29
30 Producer::Producer( char *id, char *service ) :
31 destroy( true ),
32 instance( NULL )
33 {
34 if ( id != NULL && service != NULL )
35 instance = mlt_factory_producer( id, service );
36 else
37 instance = mlt_factory_producer( "fezzik", id != NULL ? id : service );
38 }
39
40 Producer::Producer( mlt_producer producer ) :
41 destroy( false ),
42 instance( producer )
43 {
44 }
45
46 Producer::Producer( Producer &producer ) :
47 destroy( false ),
48 instance( producer.get_producer( ) )
49 {
50 }
51
52 Producer::~Producer( )
53 {
54 if ( destroy )
55 mlt_producer_close( instance );
56 }
57
58 mlt_producer Producer::get_producer( )
59 {
60 return instance;
61 }
62
63 mlt_service Producer::get_service( )
64 {
65 return mlt_producer_service( get_producer( ) );
66 }
67
68 int Producer::seek( mlt_position position )
69 {
70 return mlt_producer_seek( get_producer( ), position );
71 }
72
73 mlt_position Producer::position( )
74 {
75 return mlt_producer_position( get_producer( ) );
76 }
77
78 mlt_position Producer::frame( )
79 {
80 return mlt_producer_frame( get_producer( ) );
81 }
82
83 int Producer::set_speed( double speed )
84 {
85 return mlt_producer_set_speed( get_producer( ), speed );
86 }
87
88 double Producer::get_speed( )
89 {
90 return mlt_producer_get_speed( get_producer( ) );
91 }
92
93 double Producer::get_fps( )
94 {
95 return mlt_producer_get_fps( get_producer( ) );
96 }
97
98 int Producer::set_in_and_out( mlt_position in, mlt_position out )
99 {
100 return mlt_producer_set_in_and_out( get_producer( ), in, out );
101 }
102
103 mlt_position Producer::get_in( )
104 {
105 return mlt_producer_get_in( get_producer( ) );
106 }
107
108 mlt_position Producer::get_out( )
109 {
110 return mlt_producer_get_out( get_producer( ) );
111 }
112
113 mlt_position Producer::get_length( )
114 {
115 return mlt_producer_get_length( get_producer( ) );
116 }
117
118 mlt_position Producer::get_playtime( )
119 {
120 return mlt_producer_get_playtime( get_producer( ) );
121 }
122