Skip to content

Commit

Permalink
FIX 1390415: Parse Cover for opus files
Browse files Browse the repository at this point in the history
This adds cover parsing for opus files and a test as well.
  • Loading branch information
Max Linke committed Nov 11, 2014
1 parent 9a991b2 commit 1f055bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/soundsourceopus.cpp
Expand Up @@ -266,3 +266,13 @@ QList<QString> SoundSourceOpus::supportedFileExtensions() {
list.push_back("opus");
return list;
}

QImage SoundSourceOpus::parseCoverArt() {
#if (TAGLIB_MAJOR_VERSION >= 1) && (TAGLIB_MINOR_VERSION >= 9)
setType("ogg");
TagLib::Ogg::Opus::File f(m_qFilename.toLocal8Bit().constData());
return getCoverInXiphComment(f.tag());
#else
return QImage();
#endif
}
7 changes: 7 additions & 0 deletions src/test/coverartutils_test.cpp
Expand Up @@ -65,6 +65,13 @@ TEST_F(CoverArtUtilTest, extractEmbeddedCover) {
cover = CoverArtUtils::extractEmbeddedCover(kTestPath % "cover-test.wav",
pToken);
EXPECT_TRUE(!cover.isNull());

#ifdef __OPUS__
// opus
cover = CoverArtUtils::extractEmbeddedCover(kTestPath % "cover-test.opus",
pToken);
EXPECT_TRUE(!cover.isNull());
#endif
}

TEST_F(CoverArtUtilTest, searchImage) {
Expand Down
Binary file added src/test/id3-test-data/cover-test.opus
Binary file not shown.

0 comments on commit 1f055bf

Please sign in to comment.