]> git.sesse.net Git - mlt/blob - src/tests/dan.c
added luma transition and new frame properties
[mlt] / src / tests / dan.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 >= 2 )
15                 file1 = argv[ 1 ];
16         if ( argc >= 3 )
17                 file2 = argv[ 2 ];
18
19         // Start the consumer...
20         int vstd = mlt_video_standard_ntsc;
21         //mlt_consumer consumer = mlt_factory_consumer( "bluefish", &vstd );
22         mlt_consumer consumer = mlt_factory_consumer( "sdl", "NTSC" );
23
24         // Create the producer(s)
25         mlt_producer dv1 = mlt_factory_producer( "mcdv", file1 );
26         mlt_producer_set_in_and_out( dv1, 0.0, 2.0 );
27         
28         mlt_producer dv2 = mlt_factory_producer( "mcmpeg", file2 );
29         //mlt_producer_set_in_and_out( dv2, 10.0, 30.0 );
30
31 #if 0
32         // Connect the consumer to the producer
33         mlt_consumer_connect( consumer, mlt_producer_service( dv1 ) );
34
35         // Do stuff until we're told otherwise...
36         fprintf( stderr, "Press return to continue\n" );
37         fgets( temp, 132, stdin );
38         mlt_consumer_close( consumer );
39         return 0;
40 #endif
41
42         //mlt_producer dv1 = producer_pixbuf_init( file1 );
43         //mlt_producer dv2 = producer_libdv_init( file2 );
44         //mlt_producer dv2 = mlt_factory_producer( "pixbuf", file2 );
45 #if 0
46         mlt_producer dv2 = mlt_factory_producer( "pango", NULL ); //"<span font_desc=\"Sans Bold 36\">Mutton <span font_desc=\"Luxi Serif Bold Oblique 36\">Lettuce</span> Tomato</span>" );
47         mlt_properties_set( mlt_producer_properties( dv2 ), "font", "Sans Bold 36" );
48         mlt_properties_set( mlt_producer_properties( dv2 ), "text", "Mutton Lettuce\nTomato" );
49         mlt_properties_set_int( mlt_producer_properties( dv2 ), "video_standard", mlt_video_standard_ntsc );
50         mlt_properties_set_int( mlt_producer_properties( dv2 ), "bgcolor", 0x0000007f );
51         mlt_properties_set_int( mlt_producer_properties( dv2 ), "pad", 8 );
52         mlt_properties_set_int( mlt_producer_properties( dv2 ), "align", 1 );
53         mlt_properties_set_int( mlt_producer_properties( dv2 ), "x", -20 );
54         mlt_properties_set_int( mlt_producer_properties( dv2 ), "y", 40 );
55 #endif
56
57         mlt_playlist playlist1 = mlt_playlist_init();
58         mlt_playlist_append( playlist1, dv1 );
59
60         mlt_playlist playlist2 = mlt_playlist_init();
61         mlt_playlist_blank( playlist2, 1.0 );
62         mlt_playlist_append( playlist2, dv2 );
63         
64         // Register producers(s) with a multitrack object
65         mlt_multitrack multitrack = mlt_multitrack_init( );
66         mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist1 ), 0 );
67         mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist2 ), 1 );
68
69         // Create a filter and associate it to track 0
70         //mlt_filter filter = mlt_factory_filter( "deinterlace", NULL );
71         //mlt_filter_connect( filter, mlt_multitrack_service( multitrack ), 0 );
72         //mlt_filter_set_in_and_out( filter, 0, 1000 );
73
74         // Define a transition
75         mlt_transition transition = mlt_factory_transition( "luma", NULL );
76         mlt_transition_connect( transition, mlt_multitrack_service( multitrack ), 0, 1 );
77         mlt_transition_set_in_and_out( transition, 1.0, 2.0 );
78         mlt_properties_set( mlt_transition_properties( transition ), "filename", "clock.pgm" );
79         mlt_properties_set_double( mlt_transition_properties( transition ), "softness", 0.1 );
80
81         // Buy a tractor and connect it to the filter
82         mlt_tractor tractor = mlt_tractor_init( );
83         mlt_tractor_connect( tractor, mlt_transition_service( transition ) );
84
85         // Connect the tractor to the consumer
86         mlt_consumer_connect( consumer, mlt_tractor_service( tractor ) );
87
88         // Do stuff until we're told otherwise...
89         fprintf( stderr, "Press return to continue\n" );
90         fgets( temp, 132, stdin );
91
92         // Close everything...
93         mlt_consumer_close( consumer );
94         mlt_tractor_close( tractor );
95 //      mlt_filter_close( filter );
96         mlt_multitrack_close( multitrack );
97         mlt_producer_close( dv1 );
98         mlt_producer_close( dv2 );
99
100         return 0;
101 }