KShare/recording/encoders/encoder.hpp
ArsenArsen 26826b02c2 Recording mostly completed. Who's excited?
Left to do: Error handling. Yep.
2017-06-13 10:56:08 +02:00

45 lines
729 B
C++

#ifndef ENCODER_HPP
#define ENCODER_HPP
#include <QImage>
#include <QSize>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
struct OutputStream {
AVStream *st = NULL;
AVCodecContext *enc = NULL;
int64_t nextPts = 0;
AVFrame *frame = NULL;
SwsContext *sws = NULL;
};
class Encoder {
public:
Encoder(QString &targetFile, QSize res);
~Encoder();
bool addFrame(QImage frm);
bool isRunning();
bool end();
private:
AVCodec *codec = NULL;
OutputStream *out = new OutputStream;
AVFormatContext *fc = NULL;
bool success = false;
QSize size;
void setFrameRGB(uint8_t *rgb);
};
#endif // ENCODER_HPP