X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=mlt%2Fsrc%2Fmodules%2Fcore%2Ftransition_luma.c;h=a3ae3dc7796090a8a392a16966a139da226125f1;hb=6fba6c383f2d7845f9eedf9f4e5e099319cfb43f;hp=fa6d7c3b39d8a00188f48ec09ed3271815e18eca;hpb=8bf137cd71aafb9c8f6a42c78ddb6bd0a8fe99db;p=melted diff --git a/mlt/src/modules/core/transition_luma.c b/mlt/src/modules/core/transition_luma.c index fa6d7c3..a3ae3dc 100644 --- a/mlt/src/modules/core/transition_luma.c +++ b/mlt/src/modules/core/transition_luma.c @@ -34,7 +34,7 @@ typedef struct struct mlt_transition_s parent; char *filename; int width; - int height; + int height; double *bitmap; } transition_luma; @@ -313,7 +313,7 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram // If the filename property changed, reload the map char *luma_file = mlt_properties_get( properties, "filename" ); - if ( luma_file != NULL && luma_file != this->filename ) + if ( luma_file != NULL && ( this->filename == NULL || ( this->filename && strcmp( luma_file, this->filename ) ) ) ) { int width = mlt_properties_get_int( b_props, "width" ); int height = mlt_properties_get_int( b_props, "height" ); @@ -321,12 +321,16 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram FILE *pipe; command[ 511 ] = '\0'; - this->filename = luma_file; + if ( this->filename ) + free( this->filename ); + this->filename = strdup( luma_file ); snprintf( command, 511, "anytopnm %s | pnmscale -width %d -height %d", luma_file, width, height ); //pipe = popen( command, "r" ); pipe = fopen( luma_file, "r" ); if ( pipe != NULL ) { + if ( this->bitmap ) + free( this->bitmap ); luma_read_pgm( pipe, &this->bitmap, &this->width, &this->height ); //pclose( pipe ); fclose( pipe ); @@ -352,12 +356,13 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram mlt_frame_push_frame( a_frame, b_frame ); /************************ AUDIO ***************************/ +#if 1 // Backup the original get_audio (it's still needed) mlt_properties_set_data( mlt_frame_properties( a_frame ), "get_audio", a_frame->get_audio, 0, NULL, NULL ); // Override the get_audio method a_frame->get_audio = transition_get_audio; - +#endif return a_frame; } @@ -392,8 +397,9 @@ static void transition_close( mlt_transition parent ) if ( this->bitmap ) free( this->bitmap ); - parent->close = NULL; - mlt_transition_close( parent ); + if ( this->filename ) + free( this->filename ); + free( this ); }