Add sample rate from wma files, closing #166

This commit is contained in:
Ron Pedde 2006-08-26 04:14:17 +00:00
parent c319c8b090
commit c7a385b9b1
2 changed files with 9 additions and 2 deletions

View File

@ -819,6 +819,8 @@ int scan_mp3_get_mp3fileinfo(char *file, MP3FILE *pmp3) {
return FALSE;
}
file_size = pmp3->file_size;
memset((void*)&fi,0x00,sizeof(fi));
if(fread(buffer,1,sizeof(buffer),infile) != sizeof(buffer)) {

View File

@ -29,7 +29,6 @@
#include <stdlib.h>
#include <string.h>
#include "mp3-scanner.h"
#include "restart.h"
#include "err.h"
@ -377,7 +376,8 @@ int wma_parse_stream_properties(int fd, int size, MP3FILE *pmp3) {
int wma_parse_audio_media(int fd, int size, MP3FILE *pmp3) {
unsigned short int codec;
if(size < 2)
if(size < 18)
return TRUE; /* we'll leave it wma. will work or not! */
if(!wma_file_read_short(fd,&codec)) {
@ -401,6 +401,11 @@ int wma_parse_audio_media(int fd, int size, MP3FILE *pmp3) {
break;
}
/* might as well get the sample rate while we are at it */
lseek(fd,2,SEEK_CUR);
if(!wma_file_read_int(fd,(unsigned int *)&pmp3->samplerate))
return FALSE;
return TRUE;
}