ffmpegdec: 2.try to fix ogg stream play

Origin commit data
------------------
Commit: 7f4c1c2848
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2020-01-19 (Sun, 19 Jan 2020)
This commit is contained in:
Jacek Jendrzej
2020-01-19 21:24:32 +01:00
committed by vanhofen
parent 8a0c35b889
commit d941645566

View File

@@ -112,7 +112,10 @@ int64_t CFfmpegDec::Seek(int64_t offset, int whence)
if (whence == AVSEEK_SIZE)
return (int64_t) -1;
fseek((FILE *) in, (long) offset, whence);
int ret = fseek((FILE *) in, (long) offset, whence);
if(ret < 0) {
return -1;
}
return (int64_t) ftell((FILE *) in);
}
@@ -151,15 +154,10 @@ bool CFfmpegDec::Init(void *_in, const CFile::FileType ft)
av_freep(&buffer);
return false;
}
bool use_seek = true;
if (is_stream){
avc->probesize = 128 * 1024;
av_opt_set_int(avc, "analyzeduration", 1000000, 0);
if(ft == CFile::FILE_OGG)
use_seek = false;
}
avc->probesize = 128 * 1024;
av_opt_set_int(avc, "analyzeduration", 1000000, 0);
avioc = avio_alloc_context (buffer, buffer_size, 0, this, read_packet, NULL, use_seek ? seek_packet:NULL);
avioc = avio_alloc_context (buffer, buffer_size, 0, this, read_packet, NULL, seek_packet);
if (!avioc) {
av_freep(&buffer);
avformat_free_context(avc);