Implemented a better method to check whether a string should be encoded as Unicode: We should check whether the string can be represented with the Latin-1 Codepage rather than with the user's "local" Codepage.
This commit is contained in:
parent
c8b16ace28
commit
f54fd17b3c
@ -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
|
||||
|
||||
/*
|
||||
|
@ -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)
|
||||
:
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "Encoder_Abstract.h"
|
||||
|
||||
#include "Global.h"
|
||||
#include <Windows.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -51,4 +51,7 @@ protected:
|
||||
int m_configBitrate;
|
||||
int m_configRCMode;
|
||||
QString m_configCustomParams;
|
||||
|
||||
//Helper functions
|
||||
bool isUnicode(const QString &text);
|
||||
};
|
||||
|
@ -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)
|
||||
:
|
||||
|
@ -28,8 +28,6 @@
|
||||
#include <QDir>
|
||||
#include <limits.h>
|
||||
|
||||
#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());
|
||||
|
||||
|
@ -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)
|
||||
:
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user