mlt_service mlt_consumer_service( mlt_consumer this )
{
- return &this->parent;
+ return this != NULL ? &this->parent : NULL;
}
/** Get the consumer properties.
mlt_properties mlt_consumer_properties( mlt_consumer this )
{
- return mlt_service_properties( &this->parent );
+ return this != NULL ? mlt_service_properties( &this->parent ) : NULL;
}
/** Connect the consumer to the producer.
// Set the test card on the consumer
mlt_properties_set_data( properties, "test_card_producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL );
}
-
- // Check and run an ante command
- if ( mlt_properties_get( properties, "ante" ) )
- system( mlt_properties_get( properties, "ante" ) );
}
}
else
mlt_properties_set_data( properties, "test_card_producer", NULL, 0, NULL, NULL );
}
+ // Check and run an ante command
+ if ( mlt_properties_get( properties, "ante" ) )
+ system( mlt_properties_get( properties, "ante" ) );
+
// Set the real_time preference
this->real_time = mlt_properties_get_int( properties, "real_time" );
if ( !video_off )
mlt_frame_get_image( frame, &image, &this->format, &width, &height, 0 );
mlt_properties_set_int( mlt_frame_properties( frame ), "rendered", 1 );
-
- // Reset the skipped count
- skipped = 0;
}
else
{
skip_next = 0;
// If we've reached an unacceptable level, reset everything
- if ( skipped > 10 )
+ if ( skipped > 5 )
{
skipped = 0;
time_frame = 0;
}
}
+void mlt_consumer_purge( mlt_consumer this )
+{
+ if ( this->ahead )
+ {
+ pthread_mutex_lock( &this->mutex );
+ while ( mlt_deque_count( this->queue ) )
+ mlt_frame_close( mlt_deque_pop_back( this->queue ) );
+ pthread_cond_broadcast( &this->cond );
+ pthread_mutex_unlock( &this->mutex );
+ }
+}
+
mlt_frame mlt_consumer_rt_frame( mlt_consumer this )
{
// Frame to return
if ( this->ahead == 0 )
{
int buffer = mlt_properties_get_int( properties, "buffer" );
+ int prefill = mlt_properties_get_int( properties, "prefill" );
consumer_read_ahead_start( this );
if ( buffer > 1 )
- size = buffer;
+ size = prefill > 0 && prefill < buffer ? prefill : buffer;
}
// Get frame from queue