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