summaryrefslogtreecommitdiffstats
path: root/src/sources/soundsource.cpp
blob: 9dcefd02ff3821eecc8077e0682ae3380e5e6402 (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
#include "sources/soundsource.h"

#include "util/logger.h"

namespace mixxx {

namespace {

const Logger kLogger("AudioSource");

inline QUrl validateUrl(QUrl url) {
    DEBUG_ASSERT(url.isValid());
    VERIFY_OR_DEBUG_ASSERT(url.isLocalFile()) {
        kLogger.warning()
                << "Unsupported URL:"
                << url.toString();
    }
    return url;
}

} // anonymous namespace

/*static*/ QString SoundSource::getFileExtensionFromUrl(const QUrl& url) {
    return validateUrl(url).toString().section(".", -1).toLower().trimmed();
}

SoundSource::SoundSource(const QUrl& url, const QString& type)
        : AudioSource(validateUrl(url)),
          MetadataSourceTagLib(getLocalFileName()),
          m_type(type) {
}

} // namespace mixxx