int image_size = 0;
// Get the image cache
- if ( ! self->image_cache && ! mlt_properties_get_int( properties, "noimagecache" ) )
+ if ( ! self->image_cache )
{
- self->image_cache = mlt_cache_init();
+ // if cache size supplied by environment variable
+ int cache_supplied = getenv( "MLT_AVFORMAT_CACHE" ) != NULL;
+ int cache_size = cache_supplied? atoi( getenv( "MLT_AVFORMAT_CACHE" ) ) : 0;
+
+ // cache size supplied via property
+ if ( mlt_properties_get( properties, "cache" ) )
+ {
+ cache_supplied = 1;
+ cache_size = mlt_properties_get_int( properties, "cache" );
+ }
+ if ( mlt_properties_get_int( properties, "noimagecache" ) )
+ cache_size = 0;
+ // create cache if not disabled
+ if ( !cache_supplied || cache_size > 0 )
+ self->image_cache = mlt_cache_init();
+ // set cache size if supplied
+ if ( self->image_cache && cache_supplied )
+ mlt_cache_set_size( self->image_cache, cache_size );
}
if ( self->image_cache )
{
default: 0
widget: checkbox
+ - identifier: cache
+ title: Number of images cache
+ type: integer
+ description: >
+ By default, this producer caches images to facilitate YADIF deinterlace,
+ which needs previous and next frames. Also, caching helps with frame-
+ stepping within a player. The default number of images cached is supplied
+ by the MLT framework, which is currently 4, but you can override it
+ with this property. You can also disable caching by setting it to 0.
+ If you are using parallel processing with YADIF deinterlacing, then
+ you might need to increase caching to prevent inadvertent backward seeks.
+ One can also set this value globally for all instances of avformat by
+ setting the environment variable MLT_AVFORMAT_CACHE.
+
- identifier: use_pts
title: Use video PTS
description: >