fix broken aspect handling again
[melted] / src / tests / dan.c
1
2 #include <framework/mlt.h>
3 #include "../modules/dv/producer_libdv.h"
4 #include "../modules/dv/consumer_libdv.h"
5 //#include "../modules/sdl/consumer_sdl.h"
6
7 #include <stdio.h>
8
9 int main( int argc, char **argv )
10 {
11 char temp[ 132 ];
12 char *file1 = NULL;
13 char *file2 = NULL;
14
15 // mlt_factory_init( "../modules" );
16 mlt_pool_init( );
17
18 if ( argc >= 2 )
19 file1 = argv[ 1 ];
20 if ( argc >= 3 )
21 file2 = argv[ 2 ];
22
23 // Start the consumer...
24 int vstd = mlt_video_standard_ntsc;
25 //mlt_consumer consumer = mlt_factory_consumer( "bluefish", &vstd );
26 //mlt_consumer consumer = mlt_factory_consumer( "sdl", NULL );
27 mlt_consumer consumer = consumer_libdv_init( NULL );
28
29 // Create the producer(s)
30 //mlt_producer dv1 = mlt_factory_producer( "libdv", file1 );
31 mlt_producer dv1 = producer_libdv_init( file1 );
32 //mlt_producer_set_in_and_out( dv1, 0, 5 );
33
34 mlt_producer dv2;// = mlt_factory_producer( "libdv", file2 );
35 //mlt_producer_set_in_and_out( dv2, 10.0, 30.0 );
36
37 #if 1
38 // Connect the consumer to the producer
39 mlt_consumer_connect( consumer, mlt_producer_service( dv1 ) );
40
41 // Do stuff until we're told otherwise...
42 mlt_consumer_start( consumer );
43 fprintf( stderr, "Press return to continue\n" );
44 fgets( temp, 132, stdin );
45 mlt_consumer_stop( consumer );
46 mlt_consumer_close( consumer );
47 mlt_pool_close( );
48 return 0;
49 #endif
50
51 //mlt_producer dv1 = producer_pixbuf_init( file1 );
52 //mlt_producer dv2 = producer_libdv_init( file2 );
53 //mlt_producer dv2 = mlt_factory_producer( "pixbuf", file2 );
54 #if 0
55 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>" );
56 mlt_properties_set_int( mlt_producer_properties( title ), "video_standard", mlt_video_standard_ntsc );
57 mlt_properties_set( mlt_producer_properties( title ), "font", "Sans Bold 36" );
58 mlt_properties_set( mlt_producer_properties( title ), "text", "Mutton Lettuce\nTomato" );
59 mlt_properties_set_int( mlt_producer_properties( title ), "bgcolor", 0x0000007f );
60 mlt_properties_set_int( mlt_producer_properties( title ), "pad", 8 );
61 mlt_properties_set_int( mlt_producer_properties( title ), "align", 1 );
62 mlt_properties_set_int( mlt_producer_properties( title ), "x", 20 );
63 mlt_properties_set_int( mlt_producer_properties( title ), "y", 40 );
64 #endif
65
66 mlt_playlist playlist1 = mlt_playlist_init();
67 mlt_playlist_append( playlist1, dv1 );
68 mlt_playlist_blank( playlist1, 1.0 );
69
70 mlt_playlist playlist2 = mlt_playlist_init();
71 mlt_playlist_blank( playlist2, 3.0 );
72 mlt_playlist_append( playlist2, dv2 );
73
74 // Register producers(s) with a multitrack object
75 mlt_multitrack multitrack = mlt_multitrack_init( );
76 mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist1 ), 0 );
77 mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist2 ), 1 );
78
79 // Create a filter and associate it to track 0
80 //mlt_filter filter = mlt_factory_filter( "deinterlace", NULL );
81 //mlt_filter_connect( filter, mlt_multitrack_service( multitrack ), 0 );
82 //mlt_filter_set_in_and_out( filter, 0, 1000 );
83
84 // Define a transition
85 mlt_transition transition = mlt_factory_transition( "luma", NULL );
86 mlt_transition_connect( transition, mlt_multitrack_service( multitrack ), 0, 1 );
87 mlt_transition_set_in_and_out( transition, 3.0, 5.0 );
88 //mlt_properties_set( mlt_transition_properties( transition ), "filename", "clock.pgm" );
89 mlt_properties_set_double( mlt_transition_properties( transition ), "softness", 0.1 );
90
91 // Buy a tractor and connect it to the filter
92 mlt_tractor tractor = mlt_tractor_init( );
93 mlt_tractor_connect( tractor, mlt_transition_service( transition ) );
94
95 // Connect the tractor to the consumer
96 mlt_consumer_connect( consumer, mlt_tractor_service( tractor ) );
97
98 // Do stuff until we're told otherwise...
99 fprintf( stderr, "Press return to continue\n" );
100 fgets( temp, 132, stdin );
101
102 // Close everything...
103 mlt_consumer_close( consumer );
104 mlt_tractor_close( tractor );
105 mlt_transition_close( transition );
106 mlt_multitrack_close( multitrack );
107 mlt_producer_close( dv1 );
108 mlt_producer_close( dv2 );
109
110 return 0;
111 }