]> git.sesse.net Git - mlt/blob - src/tests/pango.c
new volume, mix, and resample filters and transitions
[mlt] / src / tests / pango.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 *text = NULL;
11
12         mlt_factory_init( "../modules" );
13
14         if ( argc < 3 )
15         {
16                 fprintf( stderr, "usage: pango file.mpeg  text_to_display\n" );
17                 return 1;
18         }
19         else
20         {
21                 file1 = argv[ 1 ];
22                 text = argv[ 2 ];
23         }
24
25         // Start the consumer...
26         mlt_consumer consumer = mlt_factory_consumer( "bluefish", "NTSC" );
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 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>" );
35         mlt_playlist_append( pl2, title );
36         mlt_properties_set_int( mlt_producer_properties( title ), "video_standard", mlt_video_standard_pal );
37         mlt_properties_set( mlt_producer_properties( title ), "font", "Sans Bold 36" );
38         mlt_properties_set( mlt_producer_properties( title ), "text", text );
39         mlt_properties_set_int( mlt_producer_properties( title ), "bgcolor", 0x0000007f );
40         mlt_properties_set_int( mlt_producer_properties( title ), "pad", 8 );
41         mlt_properties_set_int( mlt_producer_properties( title ), "align", 1 );
42         mlt_properties_set_int( mlt_producer_properties( title ), "x", 200 );
43         mlt_properties_set_int( mlt_producer_properties( title ), "y", 40 );
44         mlt_properties_set_double( mlt_producer_properties( title ), "mix", 0.8 );
45
46         // Register producers(s) with a multitrack object
47         mlt_multitrack multitrack = mlt_multitrack_init( );
48         mlt_multitrack_connect( multitrack, mlt_playlist_producer( pl1 ), 0 );
49         mlt_multitrack_connect( multitrack, mlt_playlist_producer( pl2 ), 1 );
50
51         // Define a transition
52         mlt_transition transition = mlt_factory_transition( "composite", NULL );
53         mlt_transition_connect( transition, mlt_multitrack_service( multitrack ), 0, 1 );
54         mlt_transition_set_in_and_out( transition, 0.0, 9999.0 );
55
56         // Buy a tractor and connect it to the filter
57         mlt_tractor tractor = mlt_tractor_init( );
58         mlt_tractor_connect( tractor, mlt_transition_service( transition ) );
59
60         // Connect the tractor to the consumer
61         mlt_consumer_connect( consumer, mlt_tractor_service( tractor ) );
62
63         // Do stuff until we're told otherwise...
64         fprintf( stderr, "Press return to continue\n" );
65         fgets( temp, 132, stdin );
66
67         // Close everything...
68         mlt_consumer_close( consumer );
69         mlt_tractor_close( tractor );
70         mlt_transition_close( transition );
71         mlt_multitrack_close( multitrack );
72         mlt_playlist_close( pl1 );
73         mlt_playlist_close( pl2 );
74         mlt_producer_close( dv1 );
75         mlt_producer_close( title );
76
77         return 0;
78 }