Commit abd5c3ff authored by Martin Brodbeck's avatar Martin Brodbeck Committed by Matěj Laitl
Browse files

Add support for Opus files if compiled against TagLib > 1.8

FEATURES:
 * Added support for files in Opus codec if Amarok is compiled against recent
   enough TagLib (post 1.8). patch by Martin Brodbeck.

FEATURE: 312905
FIXED-IN: 2.8
REVIEW: 108542
DIGEST: Amarok now supports Opus codec with recent TagLib
parent 28e35821
......@@ -49,6 +49,9 @@ if(TAGLIB_FOUND)
int main() { char *s; Mod::Tag tag; Mod::File modfile(s); S3M::File s3mfile(s);
IT::File itfile(s); XM::File xmfile(s); return 0; }" TAGLIB_MOD_FOUND)
check_cxx_source_compiles("#include <opusfile.h>
int main() { char *s; TagLib::Ogg::Opus::File opusfile(s); return 0;}" TAGLIB_OPUS_FOUND)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
......@@ -218,6 +221,7 @@ if( WITH_PLAYER )
macro_log_feature( TAGLIB_FOUND "taglib" "Support for Audio metadata." "http://developer.kde.org/~wheeler/taglib.html" FALSE "" "STRONGLY RECOMMENDED" )
# following line is here (and not near TAGLIB_MOD_FOUND) because there may be no MacroLogFeature without kdelibs
macro_log_feature( TAGLIB_MOD_FOUND "taglib" "Additional support for Audio metadata of mod, s3m, it and xm files." "http://developer.kde.org/~wheeler/taglib.html" FALSE "1.8" "" )
macro_log_feature( TAGLIB_OPUS_FOUND "taglib" "Additional support for Audio metadata of opus files." "http://developer.kde.org/~wheeler/taglib.html" FALSE "1.9" "" )
macro_display_feature_log()
......
......@@ -4,6 +4,8 @@ Amarok ChangeLog
VERSION 2.8-Beta 1
FEATURES:
* Added support for files in Opus codec if Amarok is compiled against recent
enough TagLib (post 1.8), patch by Martin Brodbeck. (BR 312905)
* Added Ctrl+H shortcut to randomize playlist, patch by Harsh Gupta. (BR 208061)
CHANGES:
......
......@@ -48,6 +48,7 @@ Required
* TagLib 1.7 (or newer)
(Metadata tagging library)
When compiling against 1.8 more file types are supported (MOD, IT, S3M, XM).
When compiling against 1.9 opus file type is supported.
http://developer.kde.org/~wheeler/taglib.html
https://github.com/taglib/taglib
......
......@@ -45,7 +45,8 @@ QStringList FileTypeSupport::s_fileTypeStrings = QStringList()
<< QLatin1String( "s3m" )
<< QLatin1String( "it" )
<< QLatin1String( "xm" )
<< QLatin1String( "spx" );
<< QLatin1String( "spx" )
<< QLatin1String( "opus" );
QString
FileTypeSupport::toString( Amarok::FileType ft )
......
......@@ -44,7 +44,8 @@ namespace Amarok
S3M = 14,
IT = 15,
XM = 16,
Speex = 17
Speex = 17,
Opus = 18
};
class FileTypeSupport
......
......@@ -36,6 +36,9 @@
#include <mpcfile.h>
#include <mpegfile.h>
#include <oggfile.h>
#ifdef TAGLIB_OPUS_FOUND
#include <opusfile.h>
#endif
#include <oggflacfile.h>
#include <speexfile.h>
#include <trueaudiofile.h>
......@@ -85,6 +88,13 @@ TagLib::File *Meta::Tag::FileTypeResolver::createFile(TagLib::FileName fileName,
{
result = new TagLibExtras::RealMedia::File(fileName, readProperties, propertiesStyle);
}
#endif
#ifdef TAGLIB_OPUS_FOUND
else if( mimetype->is( QLatin1String("audio/opus") )
|| mimetype->is( QLatin1String("audio/x-opus+ogg") ) )
{
result = new TagLib::Ogg::Opus::File(fileName, readProperties, propertiesStyle);
}
#endif
else if( mimetype->is( QLatin1String("audio/vorbis") )
|| mimetype->is( QLatin1String("audio/x-vorbis+ogg") ) )
......@@ -162,6 +172,13 @@ TagLib::File *Meta::Tag::FileTypeResolver::createFile(TagLib::FileName fileName,
{
result = new TagLib::ASF::File(fileName, readProperties, propertiesStyle);
}
#ifdef TAGLIB_OPUS_FOUND
// this is currently needed because shared-mime-info database doesn't have opus entry (2013-01)
else if( suffix == QLatin1String("opus") )
{
result = new TagLib::Ogg::Opus::File(fileName, readProperties, propertiesStyle);
}
#endif
#ifndef Q_WS_WIN
if( !result )
......
......@@ -12,6 +12,9 @@
/* have module file format support in TagLib */
#cmakedefine TAGLIB_MOD_FOUND 1
/* have opus file format support in TagLib */
#cmakedefine TAGLIB_OPUS_FOUND 1
/* have QtCrypto the Qt crypto architecture */
#cmakedefine QCA2_FOUND 1
......
......@@ -29,6 +29,9 @@
#include <mpcfile.h>
#include <mpegfile.h>
#include <oggfile.h>
#ifdef TAGLIB_OPUS_FOUND
#include <opusfile.h>
#endif
#include <oggflacfile.h>
#include <rifffile.h>
#include <speexfile.h>
......@@ -284,6 +287,13 @@ Meta::Tag::selectHelper( const TagLib::FileRef fileref, bool forceCreation )
if( file->tag() )
tagHelper = new VorbisCommentTagHelper( fileref.tag(), file->tag(), Amarok::Speex );
}
#ifdef TAGLIB_OPUS_FOUND
else if( TagLib::Ogg::Opus::File *file = dynamic_cast< TagLib::Ogg::Opus::File * >( fileref.file() ) )
{
if( file->tag() )
tagHelper = new VorbisCommentTagHelper( fileref.tag(), file->tag(), Amarok::Opus );
}
#endif
else if( TagLib::FLAC::File *file = dynamic_cast< TagLib::FLAC::File * >( fileref.file() ) )
{
if( file->xiphComment() )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment