Commit 2667dca3 authored by NzSN's avatar NzSN

update

parent ebf78f4c
...@@ -35,15 +35,6 @@ bool InOutCtx::isReady() noexcept { ...@@ -35,15 +35,6 @@ bool InOutCtx::isReady() noexcept {
// InCtx // // InCtx //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
InCtx::InCtx(std::string path, CustomProto proto):
InOutCtx(path, proto) {
// FIXME: Build AVIOContex for custom proto
AVIOContext *customIO = nullptr;
fmt = Utils::makeInAVFormat(path, customIO);
}
void InCtx::readFrame(AVPacket *packet) { void InCtx::readFrame(AVPacket *packet) {
if (av_read_frame(fmt.get(), packet) < 0) if (av_read_frame(fmt.get(), packet) < 0)
throw END_OF_FILE(); throw END_OF_FILE();
......
...@@ -41,7 +41,7 @@ enum IOCTX_ERROR { ...@@ -41,7 +41,7 @@ enum IOCTX_ERROR {
using StreamPrediction = std::function<bool(AVStream*)>; using StreamPrediction = std::function<bool(AVStream*)>;
template<typename T>
class InOutCtx { class InOutCtx {
public: public:
InOutCtx(std::string path, bool isCustom): InOutCtx(std::string path, bool isCustom):
...@@ -52,6 +52,7 @@ public: ...@@ -52,6 +52,7 @@ public:
protected: protected:
Utils::AVFormatContextShared fmt; Utils::AVFormatContextShared fmt;
std::string path; std::string path;
bool isCustomIO;
}; };
......
...@@ -29,15 +29,15 @@ public: ...@@ -29,15 +29,15 @@ public:
name(name), flag(flag), io(nullptr), priv(priv) {} name(name), flag(flag), io(nullptr), priv(priv) {}
int read_packet(void *priv, uint8_t *buf, int bufSize) { int read_packet(void *priv, uint8_t *buf, int bufSize) {
static_cast<T*>(this)->read_packet_internal(priv, buf, bufSize); return static_cast<T*>(this)->read_packet_internal(priv, buf, bufSize);
} }
int write_packet(void *priv, uint8_t *buf, int bufSize) { int write_packet(void *priv, uint8_t *buf, int bufSize) {
static_cast<T*>(this)->write_packet_internal(priv, buf, bufSize); return static_cast<T*>(this)->write_packet_internal(priv, buf, bufSize);
} }
int64_t seek_packet(void *opaque, int64_t offset, int whence) { int64_t seek_packet(void *opaque, int64_t offset, int whence) {
static_cast<T*>(this)->seek_packet_internal(opaque, offset, whence); return static_cast<T*>(this)->seek_packet_internal(opaque, offset, whence);
} }
AVIOContext* to_avioctx() noexcept { AVIOContext* to_avioctx() noexcept {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment