]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_frame.c
service stack, various fixes
[mlt] / src / framework / mlt_frame.c
index 6c367e9335e79778f38386855afc4524f90b3b22..c0d75d666de754491645dd47a829bf68fc6ca1c8 100644 (file)
@@ -68,6 +68,7 @@ mlt_frame mlt_frame_init( )
                // Construct stacks for frames and methods
                this->stack_get_image = mlt_deque_init( );
                this->stack_frame = mlt_deque_init( );
+               this->stack_service = mlt_deque_init( );
        }
 
        return this;
@@ -161,6 +162,22 @@ mlt_frame mlt_frame_pop_frame( mlt_frame this )
        return mlt_deque_pop_back( this->stack_frame );
 }
 
+/** Push a service.
+*/
+
+int mlt_frame_push_service( mlt_frame this, void *that )
+{
+       return mlt_deque_push_back( this->stack_service, that );
+}
+
+/** Pop a service.
+*/
+
+void *mlt_frame_pop_service( mlt_frame this )
+{
+       return mlt_deque_pop_back( this->stack_service );
+}
+
 int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable )
 {
        mlt_properties properties = mlt_frame_properties( this );
@@ -293,10 +310,14 @@ int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *for
 
 void mlt_frame_close( mlt_frame this )
 {
-       mlt_deque_close( this->stack_get_image );
-       mlt_deque_close( this->stack_frame );
-       mlt_properties_close( &this->parent );
-       free( this );
+       if ( this != NULL )
+       {
+               mlt_deque_close( this->stack_get_image );
+               mlt_deque_close( this->stack_frame );
+               mlt_deque_close( this->stack_service );
+               mlt_properties_close( &this->parent );
+               free( this );
+       }
 }
 
 /***** convenience functions *****/