forked from Glimesh/janus-ftl-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAudioCodec.h
51 lines (46 loc) · 1.03 KB
/
AudioCodec.h
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
/**
* @file VideoCodec.h
* @author Hayden McAfee ([email protected])
* @version 0.1
* @date 2020-08-24
*
* @copyright Copyright (c) 2020 Hayden McAfee
*
*/
#pragma once
#include <algorithm>
#include <string>
enum class AudioCodecKind
{
Unsupported = 0,
Opus
};
class SupportedAudioCodecs
{
public:
static AudioCodecKind ParseAudioCodec(const std::string codec)
{
std::string lowercaseCodec = codec;
std::transform(
lowercaseCodec.begin(),
lowercaseCodec.end(),
lowercaseCodec.begin(),
[](unsigned char c){ return std::tolower(c); });
if (lowercaseCodec.compare("opus") == 0)
{
return AudioCodecKind::Opus;
}
return AudioCodecKind::Unsupported;
}
static std::string AudioCodecString(const AudioCodecKind codec)
{
switch (codec)
{
case AudioCodecKind::Opus:
return "opus";
case AudioCodecKind::Unsupported:
default:
return "";
}
}
};