From ca25c039315155bfa3882b6a68ba9e87d18d5b56 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 17 Jan 2020 16:25:46 +0100 Subject: [PATCH] ffmpegdec: supplement to fix ogg stream play, disable seek only on ogg format. --- src/driver/audiodec/ffmpegdec.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index 2bad5d34b..b33d8ce8a 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -121,7 +121,7 @@ static int64_t seek_packet(void *opaque, int64_t offset, int 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 = ""; artist = ""; @@ -151,12 +151,15 @@ 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; } - 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) { av_freep(&buffer); avformat_free_context(avc);