Mercurial > audlegacy-plugins
comparison src/modplug/modplugbmp.cxx @ 1601:be8babbd772c
Convert strings to UTF-8 using str_to_utf8(). This solution is not
"Correct(tm)", but since the encoding used in module files cannot be known,
it's the best bet.
| author | Matti Hamalainen <ccr@tnsp.org> |
|---|---|
| date | Wed, 05 Sep 2007 11:54:05 +0300 |
| parents | 49fe2225d236 |
| children | d6d8e3cd23c5 |
comparison
equal
deleted
inserted
replaced
| 1600:49fe2225d236 | 1601:be8babbd772c |
|---|---|
| 17 #include "audacious/configdb.h" | 17 #include "audacious/configdb.h" |
| 18 #include "audacious/output.h" | 18 #include "audacious/output.h" |
| 19 #include "audacious/tuple.h" | 19 #include "audacious/tuple.h" |
| 20 #include "audacious/tuple_formatter.h" | 20 #include "audacious/tuple_formatter.h" |
| 21 #include "audacious/vfs.h" | 21 #include "audacious/vfs.h" |
| 22 #include "audacious/strings.h" | |
| 22 } | 23 } |
| 23 | 24 |
| 24 static char* format_and_free_ti( Tuple* ti, int* length ) | 25 static char* format_and_free_ti( Tuple* ti, int* length ) |
| 25 { | 26 { |
| 26 char* result = tuple_formatter_make_title_string(ti, get_gentitle_format()); | 27 char* result = tuple_formatter_make_title_string(ti, get_gentitle_format()); |
| 503 | 504 |
| 504 Tuple* ModplugXMMS::GetSongTuple(const string& aFilename) | 505 Tuple* ModplugXMMS::GetSongTuple(const string& aFilename) |
| 505 { | 506 { |
| 506 CSoundFile* lSoundFile; | 507 CSoundFile* lSoundFile; |
| 507 Archive* lArchive; | 508 Archive* lArchive; |
| 508 char* tmps; | 509 gchar* tmps; |
| 509 | 510 |
| 510 //open and mmap the file | 511 //open and mmap the file |
| 511 lArchive = OpenArchive(aFilename); | 512 lArchive = OpenArchive(aFilename); |
| 512 if(lArchive->Size() == 0) | 513 if(lArchive->Size() == 0) |
| 513 { | 514 { |
| 544 case MOD_TYPE_PSM: tmps = "Protracker Studio Module"; break; | 545 case MOD_TYPE_PSM: tmps = "Protracker Studio Module"; break; |
| 545 default: tmps = "ModPlug unknown"; break; | 546 default: tmps = "ModPlug unknown"; break; |
| 546 } | 547 } |
| 547 tuple_associate_string(ti, "codec", tmps); | 548 tuple_associate_string(ti, "codec", tmps); |
| 548 tuple_associate_string(ti, "quality", "sequenced"); | 549 tuple_associate_string(ti, "quality", "sequenced"); |
| 549 tuple_associate_string(ti, "title", lSoundFile->GetTitle()); | |
| 550 tuple_associate_int(ti, "length", lSoundFile->GetSongTime() * 1000); | 550 tuple_associate_int(ti, "length", lSoundFile->GetSongTime() * 1000); |
| 551 | |
| 552 /* NOTICE! FIXME? This is actually incorrect. We _cannot_ know what charset | |
| 553 * an arbitrary module file uses .. typically it is some DOS CP-variant, | |
| 554 * except for true Amiga modules. | |
| 555 */ | |
| 556 tmps = str_to_utf8(lSoundFile->GetTitle()); | |
| 557 tuple_associate_string(ti, "title", tmps); | |
| 558 g_free(tmps); | |
| 559 | |
| 551 | 560 |
| 552 //unload the file | 561 //unload the file |
| 553 lSoundFile->Destroy(); | 562 lSoundFile->Destroy(); |
| 554 delete lSoundFile; | 563 delete lSoundFile; |
| 555 delete lArchive; | 564 delete lArchive; |
