From 96f33fa9a85baf3b53d1a6961a70bb6f123fa11a Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Wed, 18 Aug 2004 11:02:22 +0000 Subject: [PATCH 1/1] image handling git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt++@376 d19143bc-622f-0410-bfdd-b5b2a6649095 --- mlt++/src/MltFrame.cpp | 15 +++++++++++++++ mlt++/src/MltFrame.h | 1 + mlt++/src/MltProducer.cpp | 16 ++++++++-------- mlt++/src/MltProducer.h | 16 ++++++++-------- mlt++/src/MltService.cpp | 2 +- mlt++/swig/mltpp.i | 2 ++ mlt++/swig/ruby/play.rb | 2 +- 7 files changed, 36 insertions(+), 18 deletions(-) diff --git a/mlt++/src/MltFrame.cpp b/mlt++/src/MltFrame.cpp index c12adf8..0595a68 100644 --- a/mlt++/src/MltFrame.cpp +++ b/mlt++/src/MltFrame.cpp @@ -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; } diff --git a/mlt++/src/MltFrame.h b/mlt++/src/MltFrame.h index 7a8039a..c5cd502 100644 --- a/mlt++/src/MltFrame.h +++ b/mlt++/src/MltFrame.h @@ -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 ); }; } diff --git a/mlt++/src/MltProducer.cpp b/mlt++/src/MltProducer.cpp index 177c8e7..5a536c7 100644 --- a/mlt++/src/MltProducer.cpp +++ b/mlt++/src/MltProducer.cpp @@ -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( ) ); } diff --git a/mlt++/src/MltProducer.h b/mlt++/src/MltProducer.h index e3572d8..d2963d1 100644 --- a/mlt++/src/MltProducer.h +++ b/mlt++/src/MltProducer.h @@ -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( ); }; } diff --git a/mlt++/src/MltService.cpp b/mlt++/src/MltService.cpp index 4e70a01..c058c38 100644 --- a/mlt++/src/MltService.cpp +++ b/mlt++/src/MltService.cpp @@ -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 ); } diff --git a/mlt++/swig/mltpp.i b/mlt++/swig/mltpp.i index 31f0b39..71ebc43 100644 --- a/mlt++/swig/mltpp.i +++ b/mlt++/swig/mltpp.i @@ -19,6 +19,8 @@ */ %module mltpp +%include "carrays.i" +%array_class(unsigned char, unsignedCharArray); %{ #include diff --git a/mlt++/swig/ruby/play.rb b/mlt++/swig/ruby/play.rb index 793a618..09f900b 100755 --- a/mlt++/swig/ruby/play.rb +++ b/mlt++/swig/ruby/play.rb @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # Import required modules require 'mltpp' -- 1.7.4.4