-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathVideoEncoder.h
More file actions
48 lines (34 loc) · 1.05 KB
/
VideoEncoder.h
File metadata and controls
48 lines (34 loc) · 1.05 KB
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
47
#pragma once
#include "ffmpeg.h"
#include "FrameSinks/VideoFrameSink.h"
#include "Codecs/VideoCodec.h"
#include "VideoFormatConverter.h"
#include "Muxing/Muxer.h"
namespace ffmpegcpp
{
class VideoEncoder : public VideoFrameSink
{
public:
VideoEncoder(VideoCodec* codec, Muxer* muxer);
VideoEncoder(VideoCodec* codec, Muxer* muxer, AVPixelFormat format);
VideoEncoder(VideoCodec* codec, Muxer* muxer, AVRational frameRate);
VideoEncoder(VideoCodec* codec, Muxer* muxer, AVRational frameRate, AVPixelFormat format);
virtual ~VideoEncoder();
void WriteFrame(AVFrame* frame, AVRational* timeBase);
void Close();
bool IsPrimed();
private:
void OpenLazily(AVFrame* frame, AVRational* timeBase);
void PollCodecForPackets();
VideoCodec* closedCodec;
OutputStream* output;
VideoFormatConverter* formatConverter = nullptr;
OpenCodec* codec = nullptr;
AVPacket* pkt = nullptr;
int frameNumber = 0;
void CleanUp();
AVPixelFormat finalPixelFormat = AV_PIX_FMT_NONE;
AVRational finalFrameRate;
bool finalFrameRateSet = false;
};
}