-
Notifications
You must be signed in to change notification settings - Fork 135
Expand file tree
/
Copy pathDemuxer.h
More file actions
59 lines (42 loc) · 1.26 KB
/
Demuxer.h
File metadata and controls
59 lines (42 loc) · 1.26 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
51
52
53
54
55
56
57
58
59
#pragma once
#include "ffmpeg.h"
#include "std.h"
#include "Demuxing/AudioInputStream.h"
#include "Demuxing/VideoInputStream.h"
#include "Demuxing/InputStream.h"
#include "Sources/InputSource.h"
namespace ffmpegcpp
{
struct StreamInfo
{
int streamId;
AVCodec* codec;
AVStream* stream;
};
class Demuxer : public InputSource
{
public:
Demuxer(const char* fileName);
Demuxer(const char* fileName, AVInputFormat* inputFormat, AVDictionary *inputFormatOptions);
~Demuxer();
void DecodeBestAudioStream(AudioFrameSink* frameSink);
void DecodeBestVideoStream(VideoFrameSink* frameSink);
void DecodeAudioStream(int streamId, AudioFrameSink* frameSink);
void DecodeVideoStream(int streamId, VideoFrameSink* frameSink);
std::vector<StreamInfo> GetAudioStreamInfo();
std::vector<StreamInfo> GetVideoStreamInfo();
virtual void PreparePipeline();
virtual bool IsDone();
virtual void Step();
private:
bool done = false;
const char* fileName;
std::vector<StreamInfo> GetStreamInfo(AVMediaType mediaType);
StreamInfo CreateInfo(int streamIndex, AVStream* stream, AVCodec* codec);
InputStream** inputStreams = nullptr;
AVFormatContext* containerContext = nullptr;
AVPacket* pkt = nullptr;
void DecodePacket();
void CleanUp();
};
}