-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathffmpeg.h
executable file
·65 lines (54 loc) · 1.16 KB
/
ffmpeg.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <filesystem>
#include <vector>
#include "Log.h"
namespace ps
{
enum class Endianness_t
{
Big,
Little
};
enum class Interleaving_t
{
/// Samples are grouped by time frame first, one frame containing all channels.
Yes,
/// Samples are grouped per channels first, each channels containing samples
/// in the same order.
No,
};
enum class BitDepth_t
{
// 2 bytes per samples, fully used.
BD16,
// 4 bytes per samples, only 3 bytes used.
BD24,
// 4 bytes per samples.
BD32,
};
enum class Representation_t
{
Signed,
Unsigned,
Float
};
struct SampleFormat
{
Interleaving_t Interleaving;
int SampleRate;
Representation_t Repr;
int BitDepth;
Endianness_t Endianness;
};
struct AudioData
{
SampleFormat Format;
std::vector<uint8_t> Samples;
};
/// ALWAYS expecting two channels for now. Thinking to duplicate the mono
/// channels here.
/// This is obviously not
AudioData readAudioFile(const std::filesystem::path&);
/// Convert samples to a new format.
AudioData convert(AudioData&& input, SampleFormat newFormat);
}