#ifndef _cffmpeg_decoder_hpp_
|
#define _cffmpeg_decoder_hpp_
|
|
#include <stdint.h>
|
#include <memory>
|
#include <list>
|
#include <mutex>
|
#include <thread>
|
#include <atomic>
|
#include <condition_variable>
|
|
struct AVFrame;
|
struct AVCodecContext;
|
|
class CPacket;
|
|
namespace ffwrapper
|
{
|
class FormatIn;
|
class CodedData;
|
class cvbridge;
|
} // namespace ffwrapper
|
|
namespace cffmpeg_wrap
|
{
|
typedef struct _frm{
|
uint8_t *data;
|
int length;
|
int width;
|
int height;
|
int format;
|
int64_t id;
|
}FRM;
|
|
class decoder
|
{
|
private:
|
|
ffwrapper::FormatIn *decRef_;
|
ffwrapper::cvbridge *conv_;
|
|
std::list<FRM> list_frm_;
|
std::mutex mutex_frm_;
|
|
private:
|
int initDecoder();
|
int saveFrame(AVFrame *frame, const int64_t &id);
|
public:
|
void Start();
|
int SetFrame(const CPacket &pkt);
|
void GetFrame(unsigned char **data, int *w, int *h, int *format, int *length, int64_t *id);
|
|
public:
|
explicit decoder(ffwrapper::FormatIn *dec);
|
~decoder();
|
};
|
|
} // namespace cffmpeg_wrap
|
|
|
#endif
|