xing header alignment problems fix, hat tip to Paul Forgey

This commit is contained in:
Ron Pedde 2005-10-29 15:49:11 +00:00
parent fc2c656317
commit cb42785a36
2 changed files with 406 additions and 397 deletions

View File

@ -102,3 +102,8 @@ Phil Packer
Diego Penneno
* Patches for multiple PID files to facilitate gentoo init scripts
Paul Forgey
* Fixes for alignment problems in XING header parsing

View File

@ -921,15 +921,19 @@ int scan_mp3_get_mp3fileinfo(char *file, MP3FILE *pmp3) {
/* now check for an XING header */
if(strncasecmp((char*)&buffer[index+fi.xing_offset+4],"XING",4) == 0) {
DPRINTF(E_DBG,L_SCAN,"Found Xing header\n");
xing_flags=*((int*)&buffer[index+fi.xing_offset+4+4]);
xing_flags=ntohs(xing_flags);
xing_flags = buffer[index+fi.xing_offset+4+4] << 24 |
buffer[index+fi.xing_offset+4+5] << 16 |
buffer[index+fi.xing_offset+4+6] << 8 |
buffer[index+fi.xing_offset+4+7];
DPRINTF(E_DBG,L_SCAN,"Xing Flags: %02X\n",xing_flags);
if(xing_flags & 0x1) {
/* Frames field is valid... */
fi.number_of_frames=*((int*)&buffer[index+fi.xing_offset+4+8]);
fi.number_of_frames=ntohs(fi.number_of_frames);
fi.number_of_frames=buffer[index+fi.xing_offset+4+8] << 24 |
buffer[index+fi.xing_offset+4+9] << 16 |
buffer[index+fi.xing_offset+4+10] << 8 |
buffer[index+fi.xing_offset+4+11];
}
}