Fix ticket #28 -- incorrect song duration on wma files. Also update scanner driver for new config, etc

This commit is contained in:
Ron Pedde 2006-03-29 05:08:57 +00:00
parent dfcc54342b
commit a1a4ba9c1b
3 changed files with 23 additions and 7 deletions

View File

@ -537,11 +537,15 @@ int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) {
if(!wma_file_read_ll(fd, &preroll))
return FALSE;
DPRINTF(E_DBG,L_SCAN,"play_duration: %lld, "
"send_duration: %lld, preroll: %lld\n",
play_duration, send_duration, preroll);
/* I'm not entirely certain what preroll is, but it seems
* to make it match up with what windows thinks is the song
* length.
*/
pmp3->song_length = ((int)play_duration / 10000) - (int)preroll;
pmp3->song_length = (int)((play_duration / 10000) - preroll);
/* skip flags(4),
* min_packet_size (4), max_packet_size(4)

View File

@ -29,6 +29,7 @@
#include <string.h>
#include <unistd.h>
#include "conf.h"
#include "daapd.h"
#include "err.h"
#include "mp3-scanner.h"
@ -123,6 +124,7 @@ void usage(int errorcode) {
fprintf(stderr,"Usage: %s [options] input-file\n\n",av0);
fprintf(stderr,"options:\n\n");
fprintf(stderr," -d level set debuglevel (9 is highest)\n");
fprintf(stderr," -c config read config file\n");
fprintf(stderr,"\n\n");
exit(errorcode);
@ -133,9 +135,7 @@ int main(int argc, char *argv[]) {
SCANNERLIST *plist;
int option;
char *ext;
config.scan_type=0;
config.latin1_tags=0;
char *configfile;
memset((void*)&mp3,0x00,sizeof(MP3FILE));
@ -145,11 +145,15 @@ int main(int argc, char *argv[]) {
av0 = argv[0];
}
while((option = getopt(argc, argv, "d:")) != -1) {
while((option = getopt(argc, argv, "d:c:")) != -1) {
switch(option) {
case 'd':
err_debuglevel = atoi(optarg);
err_setlevel(atoi(optarg));
break;
case 'c':
configfile=optarg;
break;
default:
fprintf(stderr,"Error: unknown option (%c)\n\n",option);
usage(-1);
@ -164,8 +168,16 @@ int main(int argc, char *argv[]) {
usage(-1);
}
printf("Reading config file %s\n",configfile);
if(conf_read(configfile) != CONF_E_SUCCESS) {
fprintf(stderr,"Bummer.\n");
exit(EXIT_FAILURE);
}
printf("Getting info for %s\n",argv[0]);
ext = strrchr(argv[0],'.')+1;
plist=scanner_list;

View File

@ -2,7 +2,7 @@ CC=gcc
CFLAGS := $(CFLAGS) -g -I/opt/local/include -DHAVE_CONFIG_H -I. -I..
LDFLAGS := $(LDFLAGS) -L/opt/local/lib -lid3tag -logg -lvorbisfile -lFLAC -lvorbis -ltag_c
TARGET = scanner
OBJECTS=scanner-driver.o restart.o err.o scan-wma.o scan-aac.o scan-wav.o scan-flac.o scan-ogg.o scan-mp3.o scan-url.o scan-mpc.o
OBJECTS=scanner-driver.o restart.o err.o scan-wma.o scan-aac.o scan-wav.o scan-flac.o scan-ogg.o scan-mp3.o scan-url.o scan-mpc.o os-unix.o conf.o ll.o
$(TARGET): $(OBJECTS)
$(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS)