[Mt-daapd-cvs] mt-daapd/src mp3-scanner.c,1.54,1.55
Status: Beta
Brought to you by:
andrew40
From: David W. B. <dw...@us...> - 2004-06-25 23:23:24
|
Update of /cvsroot/mt-daapd/mt-daapd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22253/src Modified Files: mp3-scanner.c Log Message: Resolve problem parsing m4p files introduced with query changes. Index: mp3-scanner.c =================================================================== RCS file: /cvsroot/mt-daapd/mt-daapd/src/mp3-scanner.c,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** mp3-scanner.c 22 Jun 2004 01:55:07 -0000 1.54 --- mp3-scanner.c 25 Jun 2004 23:23:15 -0000 1.55 *************** *** 264,267 **** --- 264,281 ---- 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 *************** *** 630,645 **** */ int scan_gettags(char *file, MP3FILE *pmp3) { ! /* dispatch to appropriate tag handler */ ! ! /* perhaps it would be better to just blindly try each ! * in turn, just in case the extensions are wrong/lying ! */ ! 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 --- 644,656 ---- */ int scan_gettags(char *file, MP3FILE *pmp3) { ! taghandler *hdl; ! /* dispatch to appropriate tag handler */ ! for(hdl = taghandlers ; hdl->suffix ; ++hdl) ! if(!strcmp(hdl->suffix, pmp3->type)) ! break; ! if(hdl->tags) ! return hdl->tags(file, pmp3); /* maybe this is an extension that we've manually *************** *** 831,840 **** off_t file_size; ! if(strcasestr("aacm4am4pmp4",pmp3->type)) ! return scan_get_aacfileinfo(file,pmp3); ! ! if(!strcasecmp(pmp3->type,"mp3")) ! return scan_get_mp3fileinfo(file,pmp3); ! /* a file we don't know anything about... ogg or aiff maybe */ if(!(infile=fopen(file,"rb"))) { --- 842,855 ---- off_t file_size; ! taghandler *hdl; ! ! /* dispatch to appropriate tag handler */ ! for(hdl = taghandlers ; hdl->suffix ; ++hdl) ! 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 */ if(!(infile=fopen(file,"rb"))) { |