From 87db6ef071b0a0bb7788c3be7d631e37fd159704 Mon Sep 17 00:00:00 2001 From: martii Date: Sun, 20 Oct 2013 12:29:40 +0200 Subject: [PATCH] driver/audiodec: metadata fix Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/5a7b190790aa8923932f7a1ae328226a53469f78 Author: martii Date: 2013-10-20 (Sun, 20 Oct 2013) --- src/driver/audiodec/basedec.cpp | 3 +++ src/driver/audiodec/ffmpegdec.cpp | 15 +++++++++------ src/driver/audioplay.cpp | 23 +++++++++++++++-------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/driver/audiodec/basedec.cpp b/src/driver/audiodec/basedec.cpp index 986574799..0d6067e41 100644 --- a/src/driver/audiodec/basedec.cpp +++ b/src/driver/audiodec/basedec.cpp @@ -147,6 +147,9 @@ void CBaseDec::ClearMetaData() bool CBaseDec::GetMetaDataBase(CAudiofile* const in, const bool nice) { + if (in->FileType == CFile::STREAM_AUDIO) + return true; + if (LookupMetaData(in)) return true; diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index e6522a338..c1f2e57b8 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -431,14 +431,17 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CFile::FileType ft, CAudioMetaData* m) total_time = 8 * m->filesize / bitrate; meta_data_valid = true; + m->changed = true; + } + if (!is_stream) { + m->title = title; + m->artist = artist; + m->date = date; + m->album = album; + m->genre = genre; + m->total_time = total_time; } - m->title = title; - m->artist = artist; - m->date = date; - m->album = album; - m->genre = genre; m->type_info = type_info; - m->total_time = total_time; m->bitrate = bitrate; m->samplerate = samplerate; diff --git a/src/driver/audioplay.cpp b/src/driver/audioplay.cpp index 5dea17d17..9741becf2 100644 --- a/src/driver/audioplay.cpp +++ b/src/driver/audioplay.cpp @@ -42,6 +42,7 @@ #include #include #include +#include // UTF8 void CAudioPlayer::stop() { @@ -169,24 +170,30 @@ void CAudioPlayer::sc_callback(void *arg) { bool changed=false; CSTATE *stat = (CSTATE*)arg; - if(m_Audiofile.MetaData.artist != stat->artist) + + const std::string artist = convertLatin1UTF8(stat->artist); + const std::string title = convertLatin1UTF8(stat->title); + const std::string station = convertLatin1UTF8(stat->station); + const std::string genre = convertLatin1UTF8(stat->genre); + + if(m_Audiofile.MetaData.artist != artist) { - m_Audiofile.MetaData.artist = stat->artist; + m_Audiofile.MetaData.artist = artist; changed=true; } - if (m_Audiofile.MetaData.title != stat->title) + if (m_Audiofile.MetaData.title != title) { - m_Audiofile.MetaData.title = stat->title; + m_Audiofile.MetaData.title = title; changed=true; } - if (m_Audiofile.MetaData.sc_station != stat->station) + if (m_Audiofile.MetaData.sc_station != station) { - m_Audiofile.MetaData.sc_station = stat->station; + m_Audiofile.MetaData.sc_station = station; changed=true; } - if (m_Audiofile.MetaData.genre != stat->genre) + if (m_Audiofile.MetaData.genre != genre) { - m_Audiofile.MetaData.genre = stat->genre; + m_Audiofile.MetaData.genre = genre; changed=true; } if(changed)