]> git.sesse.net Git - mlt/blob - src/tests/dan.c
ee76bb01d21fc0d1696eb8c979e5a501360afcb9
[mlt] / src / tests / dan.c
1 #include "mlt_producer.h"
2 #include "mlt_consumer.h"
3 #include "mlt_filter.h"
4 #include "mlt_tractor.h"
5 #include "mlt_transition.h"
6 #include "mlt_multitrack.h"
7
8 #include "producer_libdv.h"
9 #include "filter_deinterlace.h"
10 #include "consumer_sdl.h"
11 #include "producer_ppm.h"
12 #include "producer_pixbuf.h"
13 #include "transition_composite.h"
14
15 #include <stdio.h>
16
17 int main( int argc, char **argv )
18 {
19         char temp[ 132 ];
20         char *file1 = NULL;
21         char *file2 = NULL;
22
23         if ( argc >= 2 )
24                 file1 = argv[ 1 ];
25         if ( argc >= 3 )
26                 file2 = argv[ 2 ];
27
28         // Start the consumer...
29         mlt_consumer sdl_out = consumer_sdl_init( NULL );
30
31         // Create the producer(s)
32         mlt_producer dv1 = producer_libdv_init( file1 );
33         //mlt_producer dv1 = producer_pixbuf_init( file1 );
34         //mlt_producer dv2 = producer_libdv_init( file2 );
35         mlt_producer dv2 = producer_pixbuf_init( file2 );
36
37         // Register producers(s) with a multitrack object
38         mlt_multitrack multitrack = mlt_multitrack_init( );
39         mlt_multitrack_connect( multitrack, dv1, 0 );
40         mlt_multitrack_connect( multitrack, dv2, 1 );
41
42         // Create a filter and associate it to track 0
43         mlt_filter filter = filter_deinterlace_init( NULL );
44         mlt_filter_connect( filter, mlt_multitrack_service( multitrack ), 0 );
45         mlt_filter_set_in_and_out( filter, 0, 1000 );
46
47         // Define a transition
48         mlt_transition transition = transition_composite_init( NULL );
49         mlt_transition_connect( transition, mlt_filter_service( filter ), 0, 1 );
50         mlt_transition_set_in_and_out( transition, 0, 1000 );
51
52         // Buy a tractor and connect it to the filter
53         mlt_tractor tractor = mlt_tractor_init( );
54         mlt_tractor_connect( tractor, mlt_transition_service( transition ) );
55
56         // Connect the tractor to the consumer
57         mlt_consumer_connect( sdl_out, mlt_tractor_service( tractor ) );
58
59         // Do stuff until we're told otherwise...
60         fprintf( stderr, "Press return to continue\n" );
61         fgets( temp, 132, stdin );
62
63         // Close everything...
64         mlt_consumer_close( sdl_out );
65         mlt_tractor_close( tractor );
66         mlt_filter_close( filter );
67         mlt_multitrack_close( multitrack );
68         mlt_producer_close( dv1 );
69         mlt_producer_close( dv2 );
70
71         return 0;
72 }