image handling
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 18 Aug 2004 11:02:22 +0000 (11:02 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 18 Aug 2004 11:02:22 +0000 (11:02 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@376 d19143bc-622f-0410-bfdd-b5b2a6649095

mlt++/src/MltFrame.cpp
mlt++/src/MltFrame.h
mlt++/src/MltProducer.cpp
mlt++/src/MltProducer.h
mlt++/src/MltService.cpp
mlt++/swig/mltpp.i
mlt++/swig/ruby/play.rb

index c12adf8..0595a68 100644 (file)
@@ -52,7 +52,22 @@ mlt_properties Frame::get_properties( )
 uint8_t *Frame::get_image( mlt_image_format &format, int &w, int &h, int writable )
 {
        uint8_t *image = NULL;
+       if ( mlt_properties_get_int( get_properties( ), "consumer_aspect_ratio" ) == 0 )
+               mlt_properties_set_int( get_properties( ), "consumer_aspect_ratio", 1 );
        mlt_frame_get_image( get_frame( ), &image, &format, &w, &h, writable );
+       set( "format", format );
+       set( "writable", writable );
+       return image;
+}
+
+unsigned char *Frame::fetch_image( mlt_image_format f, int w, int h, int writable )
+{
+       uint8_t *image = NULL;
+       if ( mlt_properties_get_int( get_properties( ), "consumer_aspect_ratio" ) == 0 )
+               mlt_properties_set_int( get_properties( ), "consumer_aspect_ratio", 1 );
+       mlt_frame_get_image( get_frame( ), &image, &f, &w, &h, writable );
+       set( "format", f );
+       set( "writable", writable );
        return image;
 }
 
index 7a8039a..c5cd502 100644 (file)
@@ -40,6 +40,7 @@ namespace Mlt
                        virtual mlt_frame get_frame( );
                        mlt_properties get_properties( );
                        uint8_t *get_image( mlt_image_format &format, int &w, int &h, int writable = 0 );
+                       unsigned char *fetch_image( mlt_image_format format, int w, int h, int writable = 0 );
                        int16_t *get_audio( mlt_audio_format &format, int &frequency, int &channels, int &samples );
        };
 }
index 177c8e7..5a536c7 100644 (file)
@@ -65,17 +65,17 @@ mlt_service Producer::get_service( )
        return mlt_producer_service( get_producer( ) );
 }
        
-int Producer::seek( mlt_position position )
+int Producer::seek( int position )
 {
        return mlt_producer_seek( get_producer( ), position );
 }
 
-mlt_position Producer::position( )
+int Producer::position( )
 {
        return mlt_producer_position( get_producer( ) );
 }
 
-mlt_position Producer::frame( )
+int Producer::frame( )
 {
        return mlt_producer_frame( get_producer( ) );
 }
@@ -95,27 +95,27 @@ double Producer::get_fps( )
        return mlt_producer_get_fps( get_producer( ) );
 }
 
-int Producer::set_in_and_out( mlt_position in, mlt_position out )
+int Producer::set_in_and_out( int in, int out )
 {
        return mlt_producer_set_in_and_out( get_producer( ), in, out );
 }
 
-mlt_position Producer::get_in( )
+int Producer::get_in( )
 {
        return mlt_producer_get_in( get_producer( ) );
 }
 
-mlt_position Producer::get_out( )
+int Producer::get_out( )
 {
        return mlt_producer_get_out( get_producer( ) );
 }
 
-mlt_position Producer::get_length( )
+int Producer::get_length( )
 {
        return mlt_producer_get_length( get_producer( ) );
 }
 
-mlt_position Producer::get_playtime( )
+int Producer::get_playtime( )
 {
        return mlt_producer_get_playtime( get_producer( ) );
 }
index e3572d8..d2963d1 100644 (file)
@@ -42,17 +42,17 @@ namespace Mlt
                        virtual ~Producer( );
                        virtual mlt_producer get_producer( );
                        mlt_service get_service( );
-                       int seek( mlt_position position );
-                       mlt_position position( );
-                       mlt_position frame( );
+                       int seek( int position );
+                       int position( );
+                       int frame( );
                        int set_speed( double speed );
                        double get_speed( );
                        double get_fps( );
-                       int set_in_and_out( mlt_position in, mlt_position out );
-                       mlt_position get_in( );
-                       mlt_position get_out( );
-                       mlt_position get_length( );
-                       mlt_position get_playtime( );
+                       int set_in_and_out( int in, int out );
+                       int get_in( );
+                       int get_out( );
+                       int get_length( );
+                       int get_playtime( );
        };
 }
 
index 4e70a01..c058c38 100644 (file)
@@ -69,7 +69,7 @@ Service *Service::consumer( )
 Frame *Service::get_frame( int index )
 {
        mlt_frame frame = NULL;
-       mlt_service_get_frame( get_service( ), &frame, index );
+       mlt_service_get_frame( get_connection( ), &frame, index );
        return new Frame( frame );
 }
 
index 31f0b39..71ebc43 100644 (file)
@@ -19,6 +19,8 @@
  */
 
 %module mltpp
+%include "carrays.i"
+%array_class(unsigned char, unsignedCharArray);
 
 %{
 #include <mlt++/Mlt.h>
index 793a618..09f900b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby
+#!/usr/bin/env ruby
 
 # Import required modules
 require 'mltpp'