Resolve problem parsing m4p files introduced with query changes.
This commit is contained in:
parent
3294922dcf
commit
95989a91f0
|
@ -263,6 +263,20 @@ void scan_music_file(char *path, struct dirent *pde, struct stat *psb);
|
||||||
|
|
||||||
void make_composite_tags(MP3FILE *pmp3);
|
void make_composite_tags(MP3FILE *pmp3);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char* suffix;
|
||||||
|
int (*tags)(char* file, MP3FILE* pmp3);
|
||||||
|
int (*files)(char* file, MP3FILE* pmp3);
|
||||||
|
} taghandler;
|
||||||
|
static taghandler taghandlers[] = {
|
||||||
|
{ "aac", scan_get_aactags, scan_get_aacfileinfo },
|
||||||
|
{ "mp4", scan_get_aactags, scan_get_aacfileinfo },
|
||||||
|
{ "m4a", scan_get_aactags, scan_get_aacfileinfo },
|
||||||
|
{ "m4p", scan_get_aactags, scan_get_aacfileinfo },
|
||||||
|
{ "mp3", scan_get_mp3tags, scan_get_mp3fileinfo },
|
||||||
|
{ NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* scan_init
|
* scan_init
|
||||||
*
|
*
|
||||||
|
@ -629,18 +643,15 @@ int scan_get_aactags(char *file, MP3FILE *pmp3) {
|
||||||
* Scan an mp3 file for id3 tags using libid3tag
|
* Scan an mp3 file for id3 tags using libid3tag
|
||||||
*/
|
*/
|
||||||
int scan_gettags(char *file, MP3FILE *pmp3) {
|
int scan_gettags(char *file, MP3FILE *pmp3) {
|
||||||
|
taghandler *hdl;
|
||||||
|
|
||||||
/* dispatch to appropriate tag handler */
|
/* dispatch to appropriate tag handler */
|
||||||
|
for(hdl = taghandlers ; hdl->suffix ; ++hdl)
|
||||||
|
if(!strcmp(hdl->suffix, pmp3->type))
|
||||||
|
break;
|
||||||
|
|
||||||
/* perhaps it would be better to just blindly try each
|
if(hdl->tags)
|
||||||
* in turn, just in case the extensions are wrong/lying
|
return hdl->tags(file, pmp3);
|
||||||
*/
|
|
||||||
|
|
||||||
if(strcasestr("aacm4a4pmp4",pmp3->type))
|
|
||||||
return scan_get_aactags(file,pmp3);
|
|
||||||
|
|
||||||
/* should handle mp3 in the same way */
|
|
||||||
if(!strcasecmp(pmp3->type,"mp3"))
|
|
||||||
return scan_get_mp3tags(file,pmp3);
|
|
||||||
|
|
||||||
/* maybe this is an extension that we've manually
|
/* maybe this is an extension that we've manually
|
||||||
* specified in the config file, but don't know how
|
* specified in the config file, but don't know how
|
||||||
|
@ -830,12 +841,16 @@ int scan_get_fileinfo(char *file, MP3FILE *pmp3) {
|
||||||
FILE *infile;
|
FILE *infile;
|
||||||
off_t file_size;
|
off_t file_size;
|
||||||
|
|
||||||
if(strcasestr("aacm4am4pmp4",pmp3->type))
|
taghandler *hdl;
|
||||||
return scan_get_aacfileinfo(file,pmp3);
|
|
||||||
|
/* dispatch to appropriate tag handler */
|
||||||
if(!strcasecmp(pmp3->type,"mp3"))
|
for(hdl = taghandlers ; hdl->suffix ; ++hdl)
|
||||||
return scan_get_mp3fileinfo(file,pmp3);
|
if(!strcmp(hdl->suffix, pmp3->type))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if(hdl->files)
|
||||||
|
return hdl->files(file, pmp3);
|
||||||
|
|
||||||
/* a file we don't know anything about... ogg or aiff maybe */
|
/* a file we don't know anything about... ogg or aiff maybe */
|
||||||
if(!(infile=fopen(file,"rb"))) {
|
if(!(infile=fopen(file,"rb"))) {
|
||||||
DPRINTF(ERR_WARN,"Could not open %s for reading\n",file);
|
DPRINTF(ERR_WARN,"Could not open %s for reading\n",file);
|
||||||
|
|
Loading…
Reference in New Issue