From: lilo_booter Date: Sun, 26 Jun 2005 20:38:10 +0000 (+0000) Subject: CUSTOMISING X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=6468e1ff9f9e9aeed0aa9eadb0a0491cd994b979;p=melted CUSTOMISING + Added an example of how to hide a track on reception swig/ruby/thumbs.rb + Changed generator to run, rather than sleep and poll git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@741 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/mlt++/CUSTOMISING b/mlt++/CUSTOMISING index 1fc4f2c..30d11a8 100644 --- a/mlt++/CUSTOMISING +++ b/mlt++/CUSTOMISING @@ -320,7 +320,33 @@ OTHER MANIPULATIONS manipulated in the push method - for example, to remove a track from the output, we could do something like: - TBD + Response *push( char *command, Service *service ) + { + Playlist playlist( ( mlt_playlist )( unit( 0 )->get_data( "playlist" ) ) ); + Tractor *tractor( *service ); + if ( tractor.is_valid( ) && playlist.is_valid( ) ) + { + // Remove track 2 (NB: tracks are indexed from 0 like everything else) + Producer *producer = tractor.track( 2 ); + Playlist track( producer ); + + // If we have a valid track then hide video and audio + // This is a bit pattern - 1 is video, 2 is audio + if ( track.is_valid( ) ) + track.set( "hide", 3 ); + + // You need to delete the reference to the playlist producer here + delete producer; + + // Play it + playlist.lock( ); + playlist.clear( ); + playlist.append( producer ); + playlist.unlock( ); + return new Response( 200, "OK" ); + } + return new Response( 400, "Invalid" ); + } EVENT HANDLING diff --git a/mlt++/swig/ruby/thumbs.rb b/mlt++/swig/ruby/thumbs.rb index 0d0f9a4..9e28782 100755 --- a/mlt++/swig/ruby/thumbs.rb +++ b/mlt++/swig/ruby/thumbs.rb @@ -34,10 +34,5 @@ generator.set( "size", size ) # Connect the consumer generator.connect( playlist ); -generator.start - -# Wait until we're done -while !generator.is_stopped - sleep 1 -end +generator.run