// Fast forward - seeking is inefficient for small distances - just ignore following frames
ignore = position - expected;
}
- else
+ else if ( position < expected || position - expected >= 12 )
{
// Set to the real timecode
av_seek_frame( context, -1, mlt_properties_get_double( properties, "start_time" ) + real_timecode * 1000000.0 );
// No codec, no show...
if ( codec != NULL )
{
- double aspect_ratio = 1;
double source_fps = 0;
- // Set aspect ratio
+ // XXX: We won't know the real aspect ratio until an image is decoded
+ // but we do need it now (to satisfy filter_resize) - take a guess based
+ // on pal/ntsc
if ( codec_context->sample_aspect_ratio.num > 0 )
- aspect_ratio = av_q2d( codec_context->sample_aspect_ratio );
+ {
+ mlt_properties_set_double( properties, "aspect_ratio", av_q2d( codec_context->sample_aspect_ratio ) );
+ }
+ else
+ {
+ int is_pal = mlt_properties_get_double( properties, "fps" ) == 25.0;
+ mlt_properties_set_double( properties, "aspect_ratio", is_pal ? 128.0/117.0 : 72.0/79.0 );
+ }
- mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio );
//fprintf( stderr, "AVFORMAT: sample aspect %f %dx%d\n", av_q2d( codec_context->sample_aspect_ratio ), codec_context->width, codec_context->height );
// Determine the fps
// Fast forward - seeking is inefficient for small distances - just ignore following frames
ignore = position - expected;
}
- else
+ else if ( position < expected || position - expected >= 12 )
{
// Set to the real timecode
if ( av_seek_frame( context, -1, mlt_properties_get_double( properties, "start_time" ) + real_timecode * 1000000.0 ) != 0 )