Skip to content

Commit

Permalink
filter_transition cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jliljebl committed May 11, 2014
1 parent 361a09b commit 77dfc8b
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/modules/core/filter_transition.c
Expand Up @@ -27,41 +27,41 @@
NB: Not all transitions will accept a and b frames being the same...
*/

static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
{
mlt_transition transition = mlt_frame_pop_service( this );
if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "image_count" ) >= 1 )
mlt_transition_process( transition, this, this );
return mlt_frame_get_image( this, image, format, width, height, writable );
mlt_transition transition = mlt_frame_pop_service( frame );
if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "image_count" ) >= 1 )
mlt_transition_process( transition, frame, frame );
return mlt_frame_get_image( frame, image, format, width, height, writable );
}

/** Get the audio via the transition.
NB: Not all transitions will accept a and b frames being the same...
*/

static int filter_get_audio( mlt_frame this, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
static int filter_get_audio( mlt_frame frame, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
{
// Obtain the transition instance
mlt_transition transition = mlt_frame_pop_audio( this );
mlt_transition_process( transition, this, this );
return mlt_frame_get_audio( this, buffer, format, frequency, channels, samples );
mlt_transition transition = mlt_frame_pop_audio( frame );
mlt_transition_process( transition, frame, frame );
return mlt_frame_get_audio( frame, buffer, format, frequency, channels, samples );
}

/** Filter processing.
*/

static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
static mlt_frame filter_process( mlt_filter filter, mlt_frame frame )
{
// Obtain the transition instance
mlt_transition transition = mlt_properties_get_data( MLT_FILTER_PROPERTIES( this ), "instance", NULL );
mlt_transition transition = mlt_properties_get_data( MLT_FILTER_PROPERTIES( filter ), "instance", NULL );

// If we haven't created the instance, do it now
if ( transition == NULL )
{
char *name = mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "transition" );
mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( this ) );
char *name = mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "transition" );
mlt_profile profile = mlt_service_profile( MLT_FILTER_SERVICE( filter ) );
transition = mlt_factory_transition( profile, name, NULL );
mlt_properties_set_data( MLT_FILTER_PROPERTIES( this ), "instance", transition, 0, ( mlt_destructor )mlt_transition_close, NULL );
mlt_properties_set_data( MLT_FILTER_PROPERTIES( filter ), "instance", transition, 0, ( mlt_destructor )mlt_transition_close, NULL );
}

// We may still not have a transition...
Expand All @@ -71,11 +71,11 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
int type = mlt_properties_get_int( MLT_TRANSITION_PROPERTIES( transition ), "_transition_type" );

// Set the basic info
mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "in", mlt_properties_get_int( MLT_FILTER_PROPERTIES( this ), "in" ) );
mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "out", mlt_properties_get_int( MLT_FILTER_PROPERTIES( this ), "out" ) );
mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "in", mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "in" ) );
mlt_properties_set_int( MLT_TRANSITION_PROPERTIES( transition ), "out", mlt_properties_get_int( MLT_FILTER_PROPERTIES( filter ), "out" ) );

// Refresh with current user values
mlt_properties_pass( MLT_TRANSITION_PROPERTIES( transition ), MLT_FILTER_PROPERTIES( this ), "transition." );
mlt_properties_pass( MLT_TRANSITION_PROPERTIES( transition ), MLT_FILTER_PROPERTIES( filter ), "transition." );

if ( type & 1 && !mlt_frame_is_test_card( frame ) && !( mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "hide" ) & 1 ) )
{
Expand All @@ -93,7 +93,7 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
}
else
{
mlt_properties_debug( MLT_FILTER_PROPERTIES( this ), "no transition", stderr );
mlt_properties_debug( MLT_FILTER_PROPERTIES( filter ), "no transition", stderr );
}

return frame;
Expand All @@ -104,12 +104,12 @@ static mlt_frame filter_process( mlt_filter this, mlt_frame frame )

mlt_filter filter_transition_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
{
mlt_filter this = mlt_filter_new( );
if ( this != NULL )
mlt_filter filter = mlt_filter_new( );
if ( filter != NULL )
{
mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "transition", arg );
this->process = filter_process;
mlt_properties_set( MLT_FILTER_PROPERTIES( filter ), "transition", arg );
filter->process = filter_process;
}
return this;
return filter;
}

0 comments on commit 77dfc8b

Please sign in to comment.