mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-19 10:17:22 -04:00
Fix ticket #28 -- incorrect song duration on wma files. Also update scanner driver for new config, etc
This commit is contained in:
parent
dfcc54342b
commit
a1a4ba9c1b
@ -537,11 +537,15 @@ int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) {
|
|||||||
if(!wma_file_read_ll(fd, &preroll))
|
if(!wma_file_read_ll(fd, &preroll))
|
||||||
return FALSE;
|
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
|
/* I'm not entirely certain what preroll is, but it seems
|
||||||
* to make it match up with what windows thinks is the song
|
* to make it match up with what windows thinks is the song
|
||||||
* length.
|
* length.
|
||||||
*/
|
*/
|
||||||
pmp3->song_length = ((int)play_duration / 10000) - (int)preroll;
|
pmp3->song_length = (int)((play_duration / 10000) - preroll);
|
||||||
|
|
||||||
/* skip flags(4),
|
/* skip flags(4),
|
||||||
* min_packet_size (4), max_packet_size(4)
|
* min_packet_size (4), max_packet_size(4)
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "conf.h"
|
||||||
#include "daapd.h"
|
#include "daapd.h"
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
#include "mp3-scanner.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,"Usage: %s [options] input-file\n\n",av0);
|
||||||
fprintf(stderr,"options:\n\n");
|
fprintf(stderr,"options:\n\n");
|
||||||
fprintf(stderr," -d level set debuglevel (9 is highest)\n");
|
fprintf(stderr," -d level set debuglevel (9 is highest)\n");
|
||||||
|
fprintf(stderr," -c config read config file\n");
|
||||||
|
|
||||||
fprintf(stderr,"\n\n");
|
fprintf(stderr,"\n\n");
|
||||||
exit(errorcode);
|
exit(errorcode);
|
||||||
@ -133,9 +135,7 @@ int main(int argc, char *argv[]) {
|
|||||||
SCANNERLIST *plist;
|
SCANNERLIST *plist;
|
||||||
int option;
|
int option;
|
||||||
char *ext;
|
char *ext;
|
||||||
|
char *configfile;
|
||||||
config.scan_type=0;
|
|
||||||
config.latin1_tags=0;
|
|
||||||
|
|
||||||
memset((void*)&mp3,0x00,sizeof(MP3FILE));
|
memset((void*)&mp3,0x00,sizeof(MP3FILE));
|
||||||
|
|
||||||
@ -145,11 +145,15 @@ int main(int argc, char *argv[]) {
|
|||||||
av0 = argv[0];
|
av0 = argv[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
while((option = getopt(argc, argv, "d:")) != -1) {
|
while((option = getopt(argc, argv, "d:c:")) != -1) {
|
||||||
switch(option) {
|
switch(option) {
|
||||||
case 'd':
|
case 'd':
|
||||||
err_debuglevel = atoi(optarg);
|
err_setlevel(atoi(optarg));
|
||||||
break;
|
break;
|
||||||
|
case 'c':
|
||||||
|
configfile=optarg;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"Error: unknown option (%c)\n\n",option);
|
fprintf(stderr,"Error: unknown option (%c)\n\n",option);
|
||||||
usage(-1);
|
usage(-1);
|
||||||
@ -164,8 +168,16 @@ int main(int argc, char *argv[]) {
|
|||||||
usage(-1);
|
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]);
|
printf("Getting info for %s\n",argv[0]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ext = strrchr(argv[0],'.')+1;
|
ext = strrchr(argv[0],'.')+1;
|
||||||
plist=scanner_list;
|
plist=scanner_list;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ CC=gcc
|
|||||||
CFLAGS := $(CFLAGS) -g -I/opt/local/include -DHAVE_CONFIG_H -I. -I..
|
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
|
LDFLAGS := $(LDFLAGS) -L/opt/local/lib -lid3tag -logg -lvorbisfile -lFLAC -lvorbis -ltag_c
|
||||||
TARGET = scanner
|
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)
|
$(TARGET): $(OBJECTS)
|
||||||
$(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS)
|
$(CC) -o $(TARGET) $(LDFLAGS) $(OBJECTS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user