int mlt_frame_is_test_card( mlt_frame this )
{
- return this->stack_get_image_size == 0;
+ return ( this->stack_get_image_size == 0 && mlt_properties_get_data( mlt_frame_properties( this ), "image", NULL ) == NULL );
+}
+
+/** Check if we have a way to derive something than test audio.
+*/
+
+int mlt_frame_is_test_audio( mlt_frame this )
+{
+ return this->get_audio == NULL;
}
/** Get the aspect ratio of the frame.
extern mlt_frame mlt_frame_init( );
extern mlt_properties mlt_frame_properties( mlt_frame this );
extern int mlt_frame_is_test_card( mlt_frame this );
+extern int mlt_frame_is_test_audio( mlt_frame this );
extern double mlt_frame_get_aspect_ratio( mlt_frame this );
extern int mlt_frame_set_aspect_ratio( mlt_frame this, double value );
extern mlt_position mlt_frame_get_position( mlt_frame this );
int i = 0;
int looking = 1;
int done = 0;
- mlt_frame temp;
+ mlt_frame temp = NULL;
// Get the properties of the parent producer
mlt_properties properties = mlt_producer_properties( parent );
// Use this as output if we don't have one already
*frame = temp;
}
- else if ( !mlt_frame_is_test_card( temp ) && looking )
+ else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) &&
+ mlt_producer_frame( parent ) == mlt_properties_get_position( mlt_frame_properties( temp ), "position" ) )
+ {
+ *frame = temp;
+ looking = 0;
+ }
+ else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking )
{
// This is the one we want and we can stop looking
*frame = temp;
mlt_position in = mlt_transition_get_in( transition );
mlt_position out = mlt_transition_get_out( transition );
mlt_position time = mlt_frame_get_position( b_frame );
- double pos = ( time - in ) / ( out - in );
+ double pos = ( (double)time - (double)in ) / ( (double)out - (double)in + 1 );
// Set the b frame properties
mlt_properties_set_double( b_props, "mix", pos );
// This will hold the size of the dv frame
int size = 0;
+ // determine if this a test card
+ int is_test = mlt_frame_is_test_card( frame );
+
// If we get an encoder, then encode the image
if ( encoder != NULL )
{
}
// Process the frame
- if ( size != 0 )
+ if ( size != 0 && !( mlt_properties_get_int( this_properties, "was_test_card" ) && is_test ) )
{
// Encode the image
dv_encode_full_frame( encoder, &image, e_dv_color_yuv, dv_frame );
+
+ // Note test card status
+ mlt_properties_set_int( this_properties, "was_test_card", is_test );
}
}
// Push the image callback
mlt_frame_push_get_image( *frame, producer_get_image );
-
}
else
{
}
// Push the image callback
- mlt_frame_push_get_image( *frame, producer_get_image );
+ if ( !this->end_of_video )
+ mlt_frame_push_get_image( *frame, producer_get_image );
}
// Set the audio pipe
mlt_properties_set_data( properties, "producer_ffmpeg", this, 0, NULL, NULL );
// Hmm - register audio callback
- ( *frame )->get_audio = producer_get_audio;
+ if ( !this->end_of_audio )
+ ( *frame )->get_audio = producer_get_audio;
// Get the additional properties
double aspect_ratio = mlt_properties_get_double( producer_properties, "aspect_ratio" );
double speed = mlt_properties_get_double( producer_properties, "speed" );
- char *video_file = mlt_properties_get( producer_properties, "video_file" );
// Set them on the frame
mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio );
mlt_properties_set_double( properties, "speed", speed );
- if ( strchr( video_file, '/' ) != NULL )
- mlt_properties_set( properties, "file", strrchr( video_file, '/' ) + 1 );
- else
- mlt_properties_set( properties, "file", video_file );
-
// Set the out point on the producer
if ( this->end_of_video && this->end_of_audio )
int mlt_frame_is_test_card( mlt_frame this )
{
- return this->stack_get_image_size == 0;
+ return ( this->stack_get_image_size == 0 && mlt_properties_get_data( mlt_frame_properties( this ), "image", NULL ) == NULL );
+}
+
+/** Check if we have a way to derive something than test audio.
+*/
+
+int mlt_frame_is_test_audio( mlt_frame this )
+{
+ return this->get_audio == NULL;
}
/** Get the aspect ratio of the frame.
extern mlt_frame mlt_frame_init( );
extern mlt_properties mlt_frame_properties( mlt_frame this );
extern int mlt_frame_is_test_card( mlt_frame this );
+extern int mlt_frame_is_test_audio( mlt_frame this );
extern double mlt_frame_get_aspect_ratio( mlt_frame this );
extern int mlt_frame_set_aspect_ratio( mlt_frame this, double value );
extern mlt_position mlt_frame_get_position( mlt_frame this );
int i = 0;
int looking = 1;
int done = 0;
- mlt_frame temp;
+ mlt_frame temp = NULL;
// Get the properties of the parent producer
mlt_properties properties = mlt_producer_properties( parent );
// Use this as output if we don't have one already
*frame = temp;
}
- else if ( !mlt_frame_is_test_card( temp ) && looking )
+ else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) &&
+ mlt_producer_frame( parent ) == mlt_properties_get_position( mlt_frame_properties( temp ), "position" ) )
+ {
+ *frame = temp;
+ looking = 0;
+ }
+ else if ( ( !mlt_frame_is_test_card( temp ) || !mlt_frame_is_test_audio( temp ) ) && looking )
{
// This is the one we want and we can stop looking
*frame = temp;
mlt_position in = mlt_transition_get_in( transition );
mlt_position out = mlt_transition_get_out( transition );
mlt_position time = mlt_frame_get_position( b_frame );
- double pos = ( time - in ) / ( out - in );
+ double pos = ( (double)time - (double)in ) / ( (double)out - (double)in + 1 );
// Set the b frame properties
mlt_properties_set_double( b_props, "mix", pos );
// This will hold the size of the dv frame
int size = 0;
+ // determine if this a test card
+ int is_test = mlt_frame_is_test_card( frame );
+
// If we get an encoder, then encode the image
if ( encoder != NULL )
{
}
// Process the frame
- if ( size != 0 )
+ if ( size != 0 && !( mlt_properties_get_int( this_properties, "was_test_card" ) && is_test ) )
{
// Encode the image
dv_encode_full_frame( encoder, &image, e_dv_color_yuv, dv_frame );
+
+ // Note test card status
+ mlt_properties_set_int( this_properties, "was_test_card", is_test );
}
}
// Push the image callback
mlt_frame_push_get_image( *frame, producer_get_image );
-
}
else
{
}
// Push the image callback
- mlt_frame_push_get_image( *frame, producer_get_image );
+ if ( !this->end_of_video )
+ mlt_frame_push_get_image( *frame, producer_get_image );
}
// Set the audio pipe
mlt_properties_set_data( properties, "producer_ffmpeg", this, 0, NULL, NULL );
// Hmm - register audio callback
- ( *frame )->get_audio = producer_get_audio;
+ if ( !this->end_of_audio )
+ ( *frame )->get_audio = producer_get_audio;
// Get the additional properties
double aspect_ratio = mlt_properties_get_double( producer_properties, "aspect_ratio" );
double speed = mlt_properties_get_double( producer_properties, "speed" );
- char *video_file = mlt_properties_get( producer_properties, "video_file" );
// Set them on the frame
mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio );
mlt_properties_set_double( properties, "speed", speed );
- if ( strchr( video_file, '/' ) != NULL )
- mlt_properties_set( properties, "file", strrchr( video_file, '/' ) + 1 );
- else
- mlt_properties_set( properties, "file", video_file );
-
// Set the out point on the producer
if ( this->end_of_video && this->end_of_audio )