8f0dca5dd88091bb66128b3f4a0e3ded117c577d
[melted] / 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( "westley", NULL );
23
24 // Create the producer(s)
25 mlt_producer dv1 = mlt_factory_producer( "westley", file1 );
26 //mlt_producer_set_in_and_out( dv1, 0, 5 );
27
28 mlt_producer dv2 = mlt_factory_producer( "libdv", file2 );
29 //mlt_producer_set_in_and_out( dv2, 10.0, 30.0 );
30
31 #if 1
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 mlt_consumer_start( consumer );
37 // fprintf( stderr, "Press return to continue\n" );
38 // fgets( temp, 132, stdin );
39 mlt_consumer_stop( consumer );
40 mlt_consumer_close( consumer );
41 return 0;
42 #endif
43
44 //mlt_producer dv1 = producer_pixbuf_init( file1 );
45 //mlt_producer dv2 = producer_libdv_init( file2 );
46 //mlt_producer dv2 = mlt_factory_producer( "pixbuf", file2 );
47 #if 0
48 mlt_producer title = mlt_factory_producer( "pango", NULL ); //"<span font_desc=\"Sans Bold 36\">Mutton <span font_desc=\"Luxi Serif Bold Oblique 36\">Lettuce</span> Tomato</span>" );
49 mlt_properties_set_int( mlt_producer_properties( title ), "video_standard", mlt_video_standard_ntsc );
50 mlt_properties_set( mlt_producer_properties( title ), "font", "Sans Bold 36" );
51 mlt_properties_set( mlt_producer_properties( title ), "text", "Mutton Lettuce\nTomato" );
52 mlt_properties_set_int( mlt_producer_properties( title ), "bgcolor", 0x0000007f );
53 mlt_properties_set_int( mlt_producer_properties( title ), "pad", 8 );
54 mlt_properties_set_int( mlt_producer_properties( title ), "align", 1 );
55 mlt_properties_set_int( mlt_producer_properties( title ), "x", 20 );
56 mlt_properties_set_int( mlt_producer_properties( title ), "y", 40 );
57 #endif
58
59 mlt_playlist playlist1 = mlt_playlist_init();
60 mlt_playlist_append( playlist1, dv1 );
61 mlt_playlist_blank( playlist1, 1.0 );
62
63 mlt_playlist playlist2 = mlt_playlist_init();
64 mlt_playlist_blank( playlist2, 3.0 );
65 mlt_playlist_append( playlist2, dv2 );
66
67 // Register producers(s) with a multitrack object
68 mlt_multitrack multitrack = mlt_multitrack_init( );
69 mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist1 ), 0 );
70 mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist2 ), 1 );
71
72 // Create a filter and associate it to track 0
73 //mlt_filter filter = mlt_factory_filter( "deinterlace", NULL );
74 //mlt_filter_connect( filter, mlt_multitrack_service( multitrack ), 0 );
75 //mlt_filter_set_in_and_out( filter, 0, 1000 );
76
77 // Define a transition
78 mlt_transition transition = mlt_factory_transition( "luma", NULL );
79 mlt_transition_connect( transition, mlt_multitrack_service( multitrack ), 0, 1 );
80 mlt_transition_set_in_and_out( transition, 3.0, 5.0 );
81 //mlt_properties_set( mlt_transition_properties( transition ), "filename", "clock.pgm" );
82 mlt_properties_set_double( mlt_transition_properties( transition ), "softness", 0.1 );
83
84 // Buy a tractor and connect it to the filter
85 mlt_tractor tractor = mlt_tractor_init( );
86 mlt_tractor_connect( tractor, mlt_transition_service( transition ) );
87
88 // Connect the tractor to the consumer
89 mlt_consumer_connect( consumer, mlt_tractor_service( tractor ) );
90
91 // Do stuff until we're told otherwise...
92 fprintf( stderr, "Press return to continue\n" );
93 fgets( temp, 132, stdin );
94
95 // Close everything...
96 mlt_consumer_close( consumer );
97 mlt_tractor_close( tractor );
98 mlt_transition_close( transition );
99 mlt_multitrack_close( multitrack );
100 mlt_producer_close( dv1 );
101 mlt_producer_close( dv2 );
102
103 return 0;
104 }