| | 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 | |
|---|