blob: 54e4c0794fd332ecb35ceea25bf29cca0bf0a576 (
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
|
#pragma once
#include <QDebug>
#include "sources/audiosource.h"
#include "sources/metadatasourcetaglib.h"
#include "util/assert.h"
namespace mixxx {
// Base class for sound sources with a default implementation (Taglib)
// for reading/writing metadata.
class SoundSource
: public AudioSource,
public MetadataSourceTagLib {
public:
static QString getFileExtensionFromUrl(const QUrl& url);
QString getType() const {
return m_type;
}
protected:
// If no type is provided the file extension of the file referred
// by the URL will be used as the type of the SoundSource.
explicit SoundSource(const QUrl& url)
: SoundSource(url, getFileExtensionFromUrl(url)) {
}
SoundSource(const QUrl& url, const QString& type);
private:
QString m_type;
};
typedef std::shared_ptr<SoundSource> SoundSourcePointer;
template<typename T>
SoundSourcePointer newSoundSourceFromUrl(const QUrl& url) {
return std::make_shared<T>(url);
}
} // namespace mixxx
|