11#include "libavformat/avio.h"
14#define LOC QString("StreamRingBuf(%1): ").arg(m_filename)
66 if (url.path().endsWith(QLatin1String(
"m3u8"), Qt::CaseInsensitive))
67 url.setScheme(
"hls+http");
69 int res = avio_open(&
m_context, url.toString().toLatin1(), AVIO_FLAG_READ);
72 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Failed to open stream (%1) (error %2)")
74 m_lastError = QObject::tr(
"Failed to open stream (%1)").arg(res);
82 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Opened %1 (allow seeks: %2")
95 int64_t seek = avio_seek(
m_context, Position, Whence);
112 while (len <
static_cast<int>(Size))
114 int ret = avio_read(
m_context,
static_cast<unsigned char*
>(
Buffer) + len,
115 static_cast<int>(Size) - len);
118 if (ret == AVERROR_EOF)
133 long long result = -1;
long long GetReadPosition(void) const override
bool OpenFile(const QString &Filename, std::chrono::milliseconds Retry=kDefaultOpenTimeout) override
bool IsOpen(void) const override
MythStreamingBuffer(const QString &Filename)
long long GetRealFileSizeInternal(void) const override
struct AVIOContext * m_context
int SafeRead(void *Buffer, uint Size) override
long long SeekInternal(long long Position, int Whence) override
~MythStreamingBuffer() override
QString boolToQString(bool val)
This is equivalent to QVariant(bool).toString()
#define LOG(_MASK_, _LEVEL_, _QSTRING_)