refactor ffmpeg super class into more maintainable package, cmake is catigorized now ; removed old engine, replaced with new one
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
struct AVCodecContext;
|
||||
struct AVCodecParameters;
|
||||
struct AVPacket;
|
||||
struct AVFrame;
|
||||
|
||||
namespace engine {
|
||||
|
||||
class CodecContext {
|
||||
public:
|
||||
CodecContext() = default;
|
||||
~CodecContext() = default;
|
||||
CodecContext(const CodecContext &) = delete;
|
||||
CodecContext &operator=(const CodecContext &) = delete;
|
||||
|
||||
bool open(const AVCodecParameters *par);
|
||||
void close();
|
||||
|
||||
bool sendPacket(const AVPacket *pkt) const;
|
||||
|
||||
bool receiveFrame(AVFrame *frame) const;
|
||||
|
||||
void flush();
|
||||
|
||||
bool isOpen() const { return m_ctx != nullptr; }
|
||||
int sampleRate()const;
|
||||
int channels() const;
|
||||
|
||||
const AVCodecContext *get() const { return m_ctx.get(); }
|
||||
|
||||
private:
|
||||
struct Deleter { void operator()(AVCodecContext *p) const; };
|
||||
std::unique_ptr<AVCodecContext, Deleter> m_ctx;
|
||||
};
|
||||
|
||||
} // namespace engine
|
||||
Reference in New Issue
Block a user