-
Notifications
You must be signed in to change notification settings - Fork 0
/
FFmpegDemuxer.h
40 lines (32 loc) · 983 Bytes
/
FFmpegDemuxer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <phpcpp.h>
#include <condition_variable>
#include <libavformat/avformat.h>
#include <libavcodec/codec.h>
class FFmpegDemuxer : public Php::Base
{
private:
AVFormatContext *demuxer = NULL;
AVCodecContext *decoder = NULL;
AVCodecContext *encoder = NULL;
AVFilterGraph *filter_graph = NULL;
AVPacket packet;
int bytes_per_sample = -1;
bool threaded_running = false;
int threaded_error = -1;
std::condition_variable demuxer_cv;
std::mutex demuxer_mutex;
void demuxDecodeAndFilterLoop();
public:
void __construct(Php::Parameters ¶ms);
// Basic, unbuffered
Php::Value demuxAndDecode();
Php::Value receive();
// Buffered using a filter_graph as a buffer
Php::Value demuxDecodeAndFilter();
Php::Value receiveFilter();
// Threaded and buffered using filter graph as a buffer
Php::Value beginDemuxDecodeAndFilter();
Php::Value isEof();
Php::Value isError();
void __destruct();
};