]> git.sesse.net Git - mlt/blob - mlt++/src/MltParser.cpp
Remove files that no longer belong.
[mlt] / mlt++ / src / MltParser.cpp
1 /**
2  * MltParser.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 "Mlt.h"
22 using namespace Mlt;
23
24 static int on_invalid_cb( mlt_parser self, mlt_service object )
25 {
26         mlt_properties properties = mlt_parser_properties( self );
27         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
28         Service service( object );
29         return parser->on_invalid( &service );
30 }
31
32 static int on_unknown_cb( mlt_parser self, mlt_service object )
33 {
34         mlt_properties properties = mlt_parser_properties( self );
35         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
36         Service service( object );
37         return parser->on_unknown( &service );
38 }
39
40 static int on_start_producer_cb( mlt_parser self, mlt_producer object )
41 {
42         mlt_properties properties = mlt_parser_properties( self );
43         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
44         Producer producer( object );
45         return parser->on_start_producer( &producer );
46 }
47
48 static int on_end_producer_cb( mlt_parser self, mlt_producer object )
49 {
50         mlt_properties properties = mlt_parser_properties( self );
51         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
52         Producer producer( object );
53         return parser->on_end_producer( &producer );
54 }
55
56 static int on_start_playlist_cb( mlt_parser self, mlt_playlist object )
57 {
58         mlt_properties properties = mlt_parser_properties( self );
59         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
60         Playlist playlist( object );
61         return parser->on_start_playlist( &playlist );
62 }
63
64 static int on_end_playlist_cb( mlt_parser self, mlt_playlist object )
65 {
66         mlt_properties properties = mlt_parser_properties( self );
67         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
68         Playlist playlist( object );
69         return parser->on_end_playlist( &playlist );
70 }
71
72 static int on_start_tractor_cb( mlt_parser self, mlt_tractor object )
73 {
74         mlt_properties properties = mlt_parser_properties( self );
75         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
76         Tractor tractor( object );
77         return parser->on_start_tractor( &tractor );
78 }
79
80 static int on_end_tractor_cb( mlt_parser self, mlt_tractor object )
81 {
82         mlt_properties properties = mlt_parser_properties( self );
83         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
84         Tractor tractor( object );
85         return parser->on_end_tractor( &tractor );
86 }
87
88 static int on_start_multitrack_cb( mlt_parser self, mlt_multitrack object )
89 {
90         mlt_properties properties = mlt_parser_properties( self );
91         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
92         Multitrack multitrack( object );
93         return parser->on_start_multitrack( &multitrack );
94 }
95
96 static int on_end_multitrack_cb( mlt_parser self, mlt_multitrack object )
97 {
98         mlt_properties properties = mlt_parser_properties( self );
99         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
100         Multitrack multitrack( object );
101         return parser->on_end_multitrack( &multitrack );
102 }
103
104 static int on_start_track_cb( mlt_parser self )
105 {
106         mlt_properties properties = mlt_parser_properties( self );
107         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
108         return parser->on_start_track( );
109 }
110
111 static int on_end_track_cb( mlt_parser self )
112 {
113         mlt_properties properties = mlt_parser_properties( self );
114         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
115         return parser->on_end_track( );
116 }
117
118 static int on_start_filter_cb( mlt_parser self, mlt_filter object )
119 {
120         mlt_properties properties = mlt_parser_properties( self );
121         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
122         Filter filter( object );
123         return parser->on_start_filter( &filter );
124 }
125
126 static int on_end_filter_cb( mlt_parser self, mlt_filter object )
127 {
128         mlt_properties properties = mlt_parser_properties( self );
129         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
130         Filter filter( object );
131         return parser->on_end_filter( &filter );
132 }
133
134 static int on_start_transition_cb( mlt_parser self, mlt_transition object )
135 {
136         mlt_properties properties = mlt_parser_properties( self );
137         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
138         Transition transition( object );
139         return parser->on_start_transition( &transition );
140 }
141
142 static int on_end_transition_cb( mlt_parser self, mlt_transition object )
143 {
144         mlt_properties properties = mlt_parser_properties( self );
145         Parser *parser = ( Parser * )mlt_properties_get_data( properties, "_parser_object", NULL );
146         Transition transition( object );
147         return parser->on_end_transition( &transition );
148 }
149
150 Parser::Parser( ) :
151         Properties( false )
152 {
153         parser = mlt_parser_new( );
154         set( "_parser_object", this, 0 );
155         parser->on_invalid = on_invalid_cb;
156         parser->on_unknown = on_unknown_cb;
157         parser->on_start_producer = on_start_producer_cb;
158         parser->on_end_producer = on_end_producer_cb;
159         parser->on_start_playlist = on_start_playlist_cb;
160         parser->on_end_playlist = on_end_playlist_cb;
161         parser->on_start_tractor = on_start_tractor_cb;
162         parser->on_end_tractor = on_end_tractor_cb;
163         parser->on_start_multitrack = on_start_multitrack_cb;
164         parser->on_end_multitrack = on_end_multitrack_cb;
165         parser->on_start_track = on_start_track_cb;
166         parser->on_end_track = on_end_track_cb;
167         parser->on_start_filter = on_start_filter_cb;
168         parser->on_end_filter = on_end_filter_cb;
169         parser->on_start_transition = on_start_transition_cb;
170         parser->on_end_transition = on_end_transition_cb;
171 }
172
173 Parser::~Parser( )
174 {
175         mlt_parser_close( parser );
176 }
177
178 mlt_properties Parser::get_properties( )
179 {
180         return mlt_parser_properties( parser );
181 }
182
183 int Parser::start( Service &service )
184 {
185         return mlt_parser_start( parser, service.get_service( ) );
186 }
187
188 int Parser::on_invalid( Service *object )
189 {
190         object->debug( "Invalid" );
191         return 0;
192 }
193
194 int Parser::on_unknown( Service *object )
195 {
196         object->debug( "Unknown" );
197         return 0;
198 }
199
200 int Parser::on_start_producer( Producer *object )
201 {
202         object->debug( "on_start_producer" );
203         return 0;
204 }
205
206 int Parser::on_end_producer( Producer *object )
207 {
208         object->debug( "on_end_producer" );
209         return 0;
210 }
211
212 int Parser::on_start_playlist( Playlist *object )
213 {
214         object->debug( "on_start_playlist" );
215         return 0;
216 }
217
218 int Parser::on_end_playlist( Playlist *object )
219 {
220         object->debug( "on_end_playlist" );
221         return 0;
222 }
223
224 int Parser::on_start_tractor( Tractor *object )
225 {
226         object->debug( "on_start_tractor" );
227         return 0;
228 }
229
230 int Parser::on_end_tractor( Tractor *object )
231 {
232         object->debug( "on_end_tractor" );
233         return 0;
234 }
235
236 int Parser::on_start_multitrack( Multitrack *object )
237 {
238         object->debug( "on_start_multitrack" );
239         return 0;
240 }
241
242 int Parser::on_end_multitrack( Multitrack *object )
243 {
244         object->debug( "on_end_multitrack" );
245         return 0;
246 }
247
248 int Parser::on_start_track( )
249 {
250         fprintf( stderr, "on_start_track\n" );
251         return 0;
252 }
253
254 int Parser::on_end_track( )
255 {
256         fprintf( stderr, "on_end_track\n" );
257         return 0;
258 }
259
260 int Parser::on_start_filter( Filter *object )
261 {
262         object->debug( "on_start_filter" );
263         return 0;
264 }
265
266 int Parser::on_end_filter( Filter *object )
267 {
268         object->debug( "on_end_filter" );
269         return 0;
270 }
271
272 int Parser::on_start_transition( Transition *object )
273 {
274         object->debug( "on_start_transition" );
275         return 0;
276 }
277
278 int Parser::on_end_transition( Transition *object )
279 {
280         object->debug( "on_end_transition" );
281         return 0;
282 }
283
284