X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_producer.c;h=50d12220801b3c1204f9fbf6d01de1977ebdbe82;hb=b21b66672758c0dade3c3549cc7f6822bb853523;hp=dab5844545a3d0a7a8d63cc11ffe119e3df2af1b;hpb=59456c0f8d288d6bfa6df60d692b9209741ab02e;p=melted diff --git a/src/framework/mlt_producer.c b/src/framework/mlt_producer.c index dab5844..50d1222 100644 --- a/src/framework/mlt_producer.c +++ b/src/framework/mlt_producer.c @@ -162,6 +162,14 @@ int mlt_producer_is_mix( mlt_producer this ) return tractor != NULL; } +/** Determine if the producer is a blank [from a playlist]. +*/ + +int mlt_producer_is_blank( mlt_producer this ) +{ + return this == NULL || !strcmp( mlt_properties_get( mlt_producer_properties( mlt_producer_cut_parent( this ) ), "resource" ), "blank" ); +} + /** Obtain the parent producer. */ @@ -187,8 +195,8 @@ mlt_producer mlt_producer_cut( mlt_producer this, int in, int out ) // Special case - allow for a cut of the entire producer (this will squeeze all other cuts to 0) if ( in <= 0 ) in = 0; - if ( out >= mlt_producer_get_playtime( parent ) ) - out = mlt_producer_get_playtime( parent ) - 1; + if ( ( out < 0 || out >= mlt_producer_get_playtime( parent ) ) && !mlt_producer_is_blank( this ) ) + out = mlt_producer_get_playtime( parent ); mlt_properties_inc_ref( parent_props ); mlt_properties_set_int( properties, "_cut", 1 ); @@ -310,8 +318,10 @@ int mlt_producer_set_in_and_out( mlt_producer this, mlt_position in, mlt_positio if ( out < 0 ) out = 0; - else if ( out > mlt_producer_get_length( this ) ) + else if ( out > mlt_producer_get_length( this ) && !mlt_producer_is_blank( this ) ) out = mlt_producer_get_length( this ); + else if ( out >= mlt_producer_get_length( this ) - 1 && mlt_producer_is_blank( this ) ) + mlt_properties_set_position( mlt_producer_properties( this ), "length", out + 1 ); // Swap ins and outs if wrong if ( out < in ) @@ -393,9 +403,9 @@ void mlt_producer_prepare_next( mlt_producer this ) static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int index ) { int result = 1; - mlt_producer this = service->child; + mlt_producer this = service != NULL ? service->child : NULL; - if ( !mlt_producer_is_cut( this ) ) + if ( this != NULL && !mlt_producer_is_cut( this ) ) { // Get the properties of this producer mlt_properties properties = mlt_producer_properties( this ); @@ -443,8 +453,11 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind if ( mlt_properties_get_data( properties, "_producer", NULL ) == NULL ) mlt_properties_set_data( properties, "_producer", service, 0, NULL, NULL ); } - else + else if ( this != NULL ) { + // Get the speed of the cut + double speed = mlt_producer_get_speed( this ); + // Get the parent of this cut mlt_producer parent = mlt_producer_cut_parent( this ); @@ -484,6 +497,14 @@ static int producer_get_frame( mlt_service service, mlt_frame_ptr frame, int ind // We're done with the clone now mlt_properties_set_data( parent_properties, "use_clone", NULL, 0, NULL, NULL ); + + mlt_properties_set_double( mlt_frame_properties( *frame ), "_speed", speed ); + mlt_producer_prepare_next( this ); + } + else + { + *frame = mlt_frame_init( ); + result = 0; } return result;