2 * producer_libdv.c -- a libxml2 parser of mlt service networks
3 * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
4 * Author: Dan Dennedy <dan@dennedy.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
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.
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.
21 #include "producer_westley.h"
22 #include <framework/mlt.h>
27 #include <libxml/parser.h>
29 static mlt_producer
parse_westley( char *file
)
34 mlt_producer
producer_westley_init( char *filename
)
38 mlt_producer producer
= NULL
;
39 mlt_playlist playlist
= mlt_playlist_init( );
40 mlt_properties group
= mlt_properties_new( );
41 mlt_properties properties
= group
;
42 mlt_field field
= mlt_field_init( );
43 mlt_properties field_properties
= mlt_field_properties( field
);
44 mlt_multitrack multitrack
= mlt_field_multitrack( field
);
46 // We need to track the number of registered filters
47 mlt_properties_set_int( field_properties
, "registered", 0 );
50 producer
= parse_westley( filename
);
54 // Connect producer to playlist
55 if ( producer
!= NULL
)
56 mlt_playlist_append( playlist
, producer
);
58 // We must have a producer at this point
59 if ( mlt_playlist_count( playlist
) > 0 )
61 // Connect multitrack to producer
62 mlt_multitrack_connect( multitrack
, mlt_playlist_producer( playlist
), track
);
65 mlt_tractor tractor
= mlt_field_tractor( field
);
66 mlt_producer prod
= mlt_tractor_producer( tractor
);
67 mlt_properties props
= mlt_tractor_properties( tractor
);
68 mlt_properties_set( mlt_producer_properties( prod
), "resource", filename
);
69 mlt_properties_set_data( props
, "multitrack", multitrack
, 0, NULL
, NULL
);
70 mlt_properties_set_data( props
, "field", field
, 0, NULL
, NULL
);
71 mlt_properties_set_data( props
, "group", group
, 0, NULL
, NULL
);
72 mlt_properties_set_position( props
, "length", mlt_producer_get_out( mlt_multitrack_producer( multitrack
) ) + 1 );
73 mlt_producer_set_in_and_out( prod
, 0, mlt_producer_get_out( mlt_multitrack_producer( multitrack
) ) );
74 mlt_properties_set_double( props
, "fps", mlt_producer_get_fps( mlt_multitrack_producer( multitrack
) ) );
76 return mlt_tractor_producer( tractor
);