change to fixed rate refresh stratigy for vicons
[goodguy/history.git] / cinelerra-5.0 / cinelerra / ffmpeg.C
index a6bbabc15d0ec5bf3019cfd518e8b576c005fd94..120a75d61368ba62d63a6111879078e05e999be1 100644 (file)
@@ -746,7 +746,7 @@ int FFVideoStream::load(VFrame *vframe, int64_t pos)
                ret = read_frame(frame);
                if( ret > 0 ) ++curr_pos;
        }
-       if( ret > 0 ) {
+       if( ret >= 0 ) {
                AVCodecContext *ctx = st->codec;
                ret = convert_cmodel(vframe, (AVPicture *)frame,
                        ctx->pix_fmt, ctx->width, ctx->height);
@@ -1887,7 +1887,6 @@ int FFMPEG::audio_seek(int stream, int64_t pos)
 {
        int aidx = astrm_index[stream].st_idx;
        FFAudioStream *aud = ffaudio[aidx];
-       pos = pos * aud->sample_rate / file_base->asset->sample_rate + 0.5;
        aud->audio_seek(pos);
        return 0;
 }
@@ -1896,7 +1895,6 @@ int FFMPEG::video_seek(int stream, int64_t pos)
 {
        int vidx = vstrm_index[stream].st_idx;
        FFVideoStream *vid = ffvideo[vidx];
-       pos = pos * vid->frame_rate / file_base->asset->frame_rate + 0.5;
        vid->video_seek(pos);
        return 0;
 }
@@ -1907,7 +1905,6 @@ int FFMPEG::decode(int chn, int64_t pos, double *samples, int len)
        if( !has_audio || chn >= astrm_index.size() ) return -1;
        int aidx = astrm_index[chn].st_idx;
        FFAudioStream *aud = ffaudio[aidx];
-       pos = pos * aud->sample_rate / file_base->asset->sample_rate + 0.5;
        if( aud->load(pos, len) < len ) return -1;
        int ch = astrm_index[chn].st_ch;
        int ret = aud->read(samples,len,ch);
@@ -1919,7 +1916,6 @@ int FFMPEG::decode(int layer, int64_t pos, VFrame *vframe)
        if( !has_video || layer >= vstrm_index.size() ) return -1;
        int vidx = vstrm_index[layer].st_idx;
        FFVideoStream *vid = ffvideo[vidx];
-       pos = pos * vid->frame_rate / file_base->asset->frame_rate + 0.5;
        return vid->load(vframe, pos);
 }