X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=mlt%2B%2B%2FHOWTO;fp=mlt%2B%2B%2FHOWTO;h=cc9d31e02d6c1efffb5847215efde34df29ea446;hb=6ccb88f6fd4044511e8af2631f0a1f271bdc7924;hp=b16dbefa21c795aa4d4ce2cc4d9eb8f7d3e8c0a1;hpb=0737f19add6d02cc1a040f2c72a22abd05a27eac;p=melted diff --git a/mlt++/HOWTO b/mlt++/HOWTO index b16dbef..cc9d31e 100644 --- a/mlt++/HOWTO +++ b/mlt++/HOWTO @@ -13,7 +13,6 @@ Hello World An example of use is as follows: - #include #include using namespace Mlt; @@ -23,7 +22,7 @@ Hello World Producer p( "pango:" ); p.set( "text", "Hello World" ); Consumer c( "sdl" ); - Event *e = Consumer.setup_wait_for( "consumer-stopped" ); + Event *e = c.setup_wait_for( "consumer-stopped" ); c.connect( p ); c.start( ); c.wait_for( e ); @@ -63,7 +62,6 @@ Playlists As a simple example of the Playlist in action, we'll convert the example above into an application which plays multiple video or audio files. - #include #include using namespace Mlt; @@ -79,7 +77,7 @@ Playlists } Consumer c( "sdl" ); c.connect( list ); - Event *e = Consumer.setup_wait_for( "consumer-stopped" ); + Event *e = c.setup_wait_for( "consumer-stopped" ); c.start( ); c.wait_for( e ); delete e; @@ -111,7 +109,6 @@ Filters logo of some sort. We'll just use some black text on a partially transparent red background. - #include #include using namespace Mlt; @@ -132,7 +129,7 @@ Filters list.attach( f ); Consumer c( "sdl" ); c.connect( list ); - Event *e = Consumer.setup_wait_for( "consumer-stopped" ); + Event *e = c.setup_wait_for( "consumer-stopped" ); c.start( ); c.wait_for( e ); delete e; @@ -197,6 +194,43 @@ Transition The tractor returned will now mix the audio from the original video and the audio. +Events +------ + + Typically, applications need to be informed when changes occur in an mlt++ object. + This facilitates application services such as undo/redo management, or project + rendering in a timeline type widget and many other types of operations which an + application needs. + + As an example, consider the following: + + class Westley + { + private: + Consumer consumer; + Tractor &tractor; + public: + Westley( MltTractor &tractor ) : + tractor( tractor ), + consumer( "westley" ) + { + consumer.connect( tractor ); + tractor.listen( tractor, "producer-changed", ( mlt_listener )Westley::listener ); + } + + static void listener( Properties *tractor, Westley *object ) + { + object->activate( ); + } + + void activate( ) + { + consumer.start( ); + } + }; + + + That's All Folks... -------------------