* Add WAV file support.
This commit is contained in:
2
Makefile
2
Makefile
@ -105,7 +105,7 @@ albumart.o: upnpglobalvars.h albumart.h utils.h image_utils.h sql.h log.h
|
|||||||
tagutils/misc.o: tagutils/misc.h
|
tagutils/misc.o: tagutils/misc.h
|
||||||
tagutils/textutils.o: tagutils/misc.h tagutils/textutils.h log.h
|
tagutils/textutils.o: tagutils/misc.h tagutils/textutils.h log.h
|
||||||
tagutils/tagutils.o: tagutils/tagutils-asf.c tagutils/tagutils-flc.c tagutils/tagutils-plist.c tagutils/tagutils-misc.c
|
tagutils/tagutils.o: tagutils/tagutils-asf.c tagutils/tagutils-flc.c tagutils/tagutils-plist.c tagutils/tagutils-misc.c
|
||||||
tagutils/tagutils.o: tagutils/tagutils-aac.c tagutils/tagutils-asf.h tagutils/tagutils-flc.h tagutils/tagutils-mp3.c
|
tagutils/tagutils.o: tagutils/tagutils-aac.c tagutils/tagutils-asf.h tagutils/tagutils-flc.h tagutils/tagutils-mp3.c tagutils/tagutils-wav.c
|
||||||
tagutils/tagutils.o: tagutils/tagutils-ogg.c tagutils/tagutils-aac.h tagutils/tagutils.h tagutils/tagutils-mp3.h tagutils/tagutils-ogg.h log.h
|
tagutils/tagutils.o: tagutils/tagutils-ogg.c tagutils/tagutils-aac.h tagutils/tagutils.h tagutils/tagutils-mp3.h tagutils/tagutils-ogg.h log.h
|
||||||
image_utils.o: image_utils.h
|
image_utils.o: image_utils.h
|
||||||
tivo_utils.o: config.h tivo_utils.h
|
tivo_utils.o: config.h tivo_utils.h
|
||||||
|
@ -178,6 +178,11 @@ GetAudioMetadata(const char * path, char * name)
|
|||||||
strcpy(type, "flc");
|
strcpy(type, "flc");
|
||||||
strcpy(mime, "audio/x-flac");
|
strcpy(mime, "audio/x-flac");
|
||||||
}
|
}
|
||||||
|
else if( ends_with(path, ".wav") )
|
||||||
|
{
|
||||||
|
strcpy(type, "wav");
|
||||||
|
strcpy(mime, "audio/x-wav");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINTF(E_WARN, L_GENERAL, "Unhandled file extension on %s\n", path);
|
DPRINTF(E_WARN, L_GENERAL, "Unhandled file extension on %s\n", path);
|
||||||
@ -269,7 +274,7 @@ GetAudioMetadata(const char * path, char * name)
|
|||||||
genre,
|
genre,
|
||||||
comment,
|
comment,
|
||||||
song.track,
|
song.track,
|
||||||
dlna_pn, mime,
|
dlna_pn, song.mime?song.mime:mime,
|
||||||
album_art, album_art?art_dlna_pn:NULL );
|
album_art, album_art?art_dlna_pn:NULL );
|
||||||
freetags(&song);
|
freetags(&song);
|
||||||
if( dlna_pn )
|
if( dlna_pn )
|
||||||
|
@ -67,7 +67,8 @@ is_audio(const char * file)
|
|||||||
ends_with(file, ".wma") || ends_with(file, ".asf") ||
|
ends_with(file, ".wma") || ends_with(file, ".asf") ||
|
||||||
ends_with(file, ".fla") || ends_with(file, ".flc") ||
|
ends_with(file, ".fla") || ends_with(file, ".flc") ||
|
||||||
ends_with(file, ".m4a") || ends_with(file, ".aac") ||
|
ends_with(file, ".m4a") || ends_with(file, ".aac") ||
|
||||||
ends_with(file, ".mp4") || ends_with(file, ".m4p"));
|
ends_with(file, ".mp4") || ends_with(file, ".m4p") ||
|
||||||
|
ends_with(file, ".wav"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -378,7 +379,7 @@ insert_containers(const char * name, const char *path, const char * refID, const
|
|||||||
sprintf(last_genreArtist.parentID, "%s$%llX", last_genre.parentID, container>>32);
|
sprintf(last_genreArtist.parentID, "%s$%llX", last_genre.parentID, container>>32);
|
||||||
last_genreArtist.objectID = (int)container;
|
last_genreArtist.objectID = (int)container;
|
||||||
strcpy(last_genreArtist.name, artist?artist:"Unknown Artist");
|
strcpy(last_genreArtist.name, artist?artist:"Unknown Artist");
|
||||||
//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached artist/artist item: %s/%s/%X\n", last_artist.name, last_artist.parentID, last_artist.objectID);
|
//DEBUG DPRINTF(E_DEBUG, L_SCANNER, "Creating cached genre/artist item: %s/%s/%X\n", last_genreArtist.name, last_genreArtist.parentID, last_genreArtist.objectID);
|
||||||
}
|
}
|
||||||
sql = sqlite3_mprintf( "INSERT into OBJECTS"
|
sql = sqlite3_mprintf( "INSERT into OBJECTS"
|
||||||
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
|
" (OBJECT_ID, PARENT_ID, REF_ID, CLASS, DETAIL_ID, NAME) "
|
||||||
|
@ -105,7 +105,6 @@ _asf_read_media_stream(FILE *fp, struct song_metadata *psong, __u32 size)
|
|||||||
{
|
{
|
||||||
case WMAV1:
|
case WMAV1:
|
||||||
case WMAV2:
|
case WMAV2:
|
||||||
printf("***** JM: bitrate: %d\n", psong->bitrate);
|
|
||||||
if( psong->bitrate < 193000 )
|
if( psong->bitrate < 193000 )
|
||||||
asprintf(&(psong->dlna_pn), "WMABASE");
|
asprintf(&(psong->dlna_pn), "WMABASE");
|
||||||
else
|
else
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
* This file is derived from mt-daap project.
|
* This file is derived from mt-daap project.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// _get_mp3tags
|
|
||||||
static int
|
static int
|
||||||
_get_mp3tags(char *file, struct song_metadata *psong)
|
_get_mp3tags(char *file, struct song_metadata *psong)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@ -103,6 +105,7 @@ char *winamp_genre[] = {
|
|||||||
#include "tagutils-ogg.h"
|
#include "tagutils-ogg.h"
|
||||||
#include "tagutils-flc.h"
|
#include "tagutils-flc.h"
|
||||||
#include "tagutils-asf.h"
|
#include "tagutils-asf.h"
|
||||||
|
#include "tagutils-wav.h"
|
||||||
|
|
||||||
static int _get_tags(char *file, struct song_metadata *psong);
|
static int _get_tags(char *file, struct song_metadata *psong);
|
||||||
static int _get_fileinfo(char *file, struct song_metadata *psong);
|
static int _get_fileinfo(char *file, struct song_metadata *psong);
|
||||||
@ -124,6 +127,7 @@ static taghandler taghandlers[] = {
|
|||||||
{ "flc", _get_flctags, _get_flcfileinfo },
|
{ "flc", _get_flctags, _get_flcfileinfo },
|
||||||
{ "ogg", 0, _get_oggfileinfo },
|
{ "ogg", 0, _get_oggfileinfo },
|
||||||
{ "asf", 0, _get_asffileinfo },
|
{ "asf", 0, _get_asffileinfo },
|
||||||
|
{ "wav", _get_wavtags, _get_wavfileinfo },
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -136,6 +140,7 @@ static taghandler taghandlers[] = {
|
|||||||
#include "tagutils-ogg.c"
|
#include "tagutils-ogg.c"
|
||||||
#include "tagutils-flc.c"
|
#include "tagutils-flc.c"
|
||||||
#include "tagutils-asf.c"
|
#include "tagutils-asf.c"
|
||||||
|
#include "tagutils-wav.c"
|
||||||
|
|
||||||
//*********************************************************************************
|
//*********************************************************************************
|
||||||
// freetags()
|
// freetags()
|
||||||
@ -157,6 +162,7 @@ freetags(struct song_metadata *psong)
|
|||||||
MAYBEFREE(psong->contributor_sort[role]);
|
MAYBEFREE(psong->contributor_sort[role]);
|
||||||
}
|
}
|
||||||
MAYBEFREE(psong->grouping);
|
MAYBEFREE(psong->grouping);
|
||||||
|
MAYBEFREE(psong->mime);
|
||||||
MAYBEFREE(psong->dlna_pn);
|
MAYBEFREE(psong->dlna_pn);
|
||||||
MAYBEFREE(psong->tagversion);
|
MAYBEFREE(psong->tagversion);
|
||||||
MAYBEFREE(psong->musicbrainz_albumid);
|
MAYBEFREE(psong->musicbrainz_albumid);
|
||||||
|
@ -86,6 +86,7 @@ struct song_metadata {
|
|||||||
int lossless;
|
int lossless;
|
||||||
int blockalignment;
|
int blockalignment;
|
||||||
|
|
||||||
|
char *mime; // MIME type
|
||||||
char *dlna_pn; // DLNA Profile Name
|
char *dlna_pn; // DLNA Profile Name
|
||||||
|
|
||||||
char *tagversion;
|
char *tagversion;
|
||||||
|
@ -1560,4 +1560,5 @@ SendResp_dlnafile(struct upnphttp * h, char * object)
|
|||||||
if( !newpid )
|
if( !newpid )
|
||||||
_exit(0);
|
_exit(0);
|
||||||
#endif
|
#endif
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
@ -535,6 +535,14 @@ callback(void *args, int argc, char **argv, char **azColName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if( !(passed_args->flags & FLAG_DLNA) )
|
||||||
|
{
|
||||||
|
if( strncmp(mime, "audio/L16", 9) == 0 )
|
||||||
|
{
|
||||||
|
strcpy(mime+6, "x-wav");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = snprintf(str_buf, 512, "<item id=\"%s\" parentID=\"%s\" restricted=\"1\"", id, parent);
|
ret = snprintf(str_buf, 512, "<item id=\"%s\" parentID=\"%s\" restricted=\"1\"", id, parent);
|
||||||
memcpy(passed_args->resp+passed_args->size, &str_buf, ret+1);
|
memcpy(passed_args->resp+passed_args->size, &str_buf, ret+1);
|
||||||
passed_args->size += ret;
|
passed_args->size += ret;
|
||||||
|
Reference in New Issue
Block a user