mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-16 00:58:18 -04:00
don't crash on 0 bitrate
This commit is contained in:
parent
1c590645be
commit
84ea7aa49c
@ -901,7 +901,7 @@ int scan_get_mp3fileinfo(char *file, MP3FILE *pmp3) {
|
|||||||
off_t fp_size=0;
|
off_t fp_size=0;
|
||||||
off_t file_size;
|
off_t file_size;
|
||||||
unsigned char buffer[1024];
|
unsigned char buffer[1024];
|
||||||
int time_seconds;
|
int time_seconds=0;
|
||||||
int index;
|
int index;
|
||||||
int layer_index;
|
int layer_index;
|
||||||
int sample_index;
|
int sample_index;
|
||||||
@ -996,6 +996,10 @@ int scan_get_mp3fileinfo(char *file, MP3FILE *pmp3) {
|
|||||||
stereo=0;
|
stereo=0;
|
||||||
else
|
else
|
||||||
stereo=1;
|
stereo=1;
|
||||||
|
DPRINTF(ERR_DEBUG," MPEG Version: %s\n",ver == 3 ? "1" : (ver == 2 ? "2" : "2.5"));
|
||||||
|
DPRINTF(ERR_DEBUG," Layer: %d\n",4-layer);
|
||||||
|
DPRINTF(ERR_DEBUG," Sample Rate: %d\n",samplerate);
|
||||||
|
DPRINTF(ERR_DEBUG," Bit Rate: %d\n",bitrate);
|
||||||
} else {
|
} else {
|
||||||
/* not an mp3... */
|
/* not an mp3... */
|
||||||
DPRINTF(ERR_DEBUG,"File is not a MPEG file\n");
|
DPRINTF(ERR_DEBUG,"File is not a MPEG file\n");
|
||||||
@ -1004,7 +1008,9 @@ int scan_get_mp3fileinfo(char *file, MP3FILE *pmp3) {
|
|||||||
|
|
||||||
|
|
||||||
/* guesstimate the file length */
|
/* guesstimate the file length */
|
||||||
|
if(bitrate)
|
||||||
time_seconds = ((int)(file_size * 8)) / (bitrate * 1024);
|
time_seconds = ((int)(file_size * 8)) / (bitrate * 1024);
|
||||||
|
|
||||||
if(!pmp3->song_length) /* could have gotten it from the tag */
|
if(!pmp3->song_length) /* could have gotten it from the tag */
|
||||||
pmp3->song_length=time_seconds;
|
pmp3->song_length=time_seconds;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user