11#include "libavformat/avio.h"
14#define LOC QString("StreamRingBuf(%1): ").arg(m_filename)
74 if (url.path().endsWith(QLatin1String(
"m3u8"), Qt::CaseInsensitive))
75 url.setScheme(
"hls+http");
77 int res = avio_open(&
m_context, url.toString().toLatin1().constData(),
81 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Failed to open stream (%1) (error %2)")
83 m_lastError = QObject::tr(
"Failed to open stream (%1)").arg(res);
91 LOG(VB_GENERAL, LOG_INFO,
LOC + QString(
"Opened %1 (allow seeks: %2")
104 int64_t seek = avio_seek(
m_context, Position, Whence);
121 while (len <
static_cast<int>(Size))
123 int ret = avio_read(
m_context,
static_cast<unsigned char*
>(
Buffer) + len,
124 static_cast<int>(Size) - len);
127 if (ret == AVERROR_EOF)
142 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_)