-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAudioDecoderVorbis.h
37 lines (33 loc) · 1 KB
/
AudioDecoderVorbis.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
#pragma once
#include "AudioDecoder.h"
#include "AudioStream.h"
#define OV_EXCLUDE_STATIC_CALLBACKS
#ifdef CC_VERSION
#include "../../external/ogg/include/vorbis/codec.h"
#include "../../external/ogg/include/vorbis/vorbisfile.h"
#else
#include "../../external/OggDecoder/include/vorbis/codec.h"
#include "../../external/OggDecoder/include/vorbis/vorbisfile.h"
#endif // CC_VERSION
#include <cstdint>
namespace audio
{
class DecoderVorbis : public Decoder
{
DecoderVorbis(size_t bufferSize);
virtual ~DecoderVorbis();
bool init(Stream* src);
public:
static DecoderVorbis* create(Stream* src, size_t bufferSize);
int64_t decode(char* dst, uint64_t bytesToRead) override;
bool seek(int64_t frameOffset) override;
int64_t tell() override;
bool isSeekable() override;
private:
ov_callbacks vorbisCallbacks; // Callbacks used to read the file from mem
OggVorbis_File handle; // Handle to the file
vorbis_info* vorbisInfo = nullptr;
vorbis_comment* vorbisComment = nullptr;
int endian = 0;
};
}