fixup and optimize edge conditions of composite; updated property handling of produce...
[melted] / 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( "mcmpeg", file1 );
26
27 #if 0
28 // Connect the tractor to the consumer
29 mlt_consumer_connect( consumer, mlt_producer_service( dv1 ) );
30
31 // Do stuff until we're told otherwise...
32 fprintf( stderr, "Press return to continue\n" );
33 fgets( temp, 132, stdin );
34 mlt_consumer_close( consumer );
35 return 0;
36 #endif
37
38 //mlt_producer dv1 = producer_pixbuf_init( file1 );
39 //mlt_producer dv2 = producer_libdv_init( file2 );
40 //mlt_producer dv2 = mlt_factory_producer( "pixbuf", file2 );
41 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>" );
42 mlt_properties_set( mlt_producer_properties( dv2 ), "font", "Sans Bold 36" );
43 mlt_properties_set( mlt_producer_properties( dv2 ), "text", "Mutton Lettuce\nTomato" );
44 mlt_properties_set_int( mlt_producer_properties( dv2 ), "video_standard", mlt_video_standard_ntsc );
45 mlt_properties_set_int( mlt_producer_properties( dv2 ), "bgcolor", 0x0000007f );
46 mlt_properties_set_int( mlt_producer_properties( dv2 ), "pad", 8 );
47 mlt_properties_set_int( mlt_producer_properties( dv2 ), "align", 1 );
48 mlt_properties_set_int( mlt_producer_properties( dv2 ), "x", -20 );
49 mlt_properties_set_int( mlt_producer_properties( dv2 ), "y", 40 );
50
51 // Register producers(s) with a multitrack object
52 mlt_multitrack multitrack = mlt_multitrack_init( );
53 mlt_multitrack_connect( multitrack, dv1, 0 );
54 mlt_multitrack_connect( multitrack, dv2, 1 );
55
56 // Create a filter and associate it to track 0
57 mlt_filter filter = mlt_factory_filter( "deinterlace", NULL );
58 mlt_filter_connect( filter, mlt_multitrack_service( multitrack ), 0 );
59 mlt_filter_set_in_and_out( filter, 0, 1000 );
60
61 // Define a transition
62 mlt_transition transition = mlt_factory_transition( "composite", NULL );
63 mlt_transition_connect( transition, mlt_filter_service( filter ), 0, 1 );
64 mlt_transition_set_in_and_out( transition, 0, 5.0 );
65
66 // Buy a tractor and connect it to the filter
67 mlt_tractor tractor = mlt_tractor_init( );
68 mlt_tractor_connect( tractor, mlt_transition_service( transition ) );
69
70 // Connect the tractor to the consumer
71 mlt_consumer_connect( consumer, mlt_tractor_service( tractor ) );
72
73 // Do stuff until we're told otherwise...
74 fprintf( stderr, "Press return to continue\n" );
75 fgets( temp, 132, stdin );
76
77 mlt_properties_set( mlt_producer_properties( dv2 ), "font", "Sans Oblique 36" );
78 mlt_properties_set( mlt_producer_properties( dv2 ), "text", "Mutton\nLettuce Tomato" );
79
80 // Do stuff until we're told otherwise...
81 fprintf( stderr, "Press return to continue\n" );
82 fgets( temp, 132, stdin );
83
84 // Close everything...
85 mlt_consumer_close( consumer );
86 mlt_tractor_close( tractor );
87 //mlt_filter_close( filter );
88 mlt_multitrack_close( multitrack );
89 mlt_producer_close( dv1 );
90 mlt_producer_close( dv2 );
91
92 return 0;
93 }