]> git.sesse.net Git - mlt/blobdiff - src/swig/mlt.i
Initial implementation of producer_qtext
[mlt] / src / swig / mlt.i
index 84a7184d6f20148b988da9b2d860ea390d13e9c5..c3deaeb9af87c85c6fec2a6c5eedb104512ea633 100644 (file)
@@ -24,6 +24,8 @@
 
 %{
 #include <mlt++/Mlt.h>
+int mlt_log_get_level( void );
+void mlt_log_set_level( int );
 %}
 
 /** These methods return objects which should be gc'd.
@@ -35,7 +37,9 @@ namespace Mlt {
 %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 Properties::listen( const char *, void *, mlt_listener );
+%newobject Properties::setup_wait_for( const char * );
+%newobject Properties::parse_yaml( const char * );
 %newobject Service::producer( );
 %newobject Service::consumer( );
 %newobject Service::get_frame( int );
@@ -55,6 +59,19 @@ namespace Mlt {
 %newobject Repository::producers( );
 %newobject Repository::transitions( );
 %newobject Repository::metadata( mlt_service_type, const char * );
+%newobject Repository::languages( );
+%newobject Profile::list();
+%newobject Repository::presets();
+
+#if defined(SWIGPYTHON)
+%feature("shadow") Frame::get_waveform(int, int) %{
+    def get_waveform(*args): return _mlt.frame_get_waveform(*args)
+%}
+%feature("shadow") Frame::get_image(mlt_image_format&, int&, int&) %{
+    def get_image(*args): return _mlt.frame_get_image(*args)
+%}
+#endif
+
 }
 
 /** Classes to wrap.
@@ -62,6 +79,9 @@ namespace Mlt {
 
 %include <framework/mlt_types.h>
 %include <framework/mlt_factory.h>
+%include <framework/mlt_version.h>
+int mlt_log_get_level( void );
+void mlt_log_set_level( int );
 %include <MltFactory.h>
 %include <MltRepository.h>
 %include <MltEvent.h>
@@ -81,6 +101,8 @@ namespace Mlt {
 %include <MltParser.h>
 %include <MltFilteredConsumer.h>
 
+
+
 #if defined(SWIGRUBY)
 
 %{
@@ -89,28 +111,31 @@ static void ruby_listener( mlt_properties owner, void *object );
 
 class RubyListener
 {
-       private:
+       protected:
                VALUE callback;
                Mlt::Event *event;
 
        public:
-               RubyListener( Mlt::Properties &properties, char *id, VALUE callback ) : 
+               RubyListener( VALUE callback ) : callback( callback )
+               {}
+
+               RubyListener( Mlt::Properties &properties, char *id, VALUE callback ) :
                        callback( callback ) 
                {
                        event = properties.listen( id, this, ( mlt_listener )ruby_listener );
                }
 
-               ~RubyListener( )
+               virtual ~RubyListener( )
                {
                        delete event;
                }
 
-       void mark( ) 
+               void mark( )
                { 
                        ((void (*)(VALUE))(rb_gc_mark))( callback ); 
                }
 
-       void doit( ) 
+               void doit( )
                {
                ID method = rb_intern( "call" );
                rb_funcall( callback, method, 0 );
@@ -129,17 +154,93 @@ void markRubyListener( void* p )
     o->mark( );
 }
 
+static void on_playlist_next( mlt_properties owner, void *object, int i );
+
+class PlaylistNextListener : RubyListener
+{
+       private:
+               Mlt::Event *event;
+
+       public:
+               PlaylistNextListener( Mlt::Properties *properties, VALUE proc )
+                       : RubyListener( proc )
+               {
+                       event = properties->listen( "playlist-next", this, ( mlt_listener )on_playlist_next );
+               }
+
+               ~PlaylistNextListener()
+               {
+                       delete event;
+               }
+
+               void yield( int i )
+               {
+                       ID method = rb_intern( "call" );
+                       rb_funcall( callback, method, 1, INT2FIX( i ) );
+               }
+};
+
+static void on_playlist_next( mlt_properties owner, void *object, int i )
+{
+       PlaylistNextListener *o = static_cast< PlaylistNextListener * >( object );
+       o->yield( i );
+}
+
 %}
 
 // Ruby wrapper
 %rename( Listener )  RubyListener;
 %markfunc RubyListener "markRubyListener";
+%markfunc PlaylistNextListener "markRubyListener";
 
-class RubyListener 
+class RubyListener
 {
        public:
                RubyListener( Mlt::Properties &properties, char *id, VALUE callback );
 };
 
-#endif
+class PlaylistNextListener
+{
+       public:
+               PlaylistNextListener( Mlt::Properties *properties, VALUE proc );
+};
+
+#endif // SWIGGRUBY
+
+
+
+#if defined(SWIGPYTHON)
+%{
+typedef struct {
+       int size;
+       char* data;
+} binary_data;
 
+binary_data frame_get_waveform( Mlt::Frame &frame, int w, int h )
+{
+       binary_data result = {
+               w * h,
+               (char*) frame.get_waveform( w, h )
+       };
+       return result;
+}
+
+binary_data frame_get_image( Mlt::Frame &frame, mlt_image_format format, int w, int h )
+{
+       binary_data result = {
+               mlt_image_format_size( format, w, h, NULL ),
+               (char*) frame.get_image( format, w, h )
+       };
+       return result;
+}
+
+%}
+
+%typemap(out) binary_data {
+       $result = PyString_FromStringAndSize( $1.data, $1.size );
+}
+
+binary_data frame_get_waveform(Mlt::Frame&, int, int);
+binary_data frame_get_image(Mlt::Frame&, mlt_image_format, int, int);
+
+#endif