X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=mlt%2B%2B%2FCUSTOMISING;h=7fdce7f0c9439276079f314aa9ee6e4c35cbbf3c;hb=e6e1b9178bb65857ac64fdd866436abbf6db284b;hp=224877565b14a2489abb8f644b7bfb54f84c2565;hpb=af15cd486562602a829a4082863e85afbb3f6986;p=melted diff --git a/mlt++/CUSTOMISING b/mlt++/CUSTOMISING index 2248775..7fdce7f 100644 --- a/mlt++/CUSTOMISING +++ b/mlt++/CUSTOMISING @@ -181,8 +181,8 @@ ACCESSING UNIT PROPERTIES You can extract the objects using: - Playlist playlist( ( mlt_playlist )( unit( i )->get_data( "playlist", NULL ) ) ); - Consumer consumer( ( mlt_consumer )( unit( i )->get_data( "consumer", NULL ) ) ); + Playlist playlist( ( mlt_playlist )( unit( i )->get_data( "playlist" ) ) ); + Consumer consumer( ( mlt_consumer )( unit( i )->get_data( "consumer" ) ) ); and use the standard MLT++ wrapping methods to interact with them or you can bypass these and using the C API directly. @@ -266,8 +266,7 @@ HANDLING PUSHED DOCUMENTS Response *push( char *command, Service *service ) { - int size; - Playlist playlist( ( mlt_playlist )( unit( 0 )->get_data( "playlist", size ) ) ); + Playlist playlist( ( mlt_playlist )( unit( 0 )->get_data( "playlist" ) ) ); Producer producer( *service ); if ( producer.is_valid( ) && playlist.is_valid( ) ) { @@ -321,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 @@ -331,7 +356,7 @@ EVENT HANDLING on 'consumer-frame-render' - this event is fired immediately before a frame is rendered. - TBD + See example in test/server.cpp DISABLING DVCP