Changeset affcd511796c1b43a59e8de2b2695736996f94a6

Show
Ignore:
Timestamp:
27/06/07 08:40:05 (1 year ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1182926405 +0000
git-parent:

[661efb2e0ab35651d3cb4a3b18cb0aeab64b9c13]

git-author:
Rafaël Carré <funman@videolan.org> 1182926405 +0000
Message:

Uses TagLib? class to represent UTF8 strings when writing metadata

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/meta_engine/taglib.cpp

    rb6198c8 raffcd51  
    3030#include <fileref.h> 
    3131#include <tag.h> 
     32#include <tstring.h> 
    3233#include <id3v2tag.h> 
    3334#include <mpegfile.h> 
     
    167168} 
    168169 
    169 #define SET(a,b) if(b) tag->set##a( b ); 
     170#define SET(a,b) if(b) { \ 
     171        TagLib::String *psz_##a = new TagLib::String( b, \ 
     172            TagLib::String::UTF8 ); \ 
     173        tag->set##a( *psz_##a ); \ 
     174        delete psz_##a; \ 
     175    } 
    170176 
    171177static int WriteMeta( vlc_object_t *p_this ) 
     
    185191    { 
    186192        msg_Dbg( p_this, "Updating metadata for %s", p_export->psz_file ); 
     193 
    187194        TagLib::Tag *tag = f.tag(); 
     195 
    188196        SET( Artist, p_item->p_meta->psz_artist ); 
    189         if( p_item->p_meta->psz_title ) 
    190             tag->setTitle( p_item->p_meta->psz_title ); 
    191         else 
    192             tag->setTitle( p_item->psz_name ); 
     197 
     198        char *psz_titlec = ( p_item->p_meta->psz_title ? 
     199            p_item->p_meta->psz_title : p_item->psz_name ); 
     200        TagLib::String *psz_title = new TagLib::String( psz_titlec, 
     201            TagLib::String::UTF8 ); 
     202        tag->setTitle( *psz_title ); 
     203        delete psz_title; 
     204 
    193205        SET( Album, p_item->p_meta->psz_album ); 
    194206        SET( Genre, p_item->p_meta->psz_genre ); 
     207 
    195208        if( p_item->p_meta->psz_date ) 
    196209            tag->setYear( atoi( p_item->p_meta->psz_date ) ); 
    197210        if( p_item->p_meta->psz_tracknum ) 
    198211            tag->setTrack( atoi( p_item->p_meta->psz_tracknum ) ); 
     212 
    199213        f.save(); 
    200214        return VLC_SUCCESS;