[mythtv] [patch][i18n] MythMusic fix unicode handling for metadata
Hirobumi Shimada
shimada at systemcreate-inc.com
Tue Feb 8 01:50:58 UTC 2005
Hi
metaioid3v2.cpp.patch
The encode specification of the comment was revived. deleted by
previous commit.
metaioflacvorbiscomment.cpp.patch
The file opening processing is corrected.
metaiomp4.cpp.patch
change QString::ascii to local8Bit and utf8, but not tested, feel free
ignore this part.
Thanks
Hiro
-------------- next part --------------
Index: mythmusic/metaioid3v2.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythmusic/mythmusic/metaioid3v2.cpp,v
retrieving revision 1.4
diff -u -r1.4 metaioid3v2.cpp
--- mythmusic/metaioid3v2.cpp 6 Feb 2005 18:27:45 -0000 1.4
+++ mythmusic/metaioid3v2.cpp 8 Feb 2005 01:35:44 -0000
@@ -575,6 +575,13 @@
if (NULL == p_frame)
return false;
+ if (id3_field_settextencoding(&p_frame->fields[0],
+ ID3_FIELD_TEXTENCODING_UTF_16) != 0)
+ {
+ id3_frame_delete(p_frame);
+ return false;
+ }
+
// Write a description in field 1 if needs be.
if (!desc.isEmpty())
{
-------------- next part --------------
Index: mythmusic/metaioflacvorbiscomment.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythmusic/mythmusic/metaioflacvorbiscomment.cpp,v
retrieving revision 1.3
diff -u -r1.3 metaioflacvorbiscomment.cpp
--- mythmusic/metaioflacvorbiscomment.cpp 6 Feb 2005 18:27:45 -0000 1.3
+++ mythmusic/metaioflacvorbiscomment.cpp 8 Feb 2005 01:35:44 -0000
@@ -39,7 +39,7 @@
FLAC__Metadata_Chain *chain = FLAC__metadata_chain_new();
if (!FLAC__metadata_chain_read(chain, mdata->Filename().local8Bit())
- || !FLAC__metadata_chain_read(chain, mdata->Filename().ascii()))
+ && !FLAC__metadata_chain_read(chain, mdata->Filename().ascii()))
{
FLAC__metadata_chain_delete(chain);
return false;
@@ -140,7 +140,7 @@
FLAC__Metadata_Chain *chain = FLAC__metadata_chain_new();
if (!FLAC__metadata_chain_read(chain, filename.local8Bit())
- || !FLAC__metadata_chain_read(chain, filename.ascii()))
+ && !FLAC__metadata_chain_read(chain, filename.ascii()))
{
FLAC__metadata_chain_delete(chain);
return NULL;
@@ -219,7 +219,7 @@
int MetaIOFLACVorbisComment::getTrackLength(QString filename)
{
FLAC__Metadata_Chain *chain = FLAC__metadata_chain_new();
- if (!FLAC__metadata_chain_read(chain, filename.local8Bit()) ||
+ if (!FLAC__metadata_chain_read(chain, filename.local8Bit()) &&
!FLAC__metadata_chain_read(chain, filename.ascii()))
{
FLAC__metadata_chain_delete(chain);
-------------- next part --------------
Index: mythmusic/metaiomp4.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythmusic/mythmusic/metaiomp4.cpp,v
retrieving revision 1.2
diff -u -r1.2 metaiomp4.cpp
--- mythmusic/metaiomp4.cpp 7 Feb 2005 19:52:23 -0000 1.2
+++ mythmusic/metaiomp4.cpp 8 Feb 2005 01:35:44 -0000
@@ -72,7 +72,7 @@
mp4callback_data_t callback_data;
- callback_data.fd = open(mdata->Filename().ascii(), O_RDWR);
+ callback_data.fd = open(mdata->Filename().local8Bit(), O_RDWR);
if (callback_data.fd < 0) {
return false;
}
@@ -131,16 +131,16 @@
}
mp4ff_mdata->tags[0].item = "artist";
- mp4ff_mdata->tags[0].value = (char*)mdata->Artist().ascii();
+ mp4ff_mdata->tags[0].value = mdata->Artist().utf8().data();
mp4ff_mdata->tags[1].item = "album";
- mp4ff_mdata->tags[1].value = (char*)mdata->Album().ascii();
+ mp4ff_mdata->tags[1].value = mdata->Album().utf8().data();
mp4ff_mdata->tags[2].item = "title";
- mp4ff_mdata->tags[2].value = (char*)mdata->Title().ascii();
+ mp4ff_mdata->tags[2].value = mdata->Title().utf8().data();
mp4ff_mdata->tags[3].item = "genre";
- mp4ff_mdata->tags[3].value = (char*)mdata->Genre().ascii();
+ mp4ff_mdata->tags[3].value = mdata->Genre().utf8().data();
mp4ff_mdata->tags[4].item = "date";
mp4ff_mdata->tags[4].value = (char*)malloc(128);
@@ -183,7 +183,7 @@
mp4callback_data_t callback_data;
callback_data.fd = 0;
- callback_data.file = fopen(filename.ascii(), "r");
+ callback_data.file = fopen(filename.local8Bit(), "r");
if (!callback_data.file)
{
return NULL;
@@ -367,7 +367,7 @@
mp4callback_data_t callback_data;
callback_data.fd = 0;
- callback_data.file = fopen(filename.ascii(), "r");
+ callback_data.file = fopen(filename.local8Bit(), "r");
if (!callback_data.file)
{
return 0;
More information about the mythtv-dev
mailing list