Changeset 253


Ignore:
Timestamp:
03/29/07 13:16:59 (17 years ago)
Author:
r2d
Message:
  • tags in accentuated files can now be read
  • tags are converted from utf-8 to wide char for display
File:
1 edited

Legend:

Unmodified
Added
Removed
  • winamp-musepack/trunk/mpc_player.cpp

    r251 r253  
    3030
    3131#include <taglib/tag.h>
     32#include <taglib/tfile.h>
    3233
    3334
     
    188189        if (length_in_ms) *length_in_ms = getLength();
    189190        if (title) {
    190                 if(tag_file == 0)
     191                if(tag_file == 0) {
    191192                        tag_file = new TagLib::FileRef(lastfn, false);
     193                        (tag_file->file())->useWinAnsiCP(true);
     194                }
    192195
    193196                if (tag_file->isNull() || !tag_file->tag()) {
     
    315318        tmp << "\nSamples : " << si.samples;
    316319        tmp << "\nTrack Peak : " << si.peak_title / 256. << " dB";
    317         tmp << "\nTrack Gain : " << si.gain_title / 256. << " dB";
     320        tmp << "\nTrack Level : " << si.gain_title / 256. << " dB";
    318321        tmp << "\nAlbum Peak : " << si.peak_album / 256. << " dB";
    319         tmp << "\nAlbum Gain : " << si.gain_album / 256. << " dB";
     322        tmp << "\nAlbum Level : " << si.gain_album / 256. << " dB";
    320323
    321324        SetDlgItemText(hDlg, IDC_STREAM_INFO, tmp.str().c_str());
    322325
    323         if(tag_file == 0)
     326        if(tag_file == 0) {
    324327                tag_file = new TagLib::FileRef(lastfn, false);
     328                (tag_file->file())->useWinAnsiCP(true);
     329        }
    325330
    326331        if (!tag_file->isNull() && tag_file->tag()) {
    327332                TagLib::Tag *tag = tag_file->tag();
    328                 SetDlgItemText(hDlg, IDC_TITLE, tag->title().toCString(true));
    329                 SetDlgItemText(hDlg, IDC_ARTIST, tag->artist().toCString(true));
    330                 SetDlgItemText(hDlg, IDC_ALBUM, tag->album().toCString(true));
     333                WCHAR buf[2048];
     334
     335                MultiByteToWideChar(CP_UTF8, 0, tag->title().toCString(true), -1, buf, 2048);
     336                SetDlgItemTextW(hDlg, IDC_TITLE, buf);
     337                MultiByteToWideChar(CP_UTF8, 0, tag->artist().toCString(true), -1, buf, 2048);
     338                SetDlgItemTextW(hDlg, IDC_ARTIST, buf);
     339                MultiByteToWideChar(CP_UTF8, 0, tag->album().toCString(true), -1, buf, 2048);
     340                SetDlgItemTextW(hDlg, IDC_ALBUM, buf);
    331341                tmp.str("");
    332342                tmp << tag->year();
     
    335345                tmp << tag->track();
    336346                SetDlgItemText(hDlg, IDC_TRACK, tmp.str().c_str());
    337                 SetDlgItemText(hDlg, IDC_GENRE, tag->genre().toCString(true));
    338                 SetDlgItemText(hDlg, IDC_COMMENT, tag->comment().toCString(true));
     347                MultiByteToWideChar(CP_UTF8, 0, tag->genre().toCString(true), -1, buf, 2048);
     348                SetDlgItemTextW(hDlg, IDC_GENRE, buf);
     349                MultiByteToWideChar(CP_UTF8, 0, tag->comment().toCString(true), -1, buf, 2048);
     350                SetDlgItemTextW(hDlg, IDC_COMMENT, buf);
    339351        }
    340352}
Note: See TracChangeset for help on using the changeset viewer.