buffer fix and tractor handling
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Thu, 14 Oct 2004 22:09:46 +0000 (22:09 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Thu, 14 Oct 2004 22:09:46 +0000 (22:09 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@478 d19143bc-622f-0410-bfdd-b5b2a6649095

mlt++/src/MltConsumer.cpp
mlt++/src/MltConsumer.h
mlt++/test/play.cpp

index 657c816..0a0a402 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include "MltConsumer.h"
+#include "MltEvent.h"
 using namespace Mlt;
 
+Consumer::Consumer( ) :
+       instance( NULL )
+{
+       instance = mlt_factory_consumer( NULL, NULL );
+}
+
 Consumer::Consumer( char *id, char *arg ) :
        instance( NULL )
 {
-       if ( arg != NULL )
+       if ( id == NULL || arg != NULL )
        {
                instance = mlt_factory_consumer( id, arg );
        }
@@ -109,3 +116,14 @@ bool Consumer::is_stopped( )
        return mlt_consumer_is_stopped( get_consumer( ) ) != 0;
 }
 
+int Consumer::run( )
+{
+       int ret = start( );
+       if ( !is_stopped( ) )
+       {
+               Event *e = setup_wait_for( "consumer-stopped" );
+               wait_for( e );
+               delete e;
+       }
+       return ret;
+}
index 96d3c33..17eda60 100644 (file)
@@ -34,7 +34,8 @@ namespace Mlt
                private:
                        mlt_consumer instance;
                public:
-                       Consumer( char *id, char *service = NULL );
+                       Consumer( );
+                       Consumer( char *id , char *service = NULL );
                        Consumer( Service &consumer );
                        Consumer( Consumer &consumer );
                        Consumer( mlt_consumer consumer );
@@ -42,6 +43,7 @@ namespace Mlt
                        virtual mlt_consumer get_consumer( );
                        mlt_service get_service( );
                        virtual int connect( Service &service );
+                       int run( );
                        int start( );
                        void purge( );
                        int stop( );
index 6dfeb38..459875d 100644 (file)
@@ -6,11 +6,9 @@ int main( int argc, char **argv )
 {
        Factory::init( NULL );
        Producer producer( argv[ 1 ] );
-       Consumer consumer( "sdl" );
+       Consumer consumer;
        consumer.set( "rescale", "none" );
        consumer.connect( producer );
-       Event *event = consumer.setup_wait_for( "consumer-stopped" );
-       consumer.start( );
-       consumer.wait_for( event, false );
+       consumer.run( );
        return 0;
 }