ffmpegdec: supplement to fix ogg stream play, disable seek only on ogg format.

This commit is contained in:
Jacek Jendrzej
2020-01-17 16:25:46 +01:00
parent f6f65093ae
commit ca25c03931

View File

@@ -121,7 +121,7 @@ static int64_t seek_packet(void *opaque, int64_t offset, int whence)
return ((CFfmpegDec *) opaque)->Seek(offset, whence); return ((CFfmpegDec *) opaque)->Seek(offset, whence);
} }
bool CFfmpegDec::Init(void *_in, const CFile::FileType /* ft */) bool CFfmpegDec::Init(void *_in, const CFile::FileType ft)
{ {
title = ""; title = "";
artist = ""; artist = "";
@@ -151,12 +151,15 @@ bool CFfmpegDec::Init(void *_in, const CFile::FileType /* ft */)
av_freep(&buffer); av_freep(&buffer);
return false; return false;
} }
bool use_seek = true;
if (is_stream){ if (is_stream){
avc->probesize = 128 * 1024; avc->probesize = 128 * 1024;
av_opt_set_int(avc, "analyzeduration", 1000000, 0); av_opt_set_int(avc, "analyzeduration", 1000000, 0);
if(ft == CFile::FILE_OGG)
use_seek = false;
} }
avioc = avio_alloc_context (buffer, buffer_size, 0, this, read_packet, NULL, !is_stream ? seek_packet:NULL);
avioc = avio_alloc_context (buffer, buffer_size, 0, this, read_packet, NULL, use_seek ? seek_packet:NULL);
if (!avioc) { if (!avioc) {
av_freep(&buffer); av_freep(&buffer);
avformat_free_context(avc); avformat_free_context(avc);