From 52b7a4fb7a6e8745ac40153cd18c1fb5555a82f2 Mon Sep 17 00:00:00 2001 From: lilo_booter Date: Wed, 10 Mar 2004 15:25:53 +0000 Subject: [PATCH] RPN clean up for frames git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@199 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/framework/mlt_frame.c | 38 +++++++++++++++++-------- src/framework/mlt_frame.h | 9 ++++-- src/modules/core/transition_composite.c | 2 +- src/modules/core/transition_luma.c | 12 ++++---- src/modules/core/transition_mix.c | 7 ++--- src/modules/core/transition_region.c | 12 ++++---- 6 files changed, 47 insertions(+), 33 deletions(-) diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 39055606..1f2f3d21 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -68,9 +68,8 @@ mlt_frame mlt_frame_init( ) mlt_properties_set_data( properties, "alpha", NULL, 0, NULL, NULL ); // 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( ); + this->stack_image = mlt_deque_init( ); + this->stack_audio = mlt_deque_init( ); } return this; @@ -137,7 +136,7 @@ int mlt_frame_set_position( mlt_frame this, mlt_position value ) int mlt_frame_push_get_image( mlt_frame this, mlt_get_image get_image ) { - return mlt_deque_push_back( this->stack_get_image, get_image ); + return mlt_deque_push_back( this->stack_image, get_image ); } /** Pop a get_image callback. @@ -145,7 +144,7 @@ int mlt_frame_push_get_image( mlt_frame this, mlt_get_image get_image ) mlt_get_image mlt_frame_pop_get_image( mlt_frame this ) { - return mlt_deque_pop_back( this->stack_get_image ); + return mlt_deque_pop_back( this->stack_image ); } /** Push a frame. @@ -153,7 +152,7 @@ mlt_get_image mlt_frame_pop_get_image( mlt_frame this ) int mlt_frame_push_frame( mlt_frame this, mlt_frame that ) { - return mlt_deque_push_back( this->stack_frame, that ); + return mlt_deque_push_back( this->stack_image, that ); } /** Pop a frame. @@ -161,7 +160,7 @@ int mlt_frame_push_frame( mlt_frame this, mlt_frame that ) mlt_frame mlt_frame_pop_frame( mlt_frame this ) { - return mlt_deque_pop_back( this->stack_frame ); + return mlt_deque_pop_back( this->stack_image ); } /** Push a service. @@ -169,7 +168,7 @@ mlt_frame mlt_frame_pop_frame( mlt_frame this ) int mlt_frame_push_service( mlt_frame this, void *that ) { - return mlt_deque_push_back( this->stack_service, that ); + return mlt_deque_push_back( this->stack_image, that ); } /** Pop a service. @@ -177,7 +176,23 @@ int mlt_frame_push_service( mlt_frame this, void *that ) void *mlt_frame_pop_service( mlt_frame this ) { - return mlt_deque_pop_back( this->stack_service ); + return mlt_deque_pop_back( this->stack_image ); +} + +/** Push an audio item on the stack. +*/ + +int mlt_frame_push_audio( mlt_frame this, void *that ) +{ + return mlt_deque_push_back( this->stack_audio, that ); +} + +/** Pop an audio item from the stack +*/ + +void *mlt_frame_pop_audio( mlt_frame this ) +{ + return mlt_deque_pop_back( this->stack_audio ); } int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) @@ -313,9 +328,8 @@ void mlt_frame_close( mlt_frame this ) { if ( this != NULL ) { - mlt_deque_close( this->stack_get_image ); - mlt_deque_close( this->stack_frame ); - mlt_deque_close( this->stack_service ); + mlt_deque_close( this->stack_image ); + mlt_deque_close( this->stack_audio ); mlt_properties_close( &this->parent ); free( this ); } diff --git a/src/framework/mlt_frame.h b/src/framework/mlt_frame.h index 25342933..f1cd0fed 100644 --- a/src/framework/mlt_frame.h +++ b/src/framework/mlt_frame.h @@ -50,9 +50,8 @@ struct mlt_frame_s uint8_t * ( *get_alpha_mask )( mlt_frame this ); // Private properties - mlt_deque stack_get_image; - mlt_deque stack_frame; - mlt_deque stack_service; + mlt_deque stack_image; + mlt_deque stack_audio; }; extern mlt_frame mlt_frame_init( ); @@ -74,6 +73,10 @@ extern int mlt_frame_push_frame( mlt_frame this, mlt_frame that ); extern mlt_frame mlt_frame_pop_frame( mlt_frame this ); extern int mlt_frame_push_service( mlt_frame this, void *that ); extern void *mlt_frame_pop_service( mlt_frame this ); + +extern int mlt_frame_push_audio( mlt_frame this, void *that ); +extern void *mlt_frame_pop_audio( mlt_frame this ); + extern void mlt_frame_close( mlt_frame this ); /* convenience functions */ diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index 91192af1..48f2d8aa 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -1017,8 +1017,8 @@ static mlt_frame composite_process( mlt_transition this, mlt_frame a_frame, mlt_ // Propogate the transition properties to the b frame mlt_properties_set_double( mlt_frame_properties( b_frame ), "relative_position", position_calculate( this, mlt_frame_get_position( a_frame ) ) ); mlt_frame_push_service( a_frame, this ); - mlt_frame_push_get_image( a_frame, transition_get_image ); mlt_frame_push_frame( a_frame, b_frame ); + mlt_frame_push_get_image( a_frame, transition_get_image ); return a_frame; } diff --git a/src/modules/core/transition_luma.c b/src/modules/core/transition_luma.c index 9386b0b9..6c7b6e82 100644 --- a/src/modules/core/transition_luma.c +++ b/src/modules/core/transition_luma.c @@ -334,6 +334,9 @@ static void luma_read_rgb24( uint8_t *image, uint16_t **map, int width, int heig static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ) { + // Get the b frame from the stack + mlt_frame b_frame = mlt_frame_pop_frame( a_frame ); + // Get the transition object mlt_transition transition = mlt_frame_pop_service( a_frame ); @@ -343,9 +346,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f // Get the properties of the a frame mlt_properties a_props = mlt_frame_properties( a_frame ); - // Get the b frame from the stack - mlt_frame b_frame = mlt_frame_pop_frame( a_frame ); - // Get the properties of the b frame mlt_properties b_props = mlt_frame_properties( b_frame ); @@ -489,12 +489,12 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram // Push the transition on to the frame mlt_frame_push_service( a_frame, transition ); - // Push the transition method - mlt_frame_push_get_image( a_frame, transition_get_image ); - // Push the b_frame on to the stack mlt_frame_push_frame( a_frame, b_frame ); + // Push the transition method + mlt_frame_push_get_image( a_frame, transition_get_image ); + return a_frame; } diff --git a/src/modules/core/transition_mix.c b/src/modules/core/transition_mix.c index e9763875..d6f8b2a7 100644 --- a/src/modules/core/transition_mix.c +++ b/src/modules/core/transition_mix.c @@ -34,7 +34,7 @@ static int transition_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_fo mlt_properties a_props = mlt_frame_properties( frame ); // Get the b frame from the stack - mlt_frame b_frame = mlt_frame_pop_frame( frame ); + mlt_frame b_frame = mlt_frame_pop_audio( frame ); // Get the properties of the b frame mlt_properties b_props = mlt_frame_properties( b_frame ); @@ -56,9 +56,6 @@ static int transition_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_fo mlt_frame_mix_audio( frame, b_frame, mix_start, mix_end, buffer, format, frequency, channels, samples ); - // Push the b_frame back on for get_image - mlt_frame_push_frame( frame, b_frame ); - return 0; } @@ -116,7 +113,7 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt // Override the get_audio method a_frame->get_audio = transition_get_audio; - mlt_frame_push_frame( a_frame, b_frame ); + mlt_frame_push_audio( a_frame, b_frame ); return a_frame; } diff --git a/src/modules/core/transition_region.c b/src/modules/core/transition_region.c index 4e2eb11e..41fce2fd 100644 --- a/src/modules/core/transition_region.c +++ b/src/modules/core/transition_region.c @@ -118,12 +118,12 @@ static int transition_get_image( mlt_frame frame, uint8_t **image, mlt_image_for // Error we will return int error = 0; - // Get the watermark transition object - mlt_transition this = mlt_frame_pop_service( frame ); - // We will get the 'b frame' from the frame stack mlt_frame b_frame = mlt_frame_pop_frame( frame ); + // Get the watermark transition object + mlt_transition this = mlt_frame_pop_service( frame ); + // Get the properties of the transition mlt_properties properties = mlt_transition_properties( this ); @@ -322,12 +322,12 @@ static mlt_frame transition_process( mlt_transition this, mlt_frame a_frame, mlt // Push the transition on to the frame mlt_frame_push_service( a_frame, this ); - // Push the transition method - mlt_frame_push_get_image( a_frame, transition_get_image ); - // Push the b_frame on to the stack mlt_frame_push_frame( a_frame, b_frame ); + // Push the transition method + mlt_frame_push_get_image( a_frame, transition_get_image ); + // Return the frame return a_frame; } -- 2.39.2