X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Favformat%2Fproducer_avformat.c;h=85ee4a5a2b17f0d256932fe4d293fc50f3ef9a34;hb=52fa2474c1a2472022dd12ccea5c794f66532012;hp=bd6927a923cf861dd7fcee99a634f469dd3beac8;hpb=4b2943ff8a4ba25f1eaff2ff6a6c32721d81992c;p=melted diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index bd6927a..85ee4a5 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -281,7 +281,7 @@ static int producer_open( mlt_producer this, char *file ) // Check if we're seekable (something funny about mpeg here :-/) if ( strcmp( file, "pipe:" ) && strncmp( file, "http://", 6 ) ) - mlt_properties_set_int( properties, "seekable", av_seek_frame( context, -1, mlt_properties_get_double( properties, "start_time" ) ) >= 0 ); + mlt_properties_set_int( properties, "seekable", av_seek_frame( context, -1, mlt_properties_get_double( properties, "start_time" ), AVSEEK_FLAG_BACKWARD ) >= 0 ); else av_bypass = 1; @@ -517,7 +517,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form else if ( seekable && ( 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 ); + av_seek_frame( context, -1, mlt_properties_get_double( properties, "start_time" ) + real_timecode * 1000000.0, AVSEEK_FLAG_BACKWARD ); // Remove the cached info relating to the previous position mlt_properties_set_double( properties, "current_time", real_timecode ); @@ -679,11 +679,12 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame ) if ( codec != NULL ) { double source_fps = 0; + int norm_aspect_ratio = mlt_properties_get_int( properties, "norm_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 ) + if ( !norm_aspect_ratio && codec_context->sample_aspect_ratio.num > 0 ) { mlt_properties_set_double( properties, "aspect_ratio", av_q2d( codec_context->sample_aspect_ratio ) ); } @@ -817,7 +818,7 @@ static int producer_get_audio( mlt_frame frame, int16_t **buffer, mlt_audio_form 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 ) + if ( av_seek_frame( context, -1, mlt_properties_get_double( properties, "start_time" ) + real_timecode * 1000000.0, AVSEEK_FLAG_BACKWARD ) != 0 ) paused = 1; // Clear the usage in the audio buffer @@ -1001,7 +1002,7 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index mlt_frame_set_position( *frame, mlt_producer_position( this ) ); // Set the position of this producer - mlt_properties_set_position( mlt_frame_properties( *frame ), "avformat_position", mlt_producer_position( this ) ); + mlt_properties_set_position( mlt_frame_properties( *frame ), "avformat_position", mlt_producer_frame( this ) ); // Set up the video producer_set_up_video( this, *frame );