Hi Dan, Moving this discussion from the Kdenlive bug tracker (1) to the mlt-dev mailing list since it may be useful one day to find it here...
First, your last change to producer_melt does not work, since it is placed just before the track is inserted, so we still get the crash. mlt_multitrack_count must be called after the track was inserted to get the correct count, see my patch below. Then, I understand and I agree that the framework should not contain module specific code. However, in that case, my proposed patch (on Kdenlive's bug tracker) to mlt_multitrack solved the problem once for all for everyone. Using your approach, every application using MLT will have to set the avformat cache count to the number of tracks if it uses more than 10 tracks, otherwise it will result in a crash. Again, it's ok for me if that is the way you prefer, I just wanted to make it clear for other developers using MLT. regards jb (1) http://kdenlive.org/mantis/view.php?id=2286 -------------------------------------------------------------------------------------- --- a/src/modules/melt/producer_melt.c +++ b/src/modules/melt/producer_melt.c @@ -449,10 +449,6 @@ mlt_producer producer_melt_init( mlt_profile profile, mlt_service_type type, con } } - // Set the size of the producer_avformat cache to the number of tracks. - if ( mlt_multitrack_count( multitrack ) > mlt_service_cache_get_size( MLT_PLAYLIST_SERVICE( playlist ), "producer_avformat" ) ) - mlt_service_cache_set_size( MLT_PLAYLIST_SERVICE( playlist ), "producer_avformat", mlt_multitrack_count( multitrack ) + 2 ); - // Connect last producer to playlist if ( producer != NULL && !mlt_producer_is_cut( producer ) ) mlt_playlist_append( playlist, producer ); @@ -465,6 +461,11 @@ mlt_producer producer_melt_init( mlt_profile profile, mlt_service_type type, con mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( playlist ) ) > 0 ) mlt_multitrack_connect( multitrack, MLT_PLAYLIST_PRODUCER( playlist ), track ); + // Set the size of the producer_avformat cache to the number of tracks. + if ( mlt_multitrack_count( multitrack ) > mlt_service_cache_get_size( MLT_PLAYLIST_SERVICE( playlist ), "producer_avformat" ) ) { + mlt_service_cache_set_size( MLT_PLAYLIST_SERVICE( playlist ), "producer_avformat", mlt_multitrack_count( multitrack ) + 2 ); + } + mlt_producer prod = MLT_TRACTOR_PRODUCER( tractor ); mlt_producer_optimise( prod ); mlt_properties props = MLT_TRACTOR_PROPERTIES( tractor ); ------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev _______________________________________________ Mlt-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mlt-devel
