]> git.sesse.net Git - mlt/blob - src/tests/pixbuf.c
Merge ../mlt++
[mlt] / src / tests / pixbuf.c
1
2 #include <framework/mlt.h>
3
4 #include <stdio.h>
5
6 int main( int argc, char **argv )
7 {
8         char temp[ 132 ];
9         char *file1 = NULL;
10         char *file2 = NULL;
11
12         mlt_factory_init( "../modules" );
13
14         if ( argc < 3 )
15         {
16                 fprintf( stderr, "usage: pixbuf file.mpeg file.{png,jpg,etc}\n" );
17                 return 1;
18         }
19         else
20         {
21                 file1 = argv[ 1 ];
22                 file2 = argv[ 2 ];
23         }
24
25         // Start the consumer...
26         mlt_consumer consumer = mlt_factory_consumer( "sdl", "PAL" );
27
28         // Create the producer(s)
29         mlt_playlist pl1 = mlt_playlist_init();
30         mlt_producer dv1 = mlt_factory_producer( "mcmpeg", file1 );
31         mlt_playlist_append( pl1, dv1 );
32
33         mlt_playlist pl2 = mlt_playlist_init();
34         mlt_producer overlay = mlt_factory_producer( "pixbuf", file2 );
35         mlt_playlist_append( pl2, overlay );
36         mlt_properties_set_int( mlt_producer_properties( overlay ), "x", 600 );
37         mlt_properties_set_int( mlt_producer_properties( overlay ), "y", 460 );
38         mlt_properties_set_double( mlt_producer_properties( overlay ), "mix", 0.8 );
39
40         // Register producers(s) with a multitrack object
41         mlt_multitrack multitrack = mlt_multitrack_init( );
42         mlt_multitrack_connect( multitrack, mlt_playlist_producer( pl1 ), 0 );
43         mlt_multitrack_connect( multitrack, mlt_playlist_producer( pl2 ), 1 );
44
45         // Define a transition
46         mlt_transition transition = mlt_factory_transition( "composite", NULL );
47         mlt_transition_connect( transition, mlt_multitrack_service( multitrack ), 0, 1 );
48         mlt_transition_set_in_and_out( transition, 0.0, 9999.0 );
49
50         // Buy a tractor and connect it to the filter
51         mlt_tractor tractor = mlt_tractor_init( );
52         mlt_tractor_connect( tractor, mlt_transition_service( transition ) );
53
54         // Connect the tractor to the consumer
55         mlt_consumer_connect( consumer, mlt_tractor_service( tractor ) );
56
57         // Do stuff until we're told otherwise...
58         fprintf( stderr, "Press return to continue\n" );
59         fgets( temp, 132, stdin );
60
61         // Close everything...
62         mlt_consumer_close( consumer );
63         mlt_tractor_close( tractor );
64         mlt_transition_close( transition );
65         mlt_multitrack_close( multitrack );
66         mlt_playlist_close( pl1 );
67         mlt_playlist_close( pl2 );
68         mlt_producer_close( dv1 );
69         mlt_producer_close( overlay );
70
71         return 0;
72 }