X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_multitrack.c;h=d00525d60c85e701cdc87654cf13935dcc2ed0ce;hb=870a1069dd7a1b33623f3284c089b9be2dfb4491;hp=84f23893c1e97c0ad3e5b04aef639f14344c5794;hpb=3531bc485623608b5ecc6e780710251d32d6161c;p=melted diff --git a/src/framework/mlt_multitrack.c b/src/framework/mlt_multitrack.c index 84f2389..d00525d 100644 --- a/src/framework/mlt_multitrack.c +++ b/src/framework/mlt_multitrack.c @@ -78,7 +78,7 @@ mlt_multitrack mlt_multitrack_init( ) mlt_producer mlt_multitrack_producer( mlt_multitrack this ) { - return &this->parent; + return this != NULL ? &this->parent : NULL; } /** Get the service associated this multitrack. @@ -127,7 +127,8 @@ void mlt_multitrack_refresh( mlt_multitrack this ) mlt_properties_set( mlt_producer_properties( producer ), "eof", "continue" ); // Determine the longest length - length = mlt_producer_get_playtime( producer ) > length ? mlt_producer_get_playtime( producer ) : length; + if ( !mlt_properties_get_int( mlt_producer_properties( producer ), "hide" ) ) + length = mlt_producer_get_playtime( producer ) > length ? mlt_producer_get_playtime( producer ) : length; // Handle fps if ( fps == 0 ) @@ -259,7 +260,7 @@ mlt_position mlt_multitrack_clip( mlt_multitrack this, mlt_whence whence, int in // Get the producer for this track mlt_producer producer = this->list[ i ]; - // If it's assigned... + // If it's assigned and not a hidden track if ( producer != NULL ) { // Get the properties of this producer @@ -406,12 +407,15 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int ind void mlt_multitrack_close( mlt_multitrack this ) { - // Close the producer - mlt_producer_close( &this->parent ); + if ( this != NULL && mlt_properties_dec_ref( mlt_multitrack_properties( this ) ) <= 0 ) + { + // Close the producer + mlt_producer_close( &this->parent ); - // Free the list - free( this->list ); + // Free the list + free( this->list ); - // Free the object - free( this ); + // Free the object + free( this ); + } }