-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathEncodedFileSource.h
More file actions
50 lines (34 loc) · 1.06 KB
/
EncodedFileSource.h
File metadata and controls
50 lines (34 loc) · 1.06 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
48
49
50
#pragma once
#include "ffmpeg.h"
#include "FrameSinks/FrameSink.h"
#include "Sources/InputSource.h"
namespace ffmpegcpp
{
// EncodedFileSource takes a file that is already encoded but not in a container (ie .mp3, .h264)
// and feeds it to the system.
class EncodedFileSource : public InputSource
{
public:
EncodedFileSource(const char* inFileName, AVCodecID codecId, FrameSink* output);
EncodedFileSource(const char* inFileName, const char* codecName, FrameSink* output);
virtual ~EncodedFileSource();
virtual void PreparePipeline();
virtual bool IsDone();
virtual void Step();
private:
void CleanUp();
bool done = false;
FrameSink* output;
AVCodecParserContext* parser = nullptr;
AVCodec* codec;
AVCodecContext* codecContext = nullptr;
int bufferSize;
AVFrame* decoded_frame = nullptr;
AVPacket* pkt = nullptr;
uint8_t* buffer = nullptr;
FILE* file;
void Init(const char* inFileName, AVCodec* codec, FrameSink* output);
void Decode(AVPacket *packet, AVFrame* targetFrame);
AVRational timeBaseCorrectedByTicksPerFrame;
};
}