Changeset 9de81b07e23e23b9afdec194cf88325fc3f66778

Show
Ignore:
Timestamp:
19/08/07 19:15:28 (1 year ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1187543728 +0000
git-parent:

[56040f0bb0de6f862deb28bcd62a1373403a6ce8]

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

Implements ogg/vorbis & flac duration preparsing
Ogg/flac doesn't work (yet)

Files:

Legend:

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

    r38dbd37 r9de81b0  
    3434#include <mpegfile.h> 
    3535#include <flacfile.h> 
     36#if 0 
     37#include <oggflacfile.h> 
     38#endif 
     39#include <flacfile.h> 
     40#include <flacproperties.h> 
     41#include <vorbisfile.h> 
     42#include <vorbisproperties.h> 
    3643#include <uniquefileidentifierframe.h> 
     44 
    3745#if 0 //for artist and album id 
    3846#include <textidentificationframe.h> 
     
    97105            p_demux->p_private = (void*)vlc_meta_New(); 
    98106        TagLib::FileRef f( p_demux->psz_path ); 
     107 
     108        if( !f.isNull() ) 
     109        { 
     110            if( TagLib::Ogg::Vorbis::File *p_ogg_v = 
     111                dynamic_cast<TagLib::Ogg::Vorbis::File *>(f.file() ) ) 
     112            { 
     113                int i_ogg_v_length = p_ogg_v->audioProperties()->length(); 
     114 
     115                input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); 
     116                if( p_input ) 
     117                { 
     118                    input_item_t *p_item = input_GetItem( p_input ); 
     119                    if( p_item ) 
     120                    { 
     121                        vlc_mutex_lock( &p_item->lock ); 
     122                        p_item->i_duration = i_ogg_v_length * 1000000; 
     123                        vlc_mutex_unlock( &p_item->lock ); 
     124                    } 
     125                    vlc_object_release( p_input ); 
     126                } 
     127            } 
     128#if 0 /* at this moment, taglib is unable to detect ogg/flac files 
     129       * becauses type detection is based on file extension: 
     130       * ogg = ogg/vorbis 
     131       * flac = flac 
     132       * ø = ogg/flac 
     133       */ 
     134            else if( TagLib::Ogg::FLAC::File *p_ogg_f = 
     135                dynamic_cast<TagLib::Ogg::FLAC::File *>(f.file() ) ) 
     136            { 
     137                long i_ogg_f_length = p_ogg_f->streamLength(); 
     138                input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); 
     139                if( p_input ) 
     140                { 
     141                    input_item_t *p_item = input_GetItem( p_input ); 
     142                    if( p_item ) 
     143                    { 
     144                        vlc_mutex_lock( &p_item->lock ); 
     145                        p_item->i_duration = i_ogg_f_length * 1000000; 
     146                        vlc_mutex_unlock( &p_item->lock ); 
     147                    } 
     148                    vlc_object_release( p_input ); 
     149                } 
     150            } 
     151#endif 
     152            else if( TagLib::FLAC::File *p_flac = 
     153                dynamic_cast<TagLib::FLAC::File *>(f.file() ) ) 
     154            { 
     155                long i_flac_length = p_flac->audioProperties()->length(); 
     156                input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); 
     157                if( p_input ) 
     158                { 
     159                    input_item_t *p_item = input_GetItem( p_input ); 
     160                    if( p_item ) 
     161                    { 
     162                        vlc_mutex_lock( &p_item->lock ); 
     163                        p_item->i_duration = i_flac_length * 1000000; 
     164                        vlc_mutex_unlock( &p_item->lock ); 
     165                    } 
     166                    vlc_object_release( p_input ); 
     167                } 
     168            } 
     169        } 
     170 
    99171        if( !f.isNull() && f.tag() && !f.tag()->isEmpty() ) 
    100172        { 
     
    140212                        } 
    141213                    } 
    142                     /* musicbrainz artist and album id: not useful yet */ 
     214                    /* musicbrainz artist and album id: not useful (yet?) */ 
    143215#if 0 
    144216                    list = tag->frameListMap()["TXXX"];