mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-02-03 19:07:39 +01:00
Fix playback of WavPack
This commit is contained in:
parent
210601ffe4
commit
ad2b567216
@ -49,6 +49,7 @@
|
||||
#include <taglib/vorbisfile.h>
|
||||
#include <taglib/speexfile.h>
|
||||
#include <taglib/wavfile.h>
|
||||
#include <taglib/wavpackfile.h>
|
||||
#include <taglib/aifffile.h>
|
||||
#include <taglib/asffile.h>
|
||||
#include "taglib/asftag.h"
|
||||
@ -467,27 +468,28 @@ void TagReader::SetVorbisComments(TagLib::Ogg::XiphComment *vorbis_comments, con
|
||||
|
||||
pb::tagreader::SongMetadata_Type TagReader::GuessFileType(TagLib::FileRef *fileref) const {
|
||||
|
||||
#ifdef TAGLIB_WITH_ASF
|
||||
if (dynamic_cast<TagLib::ASF::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_ASF;
|
||||
#endif
|
||||
if (dynamic_cast<TagLib::RIFF::WAV::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_WAV;
|
||||
if (dynamic_cast<TagLib::FLAC::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_FLAC;
|
||||
#ifdef TAGLIB_WITH_MP4
|
||||
if (dynamic_cast<TagLib::MP4::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_MP4;
|
||||
#endif
|
||||
if (dynamic_cast<TagLib::MPC::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_MPC;
|
||||
if (dynamic_cast<TagLib::MPEG::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_MPEG;
|
||||
if (dynamic_cast<TagLib::WavPack::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_WAVPACK;
|
||||
if (dynamic_cast<TagLib::Ogg::FLAC::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_OGGFLAC;
|
||||
if (dynamic_cast<TagLib::Ogg::Speex::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_OGGSPEEX;
|
||||
if (dynamic_cast<TagLib::Ogg::Vorbis::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_OGGVORBIS;
|
||||
#ifdef TAGLIB_HAS_OPUS
|
||||
if (dynamic_cast<TagLib::Ogg::Opus::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_OGGOPUS;
|
||||
#endif
|
||||
if (dynamic_cast<TagLib::Ogg::Speex::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_OGGSPEEX;
|
||||
if (dynamic_cast<TagLib::MPEG::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_MPEG;
|
||||
#ifdef TAGLIB_WITH_MP4
|
||||
if (dynamic_cast<TagLib::MP4::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_MP4;
|
||||
#endif
|
||||
#ifdef TAGLIB_WITH_ASF
|
||||
if (dynamic_cast<TagLib::ASF::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_ASF;
|
||||
#endif
|
||||
if (dynamic_cast<TagLib::RIFF::AIFF::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_AIFF;
|
||||
if (dynamic_cast<TagLib::RIFF::WAV::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_WAV;
|
||||
if (dynamic_cast<TagLib::MPC::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_MPC;
|
||||
if (dynamic_cast<TagLib::TrueAudio::File*>(fileref->file())) return pb::tagreader::SongMetadata_Type_TRUEAUDIO;
|
||||
|
||||
return pb::tagreader::SongMetadata_Type_UNKNOWN;
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool TagReader::SaveFile(const QString &filename, const pb::tagreader::SongMetadata &song) const {
|
||||
|
@ -6,20 +6,21 @@ message SongMetadata {
|
||||
|
||||
enum Type {
|
||||
UNKNOWN = 0;
|
||||
ASF = 1;
|
||||
WAV = 1;
|
||||
FLAC = 2;
|
||||
MP4 = 3;
|
||||
MPC = 4;
|
||||
MPEG = 5;
|
||||
OGGFLAC = 6;
|
||||
WAVPACK = 3;
|
||||
OGGFLAC = 4;
|
||||
OGGVORBIS = 5;
|
||||
OGGOPUS = 6;
|
||||
OGGSPEEX = 7;
|
||||
OGGVORBIS = 8;
|
||||
AIFF = 9;
|
||||
WAV = 10;
|
||||
TRUEAUDIO = 11;
|
||||
CDDA = 12;
|
||||
OGGOPUS = 13;
|
||||
//STREAM = 99;
|
||||
MPEG = 8;
|
||||
MP4 = 9;
|
||||
ASF = 10;
|
||||
AIFF = 11;
|
||||
MPC = 12;
|
||||
TRUEAUDIO = 13;
|
||||
CDDA = 90;
|
||||
STREAM = 91;
|
||||
}
|
||||
|
||||
optional bool valid = 1;
|
||||
|
@ -365,17 +365,18 @@ QString Song::JoinSpec(const QString &table) {
|
||||
QString Song::TextForFiletype(FileType type) {
|
||||
|
||||
switch (type) {
|
||||
case Song::Type_Asf: return QObject::tr("Windows Media audio");
|
||||
case Song::Type_Wav: return QObject::tr("Wav");
|
||||
case Song::Type_Flac: return QObject::tr("Flac");
|
||||
case Song::Type_Mp4: return QObject::tr("MP4 AAC");
|
||||
case Song::Type_Mpc: return QObject::tr("MPC");
|
||||
case Song::Type_Mpeg: return QObject::tr("MP3");
|
||||
case Song::Type_WavPack: return QObject::tr("WavPack");
|
||||
case Song::Type_OggFlac: return QObject::tr("Ogg Flac");
|
||||
case Song::Type_OggSpeex: return QObject::tr("Ogg Speex");
|
||||
case Song::Type_OggVorbis: return QObject::tr("Ogg Vorbis");
|
||||
case Song::Type_OggOpus: return QObject::tr("Ogg Opus");
|
||||
case Song::Type_OggSpeex: return QObject::tr("Ogg Speex");
|
||||
case Song::Type_Mpeg: return QObject::tr("MP3");
|
||||
case Song::Type_Mp4: return QObject::tr("MP4 AAC");
|
||||
case Song::Type_Asf: return QObject::tr("Windows Media audio");
|
||||
case Song::Type_Aiff: return QObject::tr("AIFF");
|
||||
case Song::Type_Wav: return QObject::tr("Wav");
|
||||
case Song::Type_Mpc: return QObject::tr("MPC");
|
||||
case Song::Type_TrueAudio: return QObject::tr("TrueAudio");
|
||||
case Song::Type_Cdda: return QObject::tr("CDDA");
|
||||
|
||||
@ -389,10 +390,11 @@ QString Song::TextForFiletype(FileType type) {
|
||||
|
||||
bool Song::IsFileLossless() const {
|
||||
switch (filetype()) {
|
||||
case Song::Type_Aiff:
|
||||
case Song::Type_Wav:
|
||||
case Song::Type_Flac:
|
||||
case Song::Type_OggFlac:
|
||||
case Song::Type_Wav:
|
||||
case Song::Type_WavPack:
|
||||
case Song::Type_Aiff:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -692,10 +694,21 @@ void Song::InitFromFilePartial(const QString &filename) {
|
||||
QFileInfo info(filename);
|
||||
d->basefilename_ = info.fileName();
|
||||
QString suffix = info.suffix().toLower();
|
||||
if (suffix == "mp3" || suffix == "ogg" || suffix == "flac" ||
|
||||
suffix == "mpc" || suffix == "m4a" || suffix == "aac" ||
|
||||
suffix == "wma" || suffix == "mp4" || suffix == "spx" ||
|
||||
suffix == "wav" || suffix == "opus" || suffix == "m4b") {
|
||||
if (suffix == "wav" ||
|
||||
suffix == "flac" ||
|
||||
suffix == "ogg" ||
|
||||
suffix == "oga" ||
|
||||
suffix == "wv" ||
|
||||
suffix == "aac" ||
|
||||
suffix == "m4a" ||
|
||||
suffix == "m4b" ||
|
||||
suffix == "mp4" ||
|
||||
suffix == "wma" ||
|
||||
suffix == "mp3" ||
|
||||
suffix == "mpc" ||
|
||||
suffix == "tta" ||
|
||||
suffix == "spx" ||
|
||||
suffix == "opus") {
|
||||
d->valid_ = true;
|
||||
}
|
||||
else {
|
||||
|
@ -95,19 +95,21 @@ class Song {
|
||||
// If a new lossless file is added, also add it to IsFileLossless().
|
||||
enum FileType {
|
||||
Type_Unknown = 0,
|
||||
Type_Asf = 1,
|
||||
Type_Wav = 1,
|
||||
Type_Flac = 2,
|
||||
Type_Mp4 = 3,
|
||||
Type_Mpc = 4,
|
||||
Type_Mpeg = 5,
|
||||
Type_OggFlac = 6,
|
||||
Type_WavPack = 3,
|
||||
Type_OggFlac = 4,
|
||||
Type_OggVorbis = 5,
|
||||
Type_OggOpus = 6,
|
||||
Type_OggSpeex = 7,
|
||||
Type_OggVorbis = 8,
|
||||
Type_Aiff = 9,
|
||||
Type_Wav = 10,
|
||||
Type_TrueAudio = 11,
|
||||
Type_Cdda = 12,
|
||||
Type_OggOpus = 13,
|
||||
Type_Mpeg = 8,
|
||||
Type_Mp4 = 9,
|
||||
Type_Asf = 10,
|
||||
Type_Aiff = 11,
|
||||
Type_Mpc = 12,
|
||||
Type_TrueAudio = 13,
|
||||
Type_Cdda = 90,
|
||||
Type_Stream = 91,
|
||||
};
|
||||
|
||||
static QString TextForFiletype(FileType type);
|
||||
|
@ -229,10 +229,8 @@ void SongLoader::LoadLocalAsync(const QString &filename) {
|
||||
parser = playlist_parser_->ParserForExtension(QFileInfo(filename).suffix().toLower());
|
||||
}
|
||||
|
||||
if (parser) {
|
||||
if (parser) { // It's a playlist!
|
||||
qLog(Debug) << "Parsing using" << parser->name();
|
||||
|
||||
// It's a playlist!
|
||||
LoadPlaylist(parser, filename);
|
||||
return;
|
||||
}
|
||||
@ -244,8 +242,7 @@ void SongLoader::LoadLocalAsync(const QString &filename) {
|
||||
QFile cue(matching_cue);
|
||||
cue.open(QIODevice::ReadOnly);
|
||||
|
||||
SongList song_list = cue_parser_->Load(&cue, matching_cue,
|
||||
QDir(filename.section('/', 0, -2)));
|
||||
SongList song_list = cue_parser_->Load(&cue, matching_cue, QDir(filename.section('/', 0, -2)));
|
||||
for (Song song: song_list){
|
||||
if (song.is_valid()) songs_ << song;
|
||||
}
|
||||
|
@ -769,7 +769,8 @@ GstElement *GstEngine::CreateElement(const QString &factoryName, GstElement *bin
|
||||
if (!element) {
|
||||
if (showerror)
|
||||
emit Error(QString("GStreamer could not create the element: %1. Please make sure that you have installed all necessary GStreamer plugins").arg(factoryName));
|
||||
if (fatal) gst_object_unref(GST_OBJECT(bin));
|
||||
else qLog(Error) << "GStreamer could not create the element:" << factoryName;
|
||||
//if (fatal) gst_object_unref(GST_OBJECT(bin));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -247,8 +247,8 @@ bool GstEnginePipeline::InitAudioBin() {
|
||||
GstElement *convert_sink = tee;
|
||||
|
||||
if (rg_enabled_) {
|
||||
rgvolume_ = engine_->CreateElement("rgvolume", audiobin_);
|
||||
rglimiter_ = engine_->CreateElement("rglimiter", audiobin_);
|
||||
rgvolume_ = engine_->CreateElement("rgvolume", audiobin_, false, true);
|
||||
rglimiter_ = engine_->CreateElement("rglimiter", audiobin_, false, true);
|
||||
audioconvert2_ = engine_->CreateElement("audioconvert", audiobin_);
|
||||
if (rgvolume_ && rglimiter_ && audioconvert2_) {
|
||||
event_probe = audioconvert2_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user