add MltProfile and update examples
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 2 Feb 2008 09:05:43 +0000 (09:05 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 2 Feb 2008 09:05:43 +0000 (09:05 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@1054 d19143bc-622f-0410-bfdd-b5b2a6649095

33 files changed:
mlt++/src/Makefile
mlt++/src/Mlt.h
mlt++/src/MltConsumer.cpp
mlt++/src/MltConsumer.h
mlt++/src/MltFactory.cpp
mlt++/src/MltFactory.h
mlt++/src/MltFilter.cpp
mlt++/src/MltFilter.h
mlt++/src/MltFilteredConsumer.cpp
mlt++/src/MltFilteredConsumer.h
mlt++/src/MltFilteredProducer.cpp
mlt++/src/MltFilteredProducer.h
mlt++/src/MltProducer.cpp
mlt++/src/MltProducer.h
mlt++/src/MltProfile.cpp [new file with mode: 0644]
mlt++/src/MltProfile.h [new file with mode: 0644]
mlt++/src/MltPushConsumer.cpp
mlt++/src/MltPushConsumer.h
mlt++/src/MltService.cpp
mlt++/src/MltService.h
mlt++/src/MltTractor.cpp
mlt++/src/MltTractor.h
mlt++/src/MltTransition.cpp
mlt++/src/MltTransition.h
mlt++/swig/mltpp.i
mlt++/swig/perl/play.pl
mlt++/swig/python/play.py
mlt++/swig/ruby/miracle.rb
mlt++/swig/ruby/play.rb
mlt++/swig/ruby/thumbs.rb
mlt++/swig/tcl/play.tcl
mlt++/test/play.cpp
mlt++/test/server.cpp

index eed0512..9dc09c6 100644 (file)
@@ -25,6 +25,7 @@ OBJS = MltConsumer.o \
           MltParser.o \
           MltPlaylist.o \
           MltProducer.o \
+          MltProfile.o \
           MltProperties.o \
           MltPushConsumer.o \
           MltResponse.o \
index 7abb1dc..0a8e4e8 100644 (file)
@@ -37,6 +37,7 @@
 #include "MltParser.h"
 #include "MltPlaylist.h"
 #include "MltProducer.h"
+#include "MltProfile.h"
 #include "MltProperties.h"
 #include "MltPushConsumer.h"
 #ifndef WIN32
index 0a0a402..a36b63e 100644 (file)
 #include <string.h>
 #include "MltConsumer.h"
 #include "MltEvent.h"
+#include "MltProfile.h"
 using namespace Mlt;
 
 Consumer::Consumer( ) :
        instance( NULL )
 {
-       instance = mlt_factory_consumer( NULL, NULL );
+       instance = mlt_factory_consumer( NULL, NULL, NULL );
 }
 
-Consumer::Consumer( char *id, char *arg ) :
+Consumer::Consumer( Profile& profile ) :
+       instance( NULL )
+{
+       instance = mlt_factory_consumer( profile.get_profile(), NULL, NULL );
+}
+
+Consumer::Consumer( Profile& profile, char *id, char *arg ) :
        instance( NULL )
 {
        if ( id == NULL || arg != NULL )
        {
-               instance = mlt_factory_consumer( id, arg );
+               instance = mlt_factory_consumer( profile.get_profile(), id, arg );
        }
        else
        {
@@ -44,12 +51,12 @@ Consumer::Consumer( char *id, char *arg ) :
                        char *temp = strdup( id );
                        char *arg = strchr( temp, ':' ) + 1;
                        *( arg - 1 ) = '\0';
-                       instance = mlt_factory_consumer( temp, arg );
+                       instance = mlt_factory_consumer( profile.get_profile(), temp, arg );
                        free( temp );
                }
                else
                {
-                       instance = mlt_factory_consumer( id, NULL );
+                       instance = mlt_factory_consumer( profile.get_profile(), id, NULL );
                }
        }
 }
index dc4c87d..52a2882 100644 (file)
@@ -30,6 +30,7 @@
 namespace Mlt
 {
        class Service;
+       class Profile;
 
        class MLTPP_DECLSPEC Consumer : public Service
        {
@@ -37,7 +38,8 @@ namespace Mlt
                        mlt_consumer instance;
                public:
                        Consumer( );
-                       Consumer( char *id , char *service = NULL );
+                       Consumer( Profile& profile );
+                       Consumer( Profile& profile, char *id , char *service = NULL );
                        Consumer( Service &consumer );
                        Consumer( Consumer &consumer );
                        Consumer( mlt_consumer consumer );
index f32018a..38a4200 100644 (file)
@@ -1,6 +1,7 @@
 /**
  * MltFactory.cpp - MLT Wrapper
  * Copyright (C) 2004-2005 Charles Yates
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
  * Author: Charles Yates <charles.yates@pandora.be>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -35,24 +36,24 @@ Properties *Factory::event_object( )
        return new Properties( mlt_factory_event_object( ) );
 }
 
-Producer *Factory::producer( char *id, char *arg )
+Producer *Factory::producer( Profile& profile, char *id, char *arg )
 {
-       return new Producer( id, arg );
+       return new Producer( profile, id, arg );
 }
 
-Filter *Factory::filter( char *id, char *arg )
+Filter *Factory::filter( Profile& profile, char *id, char *arg )
 {
-       return new Filter( id, arg );
+       return new Filter( profile, id, arg );
 }
 
-Transition *Factory::transition( char *id, char *arg )
+Transition *Factory::transition( Profile& profile, char *id, char *arg )
 {
-       return new Transition( id, arg );
+       return new Transition( profile, id, arg );
 }
 
-Consumer *Factory::consumer( char *id, char *arg )
+Consumer *Factory::consumer( Profile& profile, char *id, char *arg )
 {
-       return new Consumer( id, arg );
+       return new Consumer( profile, id, arg );
 }
 
 #ifdef WIN32
index f92cedb..db4cfa9 100644 (file)
@@ -36,16 +36,17 @@ namespace Mlt
        class Filter;
        class Transition;
        class Consumer;
+       class Profile;
 
        class MLTPP_DECLSPEC Factory
        {
                public:
                        static int init( char *arg = NULL );
                        static Properties *event_object( );
-                       static Producer *producer( char *id, char *arg = NULL );
-                       static Filter *filter( char *id, char *arg = NULL );
-                       static Transition *transition( char *id, char *arg = NULL );
-                       static Consumer *consumer( char *id, char *arg = NULL );
+                       static Producer *producer( Profile& profile, char *id, char *arg = NULL );
+                       static Filter *filter( Profile& profile, char *id, char *arg = NULL );
+                       static Transition *transition( Profile& profile, char *id, char *arg = NULL );
+                       static Consumer *consumer( Profile& profile, char *id, char *arg = NULL );
 #ifdef WIN32
                        static char *getenv( const char * );
                        static int setenv( const char *, const char * );
index 90a178e..f6aea23 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include "MltFilter.h"
+#include "MltProfile.h"
 using namespace Mlt;
 
-Filter::Filter( char *id, char *arg ) :
+Filter::Filter( Profile& profile, char *id, char *arg ) :
        instance( NULL )
 {
        if ( arg != NULL )
        {
-               instance = mlt_factory_filter( id, arg );
+               instance = mlt_factory_filter( profile.get_profile(), id, arg );
        }
        else
        {
@@ -37,12 +38,12 @@ Filter::Filter( char *id, char *arg ) :
                        char *temp = strdup( id );
                        char *arg = strchr( temp, ':' ) + 1;
                        *( arg - 1 ) = '\0';
-                       instance = mlt_factory_filter( temp, arg );
+                       instance = mlt_factory_filter( profile.get_profile(), temp, arg );
                        free( temp );
                }
                else
                {
-                       instance = mlt_factory_filter( id, NULL );
+                       instance = mlt_factory_filter( profile.get_profile(), id, NULL );
                }
        }
 }
index 3be254c..8efb4e4 100644 (file)
 namespace Mlt
 {
        class Service;
+       class Profile;
 
        class MLTPP_DECLSPEC Filter : public Service
        {
                private:
                        mlt_filter instance;
                public:
-                       Filter( char *id, char *service = NULL );
+                       Filter( Profile& profile, char *id, char *service = NULL );
                        Filter( Service &filter );
                        Filter( Filter &filter );
                        Filter( mlt_filter filter );
index d414da9..73ee474 100644 (file)
@@ -21,8 +21,8 @@
 #include "MltFilteredConsumer.h"
 using namespace Mlt;
 
-FilteredConsumer::FilteredConsumer( char *id, char *arg ) :
-       Consumer( id, arg )
+FilteredConsumer::FilteredConsumer( Profile& profile, char *id, char *arg ) :
+       Consumer( profile, id, arg )
 {
        // Create a reference to the first service
        first = new Service( *this );
index f1c1fff..21427ec 100644 (file)
@@ -32,13 +32,14 @@ namespace Mlt
        class Consumer;
        class Service;
        class Filter;
+       class Profile;
 
        class MLTPP_DECLSPEC FilteredConsumer : public Consumer
        {
                private:
                        Service *first;
                public:
-                       FilteredConsumer( char *id, char *arg = NULL );
+                       FilteredConsumer( Profile& profile, char *id, char *arg = NULL );
                        FilteredConsumer( Consumer &consumer );
                        virtual ~FilteredConsumer( );
                        int connect( Service &service );
index 95a322c..33d8a81 100644 (file)
@@ -21,8 +21,8 @@
 #include "MltFilteredProducer.h"
 using namespace Mlt;
 
-FilteredProducer::FilteredProducer( char *id, char *arg ) :
-       Producer( id, arg )
+FilteredProducer::FilteredProducer( Profile& profile, char *id, char *arg ) :
+       Producer( profile, id, arg )
 {
        // Create a reference to the last service
        last = new Service( *this );
index ce76c86..943f620 100644 (file)
@@ -32,13 +32,14 @@ namespace Mlt
        class Producer;
        class Service;
        class Filter;
+       class Profile;
 
        class MLTPP_DECLSPEC FilteredProducer : public Producer
        {
                private:
                        Service *last;
                public:
-                       FilteredProducer( char *id, char *arg = NULL );
+                       FilteredProducer( Profile* profile, char *id, char *arg = NULL );
                        virtual ~FilteredProducer( );
                        int attach( Filter &filter );
                        int detach( Filter &filter );
index 1b06e91..39a93db 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "MltProducer.h"
 #include "MltFilter.h"
+#include "MltProfile.h"
 using namespace Mlt;
 
 Producer::Producer( ) :
@@ -28,14 +29,14 @@ Producer::Producer( ) :
 {
 }
 
-Producer::Producer( char *id, char *service ) :
+Producer::Producer( Profile& profile, char *id, char *service ) :
        instance( NULL ),
        parent_( NULL )
 {
        if ( id != NULL && service != NULL )
-               instance = mlt_factory_producer( id, service );
+               instance = mlt_factory_producer( profile.get_profile(), id, service );
        else
-               instance = mlt_factory_producer( "fezzik", id != NULL ? id : service );
+               instance = mlt_factory_producer( profile.get_profile(), "fezzik", id != NULL ? id : service );
 }
 
 Producer::Producer( Service &producer ) :
index 35c2f0e..09a4977 100644 (file)
@@ -31,6 +31,7 @@ namespace Mlt
 {
        class Service;
        class Filter;
+       class Profile;
 
        class MLTPP_DECLSPEC Producer : public Service
        {
@@ -39,7 +40,7 @@ namespace Mlt
                        Producer *parent_;
                public:
                        Producer( );
-                       Producer( char *id, char *service = NULL );
+                       Producer( Profile& profile, char *id, char *service = NULL );
                        Producer( Service &producer );
                        Producer( mlt_producer producer );
                        Producer( Producer &producer );
diff --git a/mlt++/src/MltProfile.cpp b/mlt++/src/MltProfile.cpp
new file mode 100644 (file)
index 0000000..0df73dc
--- /dev/null
@@ -0,0 +1,122 @@
+/**
+ * MltProfile.cpp - MLT Wrapper
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "MltProfile.h"
+#include "MltProperties.h"
+using namespace Mlt;
+
+Profile::Profile( ) :
+       instance( NULL )
+{
+       instance = mlt_profile_init( NULL );
+}
+
+Profile::Profile( const char* name ) :
+       instance( NULL )
+{
+       instance = mlt_profile_init( name );
+}
+
+Profile::Profile( Properties& properties ) :
+       instance( NULL )
+{
+       instance = mlt_profile_load_properties( properties.get_properties() );
+}
+
+Profile::Profile( mlt_profile profile ) :
+       instance( profile )
+{
+}
+
+Profile::~Profile( )
+{
+       if ( instance )
+               mlt_profile_close( instance );
+       instance = NULL;
+}
+
+mlt_profile Profile::get_profile( ) const
+{
+       return instance;
+}
+
+char* Profile::description() const
+{
+       return instance->description;
+}
+
+int Profile::frame_rate_num() const
+{
+       return instance->frame_rate_num;
+}
+
+int Profile::frame_rate_den() const
+{
+       return instance->frame_rate_den;
+}
+
+double Profile::fps() const
+{
+       return mlt_profile_fps( instance );
+}
+
+int Profile::width() const
+{
+       return instance->width;
+}
+
+int Profile::height() const
+{
+       return instance->height;
+}
+
+bool Profile::progressive() const
+{
+       return instance->progressive;
+}
+
+int Profile::sample_aspect_num() const
+{
+       return instance->sample_aspect_num;
+}
+
+int Profile::sample_aspect_den() const
+{
+       return instance->sample_aspect_den;
+}
+
+double Profile::sar() const
+{
+       return mlt_profile_sar( instance );
+}
+
+int Profile::display_aspect_num() const
+{
+       return instance->display_aspect_num;
+}
+
+int Profile::display_aspect_den() const
+{
+       return instance->display_aspect_den;
+}
+
+double Profile::dar() const
+{
+       return mlt_profile_dar( instance );
+}
diff --git a/mlt++/src/MltProfile.h b/mlt++/src/MltProfile.h
new file mode 100644 (file)
index 0000000..2a1f891
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+ * MltProfile.h - MLT Wrapper
+ * Copyright (C) 2008 Dan Dennedy <dan@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _MLTPP_PROFILE_H_
+#define _MLTPP_PROFILE_H_
+
+#include "config.h"
+
+#ifdef SWIG
+#define MLTPP_DECLSPEC
+#endif
+
+#include <framework/mlt.h>
+
+namespace Mlt
+{
+       class Properties;
+
+       class MLTPP_DECLSPEC Profile
+       {
+               private:
+                       mlt_profile instance;
+               public:
+                       Profile( );
+                       Profile( const char* name );
+                       Profile( Properties& properties );
+                       Profile( mlt_profile profile );
+                       ~Profile();
+
+                       mlt_profile get_profile( ) const;
+                       char* description() const;
+                       int frame_rate_num() const;
+                       int frame_rate_den() const;
+                       double fps() const;
+                       int width() const;
+                       int height() const;
+                       bool progressive() const;
+                       int sample_aspect_num() const;
+                       int sample_aspect_den() const;
+                       double sar() const;
+                       int display_aspect_num() const;
+                       int display_aspect_den() const;
+                       double dar() const;
+       };
+}
+
+#endif
index 7d96218..041687f 100644 (file)
@@ -39,8 +39,8 @@ static void filter_destructor( void *arg )
        delete filter;
 }
 
-PushConsumer::PushConsumer( char *id , char *service ) :
-       Consumer( id, service ),
+PushConsumer::PushConsumer( Profile& profile, char *id , char *service ) :
+       Consumer( profile, id, service ),
        m_private( new PushPrivate( ) )
 {
        if ( is_valid( ) )
@@ -53,20 +53,20 @@ PushConsumer::PushConsumer( char *id , char *service ) :
 
                // We might need resize and rescale filters so we'll create them now
                // NB: Try to use the best rescaler available here
-               Filter *resize = new Filter( "resize" );
-               Filter *rescale = new Filter( "mcrescale" );
+               Filter *resize = new Filter( profile, "resize" );
+               Filter *rescale = new Filter( profile, "mcrescale" );
                if ( !rescale->is_valid( ) )
                {
                        delete rescale;
-                       rescale = new Filter( "gtkrescale" );
+                       rescale = new Filter( profile, "gtkrescale" );
                }
                if ( !rescale->is_valid( ) )
                {
                        delete rescale;
-                       rescale = new Filter( "rescale" );
+                       rescale = new Filter( profile, "rescale" );
                }
 
-               Filter *convert = new Filter( "avcolour_space" );
+               Filter *convert = new Filter( profile, "avcolour_space" );
 
                set( "filter_convert", convert, 0, filter_destructor );
                set( "filter_resize", resize, 0, filter_destructor );
@@ -136,7 +136,7 @@ int PushConsumer::drain( )
 // Convenience function - generates a frame with an image of a given size
 Frame *PushConsumer::construct( int size )
 {
-       mlt_frame f = mlt_frame_init( );
+       mlt_frame f = mlt_frame_init( get_service() );
        Frame *frame = new Frame( f );
        uint8_t *buffer = ( uint8_t * )mlt_pool_alloc( size );
        frame->set( "image", buffer, size, mlt_pool_release );
index 105d7fa..1eacf93 100644 (file)
@@ -30,13 +30,14 @@ namespace Mlt
        class Frame;
        class Service;
        class PushPrivate;
+       class Profile;
 
        class MLTPP_DECLSPEC PushConsumer : public Consumer
        {
                private:
                        PushPrivate *m_private;
                public:
-                       PushConsumer( char *id , char *service = NULL );
+                       PushConsumer( Profile& profile, char *id , char *service = NULL );
                        virtual ~PushConsumer( );
                        void set_render( int width, int height, double aspect_ratio );
                        virtual int connect( Service &service );
index 078a289..88751ab 100644 (file)
@@ -21,6 +21,7 @@
 #include <string.h>
 #include "MltService.h"
 #include "MltFilter.h"
+#include "MltProfile.h"
 using namespace Mlt;
 
 Service::Service( ) :
@@ -83,6 +84,11 @@ Service *Service::consumer( )
        return new Service( mlt_service_consumer( get_service( ) ) );
 }
 
+Profile *Service::profile( )
+{
+       return new Profile( mlt_service_profile( get_service() ) );
+}
+
 Frame *Service::get_frame( int index )
 {
        mlt_frame frame = NULL;
index aa2c0e2..2079614 100644 (file)
@@ -33,6 +33,7 @@ namespace Mlt
        class Properties;
        class Filter;
        class Frame;
+       class Profile;
 
        class MLTPP_DECLSPEC Service : public Properties
        {
@@ -50,6 +51,7 @@ namespace Mlt
                        int connect_producer( Service &producer, int index = 0 );
                        Service *consumer( );
                        Service *producer( );
+                       Profile *profile( );
                        Frame *get_frame( int index = 0 );
                        mlt_service_type type( );
                        int attach( Filter &filter );
index 09e53eb..ab29155 100644 (file)
@@ -53,10 +53,10 @@ Tractor::Tractor( Tractor &tractor ) :
        inc_ref( );
 }
 
-Tractor::Tractor( char *id, char *resource ) :
+Tractor::Tractor( Profile& profile, char *id, char *resource ) :
        instance( NULL )
 {
-       Producer producer( id, resource );
+       Producer producer( profile, id, resource );
        if ( producer.is_valid( ) && producer.type( ) == tractor_type )
        {
                instance = ( mlt_tractor )producer.get_producer( );
index 3b220aa..9fe5d79 100644 (file)
@@ -34,6 +34,7 @@ namespace Mlt
        class Multitrack;
        class Transition;
        class Filter;
+       class Profile;
 
        class MLTPP_DECLSPEC Tractor : public Producer
        {
@@ -44,7 +45,7 @@ namespace Mlt
                        Tractor( Service &tractor );
                        Tractor( mlt_tractor tractor );
                        Tractor( Tractor &tractor );
-                       Tractor( char *id, char *arg = NULL );
+                       Tractor( Profile& profile, char *id, char *arg = NULL );
                        virtual ~Tractor( );
                        virtual mlt_tractor get_tractor( );
                        mlt_producer get_producer( );
index 5a18c8e..34fa531 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include "MltTransition.h"
+#include "MltProfile.h"
 using namespace Mlt;
 
-Transition::Transition( char *id, char *arg ) :
+Transition::Transition( Profile& profile, char *id, char *arg ) :
        instance( NULL )
 {
        if ( arg != NULL )
        {
-               instance = mlt_factory_transition( id, arg );
+               instance = mlt_factory_transition( profile.get_profile(), id, arg );
        }
        else
        {
@@ -37,12 +38,12 @@ Transition::Transition( char *id, char *arg ) :
                        char *temp = strdup( id );
                        char *arg = strchr( temp, ':' ) + 1;
                        *( arg - 1 ) = '\0';
-                       instance = mlt_factory_transition( temp, arg );
+                       instance = mlt_factory_transition( profile.get_profile(), temp, arg );
                        free( temp );
                }
                else
                {
-                       instance = mlt_factory_transition( id, NULL );
+                       instance = mlt_factory_transition( profile.get_profile(), id, NULL );
                }
        }
 }
index 66ed23f..e0559af 100644 (file)
 namespace Mlt
 {
        class Service;
+       class Profile;
 
        class MLTPP_DECLSPEC Transition : public Service
        {
                private:
                        mlt_transition instance;
                public:
-                       Transition( char *id, char *arg = NULL );
+                       Transition( Profile& profile, char *id, char *arg = NULL );
                        Transition( Service &transition );
                        Transition( Transition &transition );
                        Transition( mlt_transition transition );
index 60d842d..e456af8 100644 (file)
  */
 
 namespace Mlt {
-%newobject Factory::producer( char *, char * );
-%newobject Factory::filter( char *, char * );
-%newobject Factory::transition( char *, char * );
-%newobject Factory::consumer( char *, char * );
+%newobject Factory::producer( Profile &, char *, char * );
+%newobject Factory::filter( Profile &, char *, char * );
+%newobject Factory::transition( Profile &, char *, char * );
+%newobject Factory::consumer( Profile &, char *, char * );
 %newobject Properties::listen( char *, void *, mlt_listener );
 %newobject Service::producer( );
 %newobject Service::consumer( );
@@ -66,6 +66,7 @@ namespace Mlt {
 %include <MltGeometry.h>
 %include <MltService.h>
 %include <MltProducer.h>
+%include <MltProfile.h>
 %include <MltPlaylist.h>
 %include <MltConsumer.h>
 %include <MltFilter.h>
index aae79e3..87047b9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/env perl
+#!/usr/bin/env perl
 
 # Import required modules
 use mltpp;
@@ -6,8 +6,11 @@ use mltpp;
 # Not sure why the mltpp::Factory.init method fails...
 mltpp::mlt_factory_init( undef );
 
+# Establish the MLT profile
+$profile = new mltpp::Profile( undef );
+
 # Create the producer
-$p = new mltpp::Producer( $ARGV[0] );
+$p = new mltpp::Producer( $profile, $ARGV[0] );
 
 if ( $p->is_valid( ) )
 {
@@ -15,7 +18,7 @@ if ( $p->is_valid( ) )
        $p->set( "eof", "loop" );
 
        # Create the consumer
-       $c = new mltpp::FilteredConsumer( "sdl" );
+       $c = new mltpp::FilteredConsumer( $profile, "sdl" );
 
        # Turn of the default rescaling
        $c->set( "rescale", "none" );
index 70be84d..ce45c7b 100755 (executable)
@@ -8,12 +8,15 @@ import sys
 # Start the mlt system
 mltpp.Factory.init( )
 
+# Establish a profile
+profile = mltpp.Profile( )
+
 # Create the producer
-p = mltpp.Producer( sys.argv[1] )
+p = mltpp.Producer( profile, sys.argv[1] )
 
 if p:
        # Create the consumer
-       c = mltpp.Consumer( "sdl" )
+       c = mltpp.Consumer( profile, "sdl" )
 
        # Turn off the default rescaling
        c.set( "rescale", "none" )
index 2b5afc0..1340a6c 100755 (executable)
@@ -1,3 +1,5 @@
+#!/usr/bin/env ruby
+
 require 'mltpp'
 
 def command 
index 9577e4e..1ec995b 100755 (executable)
@@ -6,16 +6,19 @@ require 'mltpp'
 # Create the mlt system
 Mltpp::Factory::init
 
+# Establish the mlt profile
+profile = Mltpp::Profile.new
+
 # Get and check the argument
 file = ARGV.shift
 raise "Usage: test.rb file" if file.nil?
 
 # Create the producer
-producer = Mltpp::Factory::producer( file )
+producer = Mltpp::Factory::producer( profile, file )
 raise "Unable to load #{file}" if !producer.is_valid
 
 # Create the consumer
-consumer = Mltpp::Consumer.new( "sdl" )
+consumer = Mltpp::Consumer.new( profile, "sdl" )
 raise "Unable to open sdl consumer" if !consumer.is_valid
 
 # Turn off the default rescaling
index 9e28782..f91c598 100755 (executable)
@@ -6,6 +6,9 @@ require 'mltpp'
 # Create the mlt system
 Mltpp::Factory::init
 
+# Establish the mlt profile
+profile = Mltpp::Profile.new
+
 # Get and check the argument
 file = ARGV.shift
 name = ARGV.shift
@@ -14,7 +17,7 @@ size = "192x144" if size.nil?
 raise "Usage: thumbs.rb file name [ size ]" if file.nil? || name.nil?
 
 # Create the producer
-producer = Mltpp::Producer.new( file )
+producer = Mltpp::Producer.new( profile, file )
 raise "Unable to load #{file}" if !producer.is_valid
 
 # Construct the playlist
@@ -27,7 +30,7 @@ out = producer.get_int( "out" );
 [ 0, 0.25, 0.5, 0.75, 1 ].each { |x| playlist.append( producer, x*out, x*out ) }
 
 # Create the thumb nail generator
-generator = Mltpp::Consumer.new( "avformat", "#{name}%d.jpg" )
+generator = Mltpp::Consumer.new( profile, "avformat", "#{name}%d.jpg" )
 generator.set( "real_time", "0" )
 generator.set( "progressive", "1" )
 generator.set( "size", size )
index 5180b93..2b182c7 100755 (executable)
@@ -1,10 +1,11 @@
-#!/bin/env tclsh
+#!/usr/bin/env tclsh
 
 load mltpp.so
 mltpp.Factory.init
+set profile [Profile]
 set arg1 [lindex $argv 0]
-set p [factory_producer fezzik $arg1]
-set c [factory_consumer sdl ""]
+set p [factory_producer $profile fezzik $arg1]
+set c [factory_consumer $profile sdl ""]
 set r [mlt_consumer_properties $c]
 mlt_properties_set $r "rescale" "none"
 consumer_connect $c $p
index 459875d..f759374 100644 (file)
@@ -5,8 +5,9 @@ using namespace Mlt;
 int main( int argc, char **argv )
 {
        Factory::init( NULL );
-       Producer producer( argv[ 1 ] );
-       Consumer consumer;
+       Profile profile;
+       Producer producer( profile, argv[ 1 ] );
+       Consumer consumer( profile );
        consumer.set( "rescale", "none" );
        consumer.connect( producer );
        consumer.run( );
index bcedd6f..ce6b869 100644 (file)
@@ -10,6 +10,7 @@ class Custom : public Miracle
 {
        private:
                Event *event;
+               Profile profile;
 
        public:
                Custom( char *name = "Custom", int port = 5290, char *config = NULL ) :
@@ -29,7 +30,7 @@ class Custom : public Miracle
                Response *received( char *command, char *document )
                {
                        cerr << document << endl;
-                       Producer producer( "westley-xml", document );
+                       Producer producer( profile, "westley-xml", document );
                        return push( command, &producer );
                }