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