]> git.sesse.net Git - mlt/commitdiff
Add mlt_frame_set_image and mlt_frame_set_alpha.
authorDan Dennedy <dan@dennedy.org>
Mon, 7 Mar 2011 05:07:52 +0000 (21:07 -0800)
committerDan Dennedy <dan@dennedy.org>
Mon, 7 Mar 2011 05:07:52 +0000 (21:07 -0800)
src/framework/mlt_frame.c
src/framework/mlt_frame.h
src/mlt++/MltFrame.cpp
src/mlt++/MltFrame.h

index 8eac33cbb6a66e8da3ae760f625facc3a4cb825a..11b2b609f4292ffc9a5063f39a5eb1950fe98eeb 100644 (file)
@@ -295,6 +295,36 @@ mlt_deque mlt_frame_service_stack( mlt_frame self )
        return self->stack_service;
 }
 
+/** Set a new image on the frame.
+  *
+  * \public \memberof mlt_frame_s
+  * \param self a frame
+  * \param image a pointer to the raw image data
+  * \param size the size of the image data in bytes (optional)
+  * \param destroy a function to deallocate \p image when the frame is closed (optional)
+  * \return true if error
+  */
+
+int mlt_frame_set_image( mlt_frame self, uint8_t *image, int size, mlt_destructor destroy )
+{
+       return mlt_properties_set_data( MLT_FRAME_PROPERTIES( self ), "image", image, size, destroy, NULL );
+}
+
+/** Set a new alpha channel on the frame.
+  *
+  * \public \memberof mlt_frame_s
+  * \param self a frame
+  * \param alpha a pointer to the alpha channel
+  * \param size the size of the alpha channel in bytes (optional)
+  * \param destroy a function to deallocate \p alpha when the frame is closed (optional)
+  * \return true if error
+  */
+
+int mlt_frame_set_alpha( mlt_frame self, uint8_t *alpha, int size, mlt_destructor destroy )
+{
+       return mlt_properties_set_data( MLT_FRAME_PROPERTIES( self ), "alpha", alpha, size, destroy, NULL );
+}
+
 /** Replace image stack with the information provided.
  *
  * This might prove to be unreliable and restrictive - the idea is that a transition
index c87432789f3a9b8a3c5975cda3d3edb324b0ee47..ead3098a9a8ada4dafd0120bdaf0b71a2ada6a1f 100644 (file)
@@ -108,6 +108,8 @@ extern double mlt_frame_get_aspect_ratio( mlt_frame self );
 extern int mlt_frame_set_aspect_ratio( mlt_frame self, double value );
 extern mlt_position mlt_frame_get_position( mlt_frame self );
 extern int mlt_frame_set_position( mlt_frame self, mlt_position value );
+extern int mlt_frame_set_image( mlt_frame self, uint8_t *image, int size, mlt_destructor destroy );
+extern int mlt_frame_set_alpha( mlt_frame self, uint8_t *alpha, int size, mlt_destructor destroy );
 extern void mlt_frame_replace_image( mlt_frame self, uint8_t *image, mlt_image_format format, int width, int height );
 extern int mlt_frame_get_image( mlt_frame self, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable );
 extern uint8_t *mlt_frame_get_alpha_mask( mlt_frame self );
index 5924ec2f2d9d42d9fb249630a21c226f9f7496b2..30c30fd21a030b006004b0a737d481b5689be9d6 100644 (file)
@@ -89,3 +89,18 @@ Producer *Frame::get_original_producer( )
 {
        return new Producer( mlt_frame_get_original_producer( get_frame( ) ) );
 }
+
+mlt_properties Frame::get_unique_properties( Service &service )
+{
+       return mlt_frame_unique_properties( get_frame(), service.get_service() );
+}
+
+int Frame::set_image( uint8_t *image, int size, mlt_destructor destroy )
+{
+       return mlt_frame_set_image( get_frame(), image, size, destroy );
+}
+
+int Frame::set_alpha( uint8_t *alpha, int size, mlt_destructor destroy )
+{
+       return mlt_frame_set_alpha( get_frame(), alpha, size, destroy );
+}
index 4c2e3d76b875b9fd9896f3e00ce8da03f881638e..273d459f141d5708a632277818f6d688b2ef680c 100644 (file)
@@ -30,6 +30,7 @@ namespace Mlt
 {
        class Properties;
        class Producer;
+       class Service;
 
        class MLTPP_DECLSPEC Frame : public Properties
        {
@@ -46,6 +47,9 @@ namespace Mlt
                        void *get_audio( mlt_audio_format &format, int &frequency, int &channels, int &samples );
                        unsigned char *get_waveform( int w, int h );
                        Producer *get_original_producer( );
+                       mlt_properties get_unique_properties( Service &service );
+                       int set_image( uint8_t *image, int size, mlt_destructor destroy );
+                       int set_alpha( uint8_t *alpha, int size, mlt_destructor destroy );
        };
 }