diff --git a/README.md b/README.md index be573552e..e8486ca65 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Strawberry is a audio player and music collection organizer. It is a fork of Cle ### :heavy_check_mark: Features: * Play and organize music - * Supports WAV, FLAC, WavPack, DSF, DSDIFF, Ogg Vorbis, Speex, MPC, TrueAudio, AIFF, MP4, MP3 and ASF + * Supports WAV, FLAC, WavPack, DSF, DSDIFF, Ogg Vorbis, Speex, MPC, TrueAudio, AIFF, MP4, MP3, ASF and Monkey's Audio. * Audio CD playback * Native desktop notifications * Playlists in multiple formats diff --git a/ext/libstrawberry-tagreader/tagreader.cpp b/ext/libstrawberry-tagreader/tagreader.cpp index 94669057d..f10c0576b 100644 --- a/ext/libstrawberry-tagreader/tagreader.cpp +++ b/ext/libstrawberry-tagreader/tagreader.cpp @@ -66,6 +66,7 @@ #include #include #include +#include #ifdef HAVE_TAGLIB_DSFFILE # include # include @@ -329,6 +330,10 @@ void TagReader::ReadFile(const QString &filename, pb::tagreader::SongMetadata *s } } + else if (TagLib::APE::File *file = dynamic_cast(fileref->file())) { + song->set_bitdepth(file->audioProperties()->bitsPerSample()); + } + else if (tag) { Decode(tag->comment(), nullptr, song->mutable_comment()); } @@ -490,6 +495,7 @@ pb::tagreader::SongMetadata_FileType TagReader::GuessFileType(TagLib::FileRef *f if (dynamic_cast(fileref->file())) return pb::tagreader::SongMetadata_FileType_AIFF; if (dynamic_cast(fileref->file())) return pb::tagreader::SongMetadata_FileType_MPC; if (dynamic_cast(fileref->file())) return pb::tagreader::SongMetadata_FileType_TRUEAUDIO; + if (dynamic_cast(fileref->file())) return pb::tagreader::SongMetadata_FileType_APE; #ifdef HAVE_TAGLIB_DSFFILE if (dynamic_cast(fileref->file())) return pb::tagreader::SongMetadata_FileType_DSF; if (dynamic_cast(fileref->file())) return pb::tagreader::SongMetadata_FileType_DSDIFF; diff --git a/ext/libstrawberry-tagreader/tagreadermessages.proto b/ext/libstrawberry-tagreader/tagreadermessages.proto index 3e2bb8af6..b16d0b924 100644 --- a/ext/libstrawberry-tagreader/tagreadermessages.proto +++ b/ext/libstrawberry-tagreader/tagreadermessages.proto @@ -22,6 +22,7 @@ message SongMetadata { DSF = 14; DSDIFF = 15; PCM = 16; + APE = 17; CDDA = 90; STREAM = 91; } diff --git a/src/core/song.cpp b/src/core/song.cpp index 9a1b157ce..1dd4efa2c 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -431,6 +431,7 @@ QString Song::TextForFiletype(FileType filetype) { case Song::FileType_DSF: return QObject::tr("DSF"); case Song::FileType_DSDIFF: return QObject::tr("DSDIFF"); case Song::FileType_PCM: return QObject::tr("PCM"); + case Song::FileType_APE: return QObject::tr("Monkey's Audio"); case Song::FileType_CDDA: return QObject::tr("CDDA"); case Song::FileType_Stream: return QObject::tr("Stream"); case Song::FileType_Unknown: @@ -458,6 +459,7 @@ QIcon Song::IconForFiletype(FileType filetype) { case Song::FileType_DSF: return IconLoader::Load("dsf"); case Song::FileType_DSDIFF: return IconLoader::Load("dsd"); case Song::FileType_PCM: return IconLoader::Load("pcm"); + case Song::FileType_APE: return IconLoader::Load("ape"); case Song::FileType_CDDA: return IconLoader::Load("cd"); case Song::FileType_Stream: return IconLoader::Load("applications-internet"); case Song::FileType_Unknown: @@ -475,6 +477,7 @@ bool Song::IsFileLossless() const { case Song::FileType_AIFF: case Song::FileType_DSF: case Song::FileType_DSDIFF: + case Song::FileType_APE: return true; default: return false; @@ -496,6 +499,7 @@ Song::FileType Song::FiletypeByExtension(QString ext) { else if (ext.toLower() == "mpc" || ext.toLower() == "mp+" || ext.toLower() == "mpp") return Song::FileType_MPC; else if (ext.toLower() == "dsf") return Song::FileType_DSF; else if (ext.toLower() == "dsd" || ext.toLower() == "dff") return Song::FileType_DSDIFF; + else if (ext.toLower() == "ape") return Song::FileType_APE; else return Song::FileType_Unknown; } @@ -518,6 +522,7 @@ void Song::Init(const QString &title, const QString &artist, const QString &albu d->album_ = album; set_length_nanosec(length_nanosec); + } void Song::Init(const QString &title, const QString &artist, const QString &album, qint64 beginning, qint64 end) { @@ -530,6 +535,7 @@ void Song::Init(const QString &title, const QString &artist, const QString &albu d->beginning_ = beginning; d->end_ = end; + } void Song::set_genre_id3(int id) { diff --git a/src/core/song.h b/src/core/song.h index be201fe40..555a4a4c3 100644 --- a/src/core/song.h +++ b/src/core/song.h @@ -120,6 +120,7 @@ class Song { FileType_DSF = 14, FileType_DSDIFF = 15, FileType_PCM = 16, + FileType_APE = 17, FileType_CDDA = 90, FileType_Stream = 91, }; diff --git a/src/playlistparsers/cueparser.cpp b/src/playlistparsers/cueparser.cpp index f77488f06..06ba196ff 100644 --- a/src/playlistparsers/cueparser.cpp +++ b/src/playlistparsers/cueparser.cpp @@ -58,6 +58,7 @@ CueParser::CueParser(CollectionBackendInterface *collection, QObject *parent) : ParserBase(collection, parent) {} SongList CueParser::Load(QIODevice *device, const QString &playlist_path, const QDir &dir) const { + SongList ret; QTextStream text_stream(device); diff --git a/src/playlistparsers/parserbase.cpp b/src/playlistparsers/parserbase.cpp index 26cbb476c..c41a8c386 100644 --- a/src/playlistparsers/parserbase.cpp +++ b/src/playlistparsers/parserbase.cpp @@ -91,6 +91,7 @@ void ParserBase::LoadSong(const QString &filename_or_url, qint64 beginning, cons Song ParserBase::LoadSong(const QString &filename_or_url, qint64 beginning, const QDir &dir) const { Song song; + song.set_source(Song::Source_LocalFile); LoadSong(filename_or_url, beginning, dir, &song); return song;