From bc2d0ecef1f89db7d4a5fc5de970d69d7ccae136 Mon Sep 17 00:00:00 2001 From: Zhong Yang Date: Tue, 18 Aug 2020 13:45:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=93=E8=BE=91=E5=B0=81?= =?UTF-8?q?=E9=9D=A2=E8=AF=A6=E6=83=85=E4=B8=ADm4a=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E4=B8=93=E8=BE=91=E5=B0=81=E9=9D=A2=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MusicPlayer2/AudioTag.cpp | 6 ++++-- MusicPlayer2/AudioTag.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/MusicPlayer2/AudioTag.cpp b/MusicPlayer2/AudioTag.cpp index b0388154..5fa05ba5 100644 --- a/MusicPlayer2/AudioTag.cpp +++ b/MusicPlayer2/AudioTag.cpp @@ -77,6 +77,7 @@ void CAudioTag::GetAudioTag(bool id3v2_first) wstring CAudioTag::GetAlbumCover(int & image_type, wchar_t* file_name) { + image_type = -1; string image_contents; if (m_type == AudioType::AU_FLAC) { @@ -99,7 +100,7 @@ wstring CAudioTag::GetAlbumCover(int & image_type, wchar_t* file_name) else { if (m_type == AU_MP4) - image_contents = ForceGetAlbumCover(); + image_contents = ForceGetAlbumCover(image_type); } } @@ -746,7 +747,7 @@ string CAudioTag::FindID3V2AlbumCover(const string & tag_content, int & image_ty return string(); } -string CAudioTag::ForceGetAlbumCover() +string CAudioTag::ForceGetAlbumCover(int& image_type) { ifstream file{ m_file_path, std::ios::binary }; size_t size; @@ -772,6 +773,7 @@ string CAudioTag::ForceGetAlbumCover() { size_t image_size = end_index - image_index + jpg_tail.size(); image_contents = contents_buff.substr(image_index, image_size); + image_type = 0; } } return image_contents; diff --git a/MusicPlayer2/AudioTag.h b/MusicPlayer2/AudioTag.h index cfbad94d..d1d5097e 100644 --- a/MusicPlayer2/AudioTag.h +++ b/MusicPlayer2/AudioTag.h @@ -79,6 +79,6 @@ private: static string FindID3V2AlbumCover(const string& tag_content, int& image_type); //在不知道如何解析某种音频格式的专辑封面时强行查找专辑封面 - string ForceGetAlbumCover(); + string ForceGetAlbumCover(int& image_type); };