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

Origin commit data
------------------
Commit: 6c7b93135d
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2020-01-18 (Sat, 18 Jan 2020)
This commit is contained in:
Jacek Jendrzej
2020-01-18 00:10:20 +01:00
committed by vanhofen
parent 89b0b46072
commit caf4eb7b81

View File

@@ -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);