out of sync.
See playlist logic too.
-
- This is not as clean as it should be...
*/
static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int index )
// Check if we have a track for this index
if ( index < this->count && this->list[ index ] != NULL )
{
- // Determine the in point
- int in = mlt_producer_is_cut( this->list[ index ]->producer ) ? mlt_producer_get_in( this->list[ index ]->producer ) : 0;
-
// Get the producer for this track
- mlt_producer producer = mlt_producer_cut_parent( this->list[ index ]->producer );
+ mlt_producer producer = this->list[ index ]->producer;
// Obtain the current position
mlt_position position = mlt_producer_frame( parent );
- // Get the clone index
- int clone_index = mlt_properties_get_int( mlt_producer_properties( this->list[ index ]->producer ), "_clone" );
-
- // Additionally, check if we're supposed to use a clone here
- if ( clone_index > 0 )
- {
- char key[ 25 ];
- sprintf( key, "_clone.%d", clone_index - 1 );
- producer = mlt_properties_get_data( mlt_producer_properties( producer ), key, NULL );
- }
-
// Make sure we're at the same point
- mlt_producer_seek( producer, in + position );
+ mlt_producer_seek( producer, position );
// Get the frame from the producer
mlt_service_get_frame( mlt_producer_service( producer ), frame, 0 );
if ( error == 0 )
{
playlist_entry *entry = this->list[ clip ];
- if ( position >= 0 && position < entry->frame_count )
+ position = position < 0 ? entry->frame_count + position - 1 : position;
+ if ( position >= 0 && position <= entry->frame_count )
{
mlt_producer split = NULL;
int in = entry->frame_in;
playlist_entry *entry = this->list[ clip ];
mlt_playlist_append( new_clip, entry->producer );
mlt_playlist_repeat_clip( new_clip, i, entry->repeat );
+ if ( entry->frame_count == entry->repeat )
+ mlt_properties_set_int( mlt_playlist_properties( new_clip ), "hide", 2 );
entry->preservation_hack = 1;
mlt_playlist_remove( this, clip );
}
char key[ 25 ];
sprintf( key, "_clone.%d", clone_index - 1 );
clone = mlt_properties_get_data( mlt_producer_properties( mlt_producer_cut_parent( this ) ), key, NULL );
+ if ( clone == NULL ) fprintf( stderr, "requested clone doesn't exist\n" );
clone = clone == NULL ? this : clone;
}
- mlt_producer_seek( clone, mlt_properties_get_int( properties, "_position" ) );
- result = producer_get_frame( mlt_producer_service( mlt_producer_cut_parent( clone ) ), frame, index );
+ else
+ {
+ clone = mlt_producer_cut_parent( this );
+ }
+ mlt_producer_seek( clone, mlt_producer_get_in( this ) + mlt_properties_get_int( properties, "_position" ) );
+ result = producer_get_frame( mlt_producer_service( clone ), frame, index );
double speed = mlt_producer_get_speed( this );
mlt_properties_set_double( mlt_frame_properties( *frame ), "_speed", speed );
mlt_producer_prepare_next( clone );
if ( clone == NULL && resource != NULL )
clone = mlt_factory_producer( "fezzik", resource );
+ if ( clone != NULL )
+ mlt_properties_inherit( mlt_producer_properties( clone ), properties );
+
return clone;
}
uint8_t *data = NULL;
mlt_properties properties = mlt_frame_properties( this );
mlt_frame frame = mlt_frame_pop_service( this );
- mlt_properties_inherit( mlt_frame_properties( frame ), properties );
+ mlt_properties frame_properties = mlt_frame_properties( frame );
+ mlt_properties_set_int( frame_properties, "width", mlt_properties_get_int( properties, "width" ) );
+ mlt_properties_set_int( frame_properties, "height", mlt_properties_get_int( properties, "height" ) );
+ mlt_properties_set( frame_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) );
+ mlt_properties_set_double( frame_properties, "aspect_ratio", mlt_properties_get_double( properties, "aspect_ratio" ) );
+ mlt_properties_set_double( frame_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) );
+ mlt_properties_set_int( frame_properties, "consumer_progressive", mlt_properties_get_double( properties, "consumer_progressive" ) );
+ mlt_properties_set_int( frame_properties, "consumer_deinterlace", mlt_properties_get_double( properties, "consumer_deinterlace" ) );
mlt_frame_get_image( frame, buffer, format, width, height, writable );
mlt_properties_set_data( properties, "image", *buffer, *width * *height * 2, NULL, NULL );
mlt_properties_set_int( properties, "width", *width );
{
mlt_properties properties = mlt_frame_properties( this );
mlt_frame frame = mlt_frame_pop_audio( this );
- mlt_properties_inherit( mlt_frame_properties( frame ), properties );
mlt_frame_get_audio( frame, buffer, format, frequency, channels, samples );
mlt_properties_set_data( properties, "audio", *buffer, 0, NULL, NULL );
mlt_properties_set_int( properties, "frequency", *frequency );
{
mlt_frame_push_audio( *frame, audio );
( *frame )->get_audio = producer_get_audio;
- mlt_properties_inherit( mlt_frame_properties( *frame ), mlt_frame_properties( audio ) );
}
if ( video != NULL )
{
- mlt_properties_set_data( mlt_frame_properties( *frame ), "data_queue", data_queue, 0, NULL, NULL );
+ mlt_properties video_properties = mlt_frame_properties( video );
mlt_frame_push_service( *frame, video );
mlt_frame_push_service( *frame, producer_get_image );
- mlt_properties_inherit( mlt_frame_properties( *frame ), mlt_frame_properties( video ) );
+ mlt_properties_set_data( frame_properties, "data_queue", data_queue, 0, NULL, NULL );
+ mlt_properties_set_int( frame_properties, "width", mlt_properties_get_int( video_properties, "width" ) );
+ mlt_properties_set_int( frame_properties, "height", mlt_properties_get_int( video_properties, "height" ) );
+ mlt_properties_set_double( frame_properties, "aspect_ratio", mlt_properties_get_double( video_properties, "aspect_ratio" ) );
}
mlt_properties_set_int( mlt_frame_properties( *frame ), "test_audio", audio == NULL );
static void transport( mlt_producer producer, mlt_consumer consumer )
{
mlt_properties properties = mlt_producer_properties( producer );
+ int silent = mlt_properties_get_int( mlt_consumer_properties( consumer ), "silent" );
term_init( );
if ( mlt_properties_get_int( properties, "done" ) == 0 && !mlt_consumer_is_stopped( consumer ) )
{
- fprintf( stderr, "+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+\n" );
- fprintf( stderr, "|1=-10| |2= -5| |3= -2| |4= -1| |5= 0| |6= 1| |7= 2| |8= 5| |9= 10|\n" );
- fprintf( stderr, "+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+\n" );
-
- fprintf( stderr, "+---------------------------------------------------------------------+\n" );
- fprintf( stderr, "| H = back 1 minute, L = forward 1 minute |\n" );
- fprintf( stderr, "| h = previous frame, l = next frame |\n" );
- fprintf( stderr, "| g = start of clip, j = next clip, k = previous clip |\n" );
- fprintf( stderr, "| 0 = restart, q = quit, space = play |\n" );
- fprintf( stderr, "+---------------------------------------------------------------------+\n" );
+ if ( !silent )
+ {
+ fprintf( stderr, "+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+\n" );
+ fprintf( stderr, "|1=-10| |2= -5| |3= -2| |4= -1| |5= 0| |6= 1| |7= 2| |8= 5| |9= 10|\n" );
+ fprintf( stderr, "+-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+ +-----+\n" );
+
+ fprintf( stderr, "+---------------------------------------------------------------------+\n" );
+ fprintf( stderr, "| H = back 1 minute, L = forward 1 minute |\n" );
+ fprintf( stderr, "| h = previous frame, l = next frame |\n" );
+ fprintf( stderr, "| g = start of clip, j = next clip, k = previous clip |\n" );
+ fprintf( stderr, "| 0 = restart, q = quit, space = play |\n" );
+ fprintf( stderr, "+---------------------------------------------------------------------+\n" );
+ }
while( mlt_properties_get_int( properties, "done" ) == 0 && !mlt_consumer_is_stopped( consumer ) )
{
int value = term_read( );
if ( value != -1 )
transport_action( producer, ( char * )&value );
-
- if ( mlt_properties_get_int( properties, "stats_off" ) == 0 )
+
+ if ( !silent && mlt_properties_get_int( properties, "stats_off" ) == 0 )
fprintf( stderr, "Current Position: %10d\r", mlt_producer_position( producer ) );
}
- fprintf( stderr, "\n" );
+ if ( !silent )
+ fprintf( stderr, "\n" );
}
}