CUSTOMISING
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 26 Jun 2005 20:38:10 +0000 (20:38 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 26 Jun 2005 20:38:10 +0000 (20:38 +0000)
+ 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

mlt++/CUSTOMISING
mlt++/swig/ruby/thumbs.rb

index 1fc4f2c..30d11a8 100644 (file)
@@ -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
index 0d0f9a4..9e28782 100755 (executable)
@@ -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