* Log which file has extra-long vorbis comments.
* Gather duration and bitrate information from FLAC files.
This commit is contained in:
parent
e50a0f04ef
commit
3f1afeeb40
@ -611,7 +611,7 @@ GetVideoMetadata(const char * path, char * name)
|
||||
(ctx->streams[audio_stream]->codec->codec_id < CODEC_ID_ADPCM_IMA_QT) )
|
||||
audio_profile = PCM;
|
||||
else
|
||||
DPRINTF(E_DEBUG, L_METADATA, "Unhandled audio codec [%X]\n", ctx->streams[audio_stream]->codec->codec_id);
|
||||
DPRINTF(E_DEBUG, L_METADATA, "Unhandled audio codec [0x%X]\n", ctx->streams[audio_stream]->codec->codec_id);
|
||||
break;
|
||||
}
|
||||
asprintf(&m.frequency, "%u", ctx->streams[audio_stream]->codec->sample_rate);
|
||||
|
@ -27,6 +27,7 @@ _get_flctags(char *filename, struct song_metadata *psong)
|
||||
FLAC__Metadata_SimpleIterator *iterator = 0;
|
||||
FLAC__StreamMetadata *block;
|
||||
int block_number;
|
||||
unsigned int sec, ms;
|
||||
int i;
|
||||
int err = 0;
|
||||
|
||||
@ -54,6 +55,15 @@ _get_flctags(char *filename, struct song_metadata *psong)
|
||||
switch(block->type)
|
||||
{
|
||||
case FLAC__METADATA_TYPE_STREAMINFO:
|
||||
sec = (unsigned int)(block->data.stream_info.total_samples /
|
||||
block->data.stream_info.sample_rate);
|
||||
ms = (unsigned int)(((block->data.stream_info.total_samples %
|
||||
block->data.stream_info.sample_rate) * 1000) /
|
||||
block->data.stream_info.sample_rate);
|
||||
if ((sec == 0) && (ms == 0))
|
||||
break; /* Info is crap, escape div-by-zero. */
|
||||
psong->song_length = (sec * 1000) + ms;
|
||||
psong->bitrate = (((uint64_t)(psong->file_size) * 1000) / (psong->song_length / 8));
|
||||
psong->samplerate = block->data.stream_info.sample_rate;
|
||||
psong->channels = block->data.stream_info.channels;
|
||||
break;
|
||||
|
@ -174,11 +174,11 @@ _get_utf8_text(const id3_ucs4_t* native_text)
|
||||
static void
|
||||
vc_scan(struct song_metadata *psong, const char *comment, const size_t length)
|
||||
{
|
||||
char strbuf[1024];
|
||||
char strbuf[2048];
|
||||
|
||||
if(length > (sizeof(strbuf) - 1))
|
||||
{
|
||||
DPRINTF(E_ERROR, L_SCANNER, "Vorbis Comment too long\n");
|
||||
DPRINTF(E_WARN, L_SCANNER, "Vorbis Comment too long [%s]\n", psong->path);
|
||||
return;
|
||||
}
|
||||
strncpy(strbuf, comment, length);
|
||||
|
@ -263,9 +263,6 @@ readtags(char *path, struct song_metadata *psong, struct stat *stat, char *lang,
|
||||
fname = strrchr(psong->path, '/');
|
||||
psong->basename = fname ? fname + 1 : psong->path;
|
||||
|
||||
// get tag
|
||||
found |= _get_tags(path, psong);
|
||||
|
||||
if(stat)
|
||||
{
|
||||
if(!psong->time_modified)
|
||||
@ -273,6 +270,9 @@ readtags(char *path, struct song_metadata *psong, struct stat *stat, char *lang,
|
||||
psong->file_size = stat->st_size;
|
||||
}
|
||||
|
||||
// get tag
|
||||
found |= _get_tags(path, psong);
|
||||
|
||||
// get fileinfo
|
||||
found |= _get_fileinfo(path, psong);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user