3#ifndef REMOTEAVFORMATCONTEXT_H
4#define REMOTEAVFORMATCONTEXT_H
11#include <libavformat/avformat.h>
12#include <libavformat/avio.h>
60 AVProbeData probe_data;
61 memset(&probe_data, 0,
sizeof(AVProbeData));
62 probe_data.filename =
"stream";
66 const AVInputFormat *fmt = av_probe_input_format(&probe_data, 1);
74 int ret = avformat_open_input(&
m_inputFC,
"stream", fmt,
nullptr);
80 int ret = avformat_open_input(&
m_inputFC, qPrintable(
filename),
nullptr,
nullptr);
110 operator AVFormatContext * ()
const {
return m_inputFC; }
114 static int ReadFunc(
void *opaque, uint8_t *buf,
int buf_size)
116 auto *rf =
reinterpret_cast< RemoteFile*
>(opaque);
117 return rf->
Read(buf, buf_size);
123 static int64_t
SeekFunc(
void *opaque, int64_t offset,
int whence)
125 auto *rf =
reinterpret_cast< RemoteFile*
>(opaque);
126 if (whence == AVSEEK_SIZE)
129 return rf->Seek(offset, whence);
~ArchiveRemoteAVFormatContext()
bool Open(const QString &filename)
AVFormatContext * m_inputFC
static int ReadFunc(void *opaque, uint8_t *buf, int buf_size)
AVFormatContext * operator->() const
static int64_t SeekFunc(void *opaque, int64_t offset, int whence)
ArchiveRemoteAVFormatContext(const QString &filename="")
AVIOContext * m_byteIOContext
static int WriteFunc(void *, const uint8_t *, int)
int Read(void *data, int size)
long long Seek(long long pos, int whence, long long curpos=-1)
long long GetFileSize(void) const
GetFileSize: returns the remote file's size at the time it was first opened Will query the server in ...
static constexpr qint64 BUFFER_SIZE