-
Notifications
You must be signed in to change notification settings - Fork 10
/
encode.h
46 lines (37 loc) · 895 Bytes
/
encode.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
41
42
43
44
45
46
#ifndef ENCODE_H
#define ENCODE_H
#include "flvtag.h"
#include "rtmp.h"
#include "screencap.h"
#include <QFile>
extern "C"
{
#include <x264.h>
#include <libswscale/swscale.h>
#include <fdk-aac/aacenc_lib.h>
}
class Encode : public QObject
{
Q_OBJECT
public:
explicit Encode(QSize resolution, QObject *parent = 0);
~Encode();
//private slots:
void encodeFrame(QImage,quint32);
void encodeFrame(QByteArray,quint32);
private:
QThread m_thread;
QSize m_resolution;
// video encoder
SwsContext *m_swCtx;
x264_t *m_264enc;
// audio encoder
HANDLE_AACENCODER m_aacenc;
// flv writer
void writeFlvTag(quint8 TagType, qint64 Pts, qint64 Dts, bool Keyframe, quint8 *data, int size, bool SequenceHeader = false);
QFile m_file;
QList<FlvTag> m_video;
QList<FlvTag> m_audio;
Rtmp m_rtmp;
};
#endif // ENCODE_H