mirror of
https://github.com/niellun/FastCarPlay.git
synced 2026-06-07 09:38:25 +02:00
Initial commit. Version 0.1
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#ifndef SRC_DECODER
|
||||
#define SRC_DECODER
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libswscale/swscale.h>
|
||||
}
|
||||
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
#include "struct/video_buffer.h"
|
||||
#include "struct/raw_queue.h"
|
||||
|
||||
class Decoder
|
||||
{
|
||||
|
||||
public:
|
||||
Decoder();
|
||||
~Decoder();
|
||||
|
||||
void start(RawQueue *data, VideoBuffer *vb, AVCodecID codecId);
|
||||
void stop();
|
||||
|
||||
private:
|
||||
void runner();
|
||||
void loop(AVCodecContext *context, AVCodecParserContext *parser, AVPacket *packet, AVFrame *frame);
|
||||
static AVCodecContext *load_codec(AVCodecID codec_id);
|
||||
|
||||
std::thread _thread;
|
||||
AVCodecID _codecId;
|
||||
Error _status;
|
||||
|
||||
std::atomic<bool> _active = false;
|
||||
std::atomic<bool> _running = false;
|
||||
|
||||
RawQueue *_data = nullptr;
|
||||
VideoBuffer *_vb = nullptr;
|
||||
};
|
||||
|
||||
#endif /* SRC_DECODER */
|
||||
Reference in New Issue
Block a user