blob: 2993974f9614f8e03df9878428cea921db78cc51 (
plain)
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
|
#pragma once
#include "sources/soundsourceprovider.h"
#include "util/memory.h"
#define OV_EXCLUDE_STATIC_CALLBACKS
#include <vorbis/vorbisfile.h>
QT_FORWARD_DECLARE_CLASS(QFile);
namespace mixxx {
class SoundSourceOggVorbis final : public SoundSource {
public:
explicit SoundSourceOggVorbis(const QUrl &url);
~SoundSourceOggVorbis() override;
void close() override;
protected:
ReadableSampleFrames readSampleFramesClamped(
const WritableSampleFrames& sampleFrames) override;
private:
OpenResult tryOpen(
OpenMode mode,
const OpenParams ¶ms) override;
static size_t ReadCallback(void *ptr, size_t size, size_t nmemb, void *datasource);
static int SeekCallback(void *datasource, ogg_int64_t offset, int whence);
static int CloseCallback(void *datasource);
static long TellCallback(void *datasource);
static ov_callbacks s_callbacks;
std::unique_ptr<QFile> m_pFile;
OggVorbis_File m_vf;
SINT m_curFrameIndex;
};
class SoundSourceProviderOggVorbis : public SoundSourceProvider {
public:
static const QString kDisplayName;
static const QStringList kSupportedFileExtensions;
QString getDisplayName() const override {
return kDisplayName;
}
QStringList getSupportedFileExtensions() const override {
return kSupportedFileExtensions;
}
SoundSourceProviderPriority getPriorityHint(
const QString& supportedFileExtension) const override;
SoundSourcePointer newSoundSource(const QUrl &url) override {
return newSoundSourceFromUrl<SoundSourceOggVorbis>(url);
}
};
} // namespace mixxx
|