-
Notifications
You must be signed in to change notification settings - Fork 134
Expand file tree
/
Copy pathCodecDeducer.cpp
More file actions
53 lines (47 loc) · 1.2 KB
/
CodecDeducer.cpp
File metadata and controls
53 lines (47 loc) · 1.2 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
#include "CodecDeducer.h"
#include "FFmpegException.h"
using namespace std;
namespace ffmpegcpp
{
AVCodec* CodecDeducer::DeduceEncoder(const char* codecName)
{
AVCodec* codec = avcodec_find_encoder_by_name(codecName);
if (!codec)
{
throw FFmpegException("Codec " + string(codecName) + " not found");
}
return codec;
}
AVCodec* CodecDeducer::DeduceEncoder(AVCodecID codecId)
{
AVCodec* codec = avcodec_find_encoder(codecId);
if (!codec)
{
throw FFmpegException("Codec with id " + to_string((int)codecId) + " not found");
}
return codec;
}
AVCodec* CodecDeducer::DeduceDecoder(const char* codecName)
{
AVCodec* codec = avcodec_find_decoder_by_name(codecName);
if (!codec)
{
throw FFmpegException("Codec " + string(codecName) + " not found");
}
return codec;
}
AVCodec* CodecDeducer::DeduceDecoder(AVCodecID codecId)
{
if (codecId == AV_CODEC_ID_NONE) return nullptr;
AVCodec* codec = avcodec_find_decoder(codecId);
if (!codec)
{
throw FFmpegException("Codec with id " + to_string((int)codecId) + " not found");
}
return codec;
}
AVCodec* CodecDeducer::DeduceEncoderFromFilename(const char* fileName)
{
throw FFmpegException("Not implemented yet");
}
}