static mlt_repository filters = NULL;
static mlt_repository transitions = NULL;
static mlt_repository consumers = NULL;
+static int unique_id = 0;
/** Construct the factories.
*/
if ( obj != NULL )
{
mlt_properties properties = mlt_producer_properties( obj );
+ mlt_properties_set_int( properties, "_unique_id", ++ unique_id );
mlt_properties_set( properties, "mlt_type", "producer" );
if ( mlt_properties_get_int( properties, "_mlt_service_hidden" ) == 0 )
mlt_properties_set( properties, "mlt_service", service );
if ( obj != NULL )
{
mlt_properties properties = mlt_filter_properties( obj );
+ mlt_properties_set_int( properties, "_unique_id", ++ unique_id );
mlt_properties_set( properties, "mlt_type", "filter" );
mlt_properties_set( properties, "mlt_service", service );
}
if ( obj != NULL )
{
mlt_properties properties = mlt_transition_properties( obj );
+ mlt_properties_set_int( properties, "_unique_id", ++ unique_id );
mlt_properties_set( properties, "mlt_type", "transition" );
mlt_properties_set( properties, "mlt_service", service );
}
if ( obj != NULL )
{
mlt_properties properties = mlt_consumer_properties( obj );
+ mlt_properties_set_int( properties, "_unique_id", ++ unique_id );
mlt_properties_set( properties, "mlt_type", "consumer" );
mlt_properties_set( properties, "mlt_service", service );
}
mlt_properties properties = mlt_filter_properties( filter );
mlt_producer producer = mlt_properties_get_data( properties, "producer", NULL );
mlt_transition composite = mlt_properties_get_data( properties, "composite", NULL );
+ char *name = mlt_properties_get( properties, "_unique_id" );
if ( composite == NULL )
{
{
mlt_service service = mlt_producer_service( producer );
mlt_frame b_frame = NULL;
+ mlt_properties frame_properties = mlt_frame_properties( this );
+ mlt_position position = mlt_properties_get_position( frame_properties, name );
+ mlt_producer_seek( producer, position );
if ( mlt_service_get_frame( service, &b_frame, 0 ) == 0 )
mlt_transition_process( composite, this, b_frame );
static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
{
+ // Get the properties of the frame
+ mlt_properties properties = mlt_frame_properties( frame );
+
+ // Get a unique name to store the frame position
+ char *name = mlt_properties_get( mlt_filter_properties( this ), "_unique_id" );
+
+ // Assign the current position to the name
+ mlt_properties_set_position( properties, name, mlt_frame_get_position( frame ) );
+
// Push the filter on to the stack
mlt_frame_push_service( frame, this );
// Create the dv_decoder
this->dv_decoder = dv_decoder_new( FALSE, FALSE, FALSE );
- this->dv_decoder->quality = DV_QUALITY_BEST;
+ this->dv_decoder->quality = DV_QUALITY_COLOR | DV_QUALITY_AC_1;
this->dv_decoder->audio->arg_audio_emphasis = 2;
dv_set_audio_correction( this->dv_decoder, DV_AUDIO_CORRECT_AVERAGE );
dv_parse_header( decoder, dv_data );
// Obtain required values
- //fprintf( stderr, "libdv: frequency %d\n", decoder->audio->frequency );
*frequency = decoder->audio->frequency;
*samples = decoder->audio->samples_this_frame;
*channels = decoder->audio->num_channels;
producer_libdv this = parent->child;
// Free the dv deconder
- dv_decoder_free( this->dv_decoder );
+ //dv_decoder_free( this->dv_decoder );
// Close the file
if ( this->fd > 0 )
if ( filename == NULL )
{
- mlt_properties_set( properties, "resource", "pango" );
mlt_properties_set( properties, "markup", "" );
}
else if ( filename[ 0 ] == '+' || strstr( filename, "/+" ) )
}
else
{
- mlt_properties_set( properties, "resource", "pango" );
mlt_properties_set( properties, "markup", "" );
}
}
// Get the time to live for each frame
double ttl = mlt_properties_get_int( producer_props, "ttl" );
+ // Get the original position of this frame
+ mlt_position position = mlt_properties_get_position( properties, "pixbuf_position" );
+
// Image index
- int image_idx = ( int )floor( mlt_frame_get_position( frame ) / ttl ) % this->count;
+ int image_idx = ( int )floor( ( double )position / ttl ) % this->count;
// optimization for subsequent iterations on single picture
if ( width != 0 && this->image != NULL && image_idx == this->image_idx )
// Generate a frame
*frame = mlt_frame_init( );
- // Obtain properties of frame and producer
- mlt_properties properties = mlt_frame_properties( *frame );
+ if ( *frame != NULL && this->count > 0 )
+ {
+ // Obtain properties of frame and producer
+ mlt_properties properties = mlt_frame_properties( *frame );
- // Set the producer on the frame properties
- mlt_properties_set_data( properties, "producer_pixbuf", this, 0, NULL, NULL );
+ // Set the producer on the frame properties
+ mlt_properties_set_data( properties, "producer_pixbuf", this, 0, NULL, NULL );
- // Update timecode on the frame we're creating
- mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
+ // Update timecode on the frame we're creating
+ mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
- // Refresh the image
- refresh_image( *frame, 0, 0 );
+ // Ensure that we have a way to obtain the position in the get_image
+ mlt_properties_set_position( properties, "pixbuf_position", mlt_producer_position( producer ) );
- // Set producer-specific frame properties
- mlt_properties_set_int( properties, "progressive", 1 );
- mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( properties, "real_width" ) / mlt_properties_get_double( properties, "real_height" ) );
+ // Refresh the image
+ refresh_image( *frame, 0, 0 );
- // Set alpha call back
- ( *frame )->get_alpha_mask = producer_get_alpha_mask;
+ // Set producer-specific frame properties
+ mlt_properties_set_int( properties, "progressive", 1 );
+ mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( properties, "real_width" )/mlt_properties_get_double( properties, "real_height" ) );
- // Push the get_image method
- mlt_frame_push_get_image( *frame, producer_get_image );
+ // Set alpha call back
+ ( *frame )->get_alpha_mask = producer_get_alpha_mask;
+
+ // Push the get_image method
+ mlt_frame_push_get_image( *frame, producer_get_image );
+ }
// Calculate the next timecode
mlt_producer_prepare_next( producer );