diff --git a/src/Config.h b/src/Config.h index 0aac9052..164cae4c 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 0 -#define VER_LAMEXP_BUILD 322 +#define VER_LAMEXP_BUILD 323 #define VER_LAMEXP_SUFFIX RC-3 /* diff --git a/src/Encoder_AAC.cpp b/src/Encoder_AAC.cpp index 7ad1f96e..3843129e 100644 --- a/src/Encoder_AAC.cpp +++ b/src/Encoder_AAC.cpp @@ -29,7 +29,6 @@ #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) -#define IS_UNICODE(STR) (qstricmp(STR.toUtf8().constData(), QString::fromLocal8Bit(STR.toLocal8Bit()).toUtf8().constData())) AACEncoder::AACEncoder(void) : diff --git a/src/Encoder_Abstract.cpp b/src/Encoder_Abstract.cpp index c092e73b..e7e0120a 100644 --- a/src/Encoder_Abstract.cpp +++ b/src/Encoder_Abstract.cpp @@ -21,6 +21,7 @@ #include "Encoder_Abstract.h" +#include "Global.h" #include AbstractEncoder::AbstractEncoder(void) @@ -49,3 +50,12 @@ bool AbstractEncoder::requiresDownmix(void) { return false; } + +/* + * Helper functions + */ +bool AbstractEncoder::isUnicode(const QString &original) +{ + QString asLatin1 = QString::fromLatin1(original.toLatin1().constData()); + return (wcscmp(QWCHAR(original), QWCHAR(asLatin1)) != 0); +} diff --git a/src/Encoder_Abstract.h b/src/Encoder_Abstract.h index 924701c3..cb9fe6ec 100644 --- a/src/Encoder_Abstract.h +++ b/src/Encoder_Abstract.h @@ -51,4 +51,7 @@ protected: int m_configBitrate; int m_configRCMode; QString m_configCustomParams; + + //Helper functions + bool isUnicode(const QString &text); }; diff --git a/src/Encoder_FLAC.cpp b/src/Encoder_FLAC.cpp index a68ff1f4..c9a9cdaf 100644 --- a/src/Encoder_FLAC.cpp +++ b/src/Encoder_FLAC.cpp @@ -29,7 +29,6 @@ #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) -#define IS_UNICODE(STR) (qstricmp(STR.toUtf8().constData(), QString::fromLocal8Bit(STR.toLocal8Bit()).toUtf8().constData())) FLACEncoder::FLACEncoder(void) : diff --git a/src/Encoder_MP3.cpp b/src/Encoder_MP3.cpp index 94260205..81391ac2 100644 --- a/src/Encoder_MP3.cpp +++ b/src/Encoder_MP3.cpp @@ -28,8 +28,6 @@ #include #include -#define IS_UNICODE(STR) (qstricmp(STR.toUtf8().constData(), QString::fromLocal8Bit(STR.toLocal8Bit()).toUtf8().constData())) - static const int g_lameAgorithmQualityLUT[] = {9, 7, 5, 2, 0, INT_MAX}; MP3Encoder::MP3Encoder(void) @@ -110,11 +108,11 @@ bool MP3Encoder::encode(const QString &sourceFile, const AudioFileModel &metaInf break; } - if(!metaInfo.fileName().isEmpty()) args << (IS_UNICODE(metaInfo.fileName()) ? "--uTitle" : "--lTitle") << metaInfo.fileName(); - if(!metaInfo.fileArtist().isEmpty()) args << (IS_UNICODE(metaInfo.fileArtist()) ? "--uArtist" : "--lArtist") << metaInfo.fileArtist(); - if(!metaInfo.fileAlbum().isEmpty()) args << (IS_UNICODE(metaInfo.fileAlbum()) ? "--uAlbum" : "--lAlbum") << metaInfo.fileAlbum(); - if(!metaInfo.fileGenre().isEmpty()) args << (IS_UNICODE(metaInfo.fileGenre()) ? "--uGenre" : "--lGenre") << metaInfo.fileGenre(); - if(!metaInfo.fileComment().isEmpty()) args << (IS_UNICODE(metaInfo.fileComment()) ? "--uComment" : "--lComment") << metaInfo.fileComment(); + if(!metaInfo.fileName().isEmpty()) args << (isUnicode(metaInfo.fileName()) ? "--uTitle" : "--lTitle") << metaInfo.fileName(); + if(!metaInfo.fileArtist().isEmpty()) args << (isUnicode(metaInfo.fileArtist()) ? "--uArtist" : "--lArtist") << metaInfo.fileArtist(); + if(!metaInfo.fileAlbum().isEmpty()) args << (isUnicode(metaInfo.fileAlbum()) ? "--uAlbum" : "--lAlbum") << metaInfo.fileAlbum(); + if(!metaInfo.fileGenre().isEmpty()) args << (isUnicode(metaInfo.fileGenre()) ? "--uGenre" : "--lGenre") << metaInfo.fileGenre(); + if(!metaInfo.fileComment().isEmpty()) args << (isUnicode(metaInfo.fileComment()) ? "--uComment" : "--lComment") << metaInfo.fileComment(); if(metaInfo.fileYear()) args << "--ty" << QString::number(metaInfo.fileYear()); if(metaInfo.filePosition()) args << "--tn" << QString::number(metaInfo.filePosition()); diff --git a/src/Encoder_Vorbis.cpp b/src/Encoder_Vorbis.cpp index 388a9faa..56ba5ccd 100644 --- a/src/Encoder_Vorbis.cpp +++ b/src/Encoder_Vorbis.cpp @@ -29,7 +29,6 @@ #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) -#define IS_UNICODE(STR) (qstricmp(STR.toUtf8().constData(), QString::fromLocal8Bit(STR.toLocal8Bit()).toUtf8().constData())) VorbisEncoder::VorbisEncoder(void) : diff --git a/src/Encoder_Wave.cpp b/src/Encoder_Wave.cpp index a30934c7..8c771143 100644 --- a/src/Encoder_Wave.cpp +++ b/src/Encoder_Wave.cpp @@ -29,7 +29,6 @@ #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) -#define IS_UNICODE(STR) (qstricmp(STR.toUtf8().constData(), QString::fromLocal8Bit(STR.toLocal8Bit()).toUtf8().constData())) #define FIX_SEPARATORS(STR) for(int i = 0; STR[i]; i++) { if(STR[i] == L'/') STR[i] = L'\\'; } WaveEncoder::WaveEncoder(void)