mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-26 22:23:17 -05:00
stdint fixes
This commit is contained in:
parent
654d0fe685
commit
758c0c6245
@ -36,6 +36,9 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -257,7 +260,7 @@ void config_subst_stream(WS_CONNINFO *pwsc, int fd_src) {
|
|||||||
} else {
|
} else {
|
||||||
outbuffer[out_index] = next;
|
outbuffer[out_index] = next;
|
||||||
out_index++;
|
out_index++;
|
||||||
|
|
||||||
if(out_index == sizeof(outbuffer)) {
|
if(out_index == sizeof(outbuffer)) {
|
||||||
r_write(pwsc->fd,outbuffer,out_index);
|
r_write(pwsc->fd,outbuffer,out_index);
|
||||||
out_index=0;
|
out_index=0;
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
|
21
src/err.c
21
src/err.c
@ -38,6 +38,9 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -95,7 +98,7 @@ uint32_t _err_get_threadid(void) {
|
|||||||
} else {
|
} else {
|
||||||
thread_id = util_djb_hash_block((unsigned char *)&tid,sizeof(pthread_t));
|
thread_id = util_djb_hash_block((unsigned char *)&tid,sizeof(pthread_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
return thread_id;
|
return thread_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +111,7 @@ void err_reopen(void) {
|
|||||||
|
|
||||||
if(!(err_logdest & LOGDEST_LOGFILE))
|
if(!(err_logdest & LOGDEST_LOGFILE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// _err_lock();
|
// _err_lock();
|
||||||
fclose(err_file);
|
fclose(err_file);
|
||||||
err_file = fopen(err_filename,"a");
|
err_file = fopen(err_filename,"a");
|
||||||
@ -171,13 +174,13 @@ void err_log(int level, unsigned int cat, char *fmt, ...)
|
|||||||
if(!level) fprintf(err_file,"%s: Aborting\n",timebuf);
|
if(!level) fprintf(err_file,"%s: Aborting\n",timebuf);
|
||||||
fflush(err_file);
|
fflush(err_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* always log to stderr on fatal error */
|
/* always log to stderr on fatal error */
|
||||||
if((err_logdest & LOGDEST_STDERR) || (!level)) {
|
if((err_logdest & LOGDEST_STDERR) || (!level)) {
|
||||||
fprintf(stderr, "%s",errbuf);
|
fprintf(stderr, "%s",errbuf);
|
||||||
if(!level) fprintf(stderr,"Aborting\n");
|
if(!level) fprintf(stderr,"Aborting\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* always log fatals and level 1 to syslog */
|
/* always log fatals and level 1 to syslog */
|
||||||
if(level <= 1) {
|
if(level <= 1) {
|
||||||
if(!err_syslog_open)
|
if(!err_syslog_open)
|
||||||
@ -194,12 +197,12 @@ void err_log(int level, unsigned int cat, char *fmt, ...)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if(!level) {
|
if(!level) {
|
||||||
exit(EXIT_FAILURE); /* this should go to an OS-specific exit routine */
|
exit(EXIT_FAILURE); /* this should go to an OS-specific exit routine */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* simple get/set interface to debuglevel to avoid global
|
* simple get/set interface to debuglevel to avoid global
|
||||||
*/
|
*/
|
||||||
@ -227,7 +230,7 @@ int err_getlevel(void) {
|
|||||||
*/
|
*/
|
||||||
int err_getdest(void) {
|
int err_getdest(void) {
|
||||||
int dest;
|
int dest;
|
||||||
|
|
||||||
_err_lock();
|
_err_lock();
|
||||||
dest=err_logdest;
|
dest=err_logdest;
|
||||||
_err_unlock();
|
_err_unlock();
|
||||||
@ -278,7 +281,7 @@ int err_setlogfile(char *file) {
|
|||||||
if(!err_syslog_open)
|
if(!err_syslog_open)
|
||||||
os_opensyslog();
|
os_opensyslog();
|
||||||
os_syslog(1,"Error opening logfile");
|
os_syslog(1,"Error opening logfile");
|
||||||
|
|
||||||
result=FALSE;
|
result=FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +326,7 @@ extern int err_setdebugmask(char *list) {
|
|||||||
str=tmpstr=strdup(list);
|
str=tmpstr=strdup(list);
|
||||||
if(!str)
|
if(!str)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_err_lock();
|
_err_lock();
|
||||||
while(1) {
|
while(1) {
|
||||||
token=strtok_r(str,",",&last);
|
token=strtok_r(str,",",&last);
|
||||||
|
@ -57,6 +57,9 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ff-dbstruct.h"
|
#include "ff-dbstruct.h"
|
||||||
#include "ff-plugins.h"
|
#include "ff-plugins.h"
|
||||||
@ -560,7 +563,7 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) {
|
|||||||
if(daap_wantsmeta(pinfo->meta, metaSongArtist))
|
if(daap_wantsmeta(pinfo->meta, metaSongArtist))
|
||||||
/* asar */
|
/* asar */
|
||||||
size += DMAPLEN(valarray[SG_ARTIST]);
|
size += DMAPLEN(valarray[SG_ARTIST]);
|
||||||
if(valarray[SG_BPM] && atoi(valarray[SG_BPM]) &&
|
if(valarray[SG_BPM] && atoi(valarray[SG_BPM]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongBPM))
|
daap_wantsmeta(pinfo->meta, metaSongBPM))
|
||||||
/* asbt */
|
/* asbt */
|
||||||
size += 10;
|
size += 10;
|
||||||
@ -579,7 +582,7 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) {
|
|||||||
if(daap_wantsmeta(pinfo->meta, metaSongComment))
|
if(daap_wantsmeta(pinfo->meta, metaSongComment))
|
||||||
/* ascm */
|
/* ascm */
|
||||||
size += DMAPLEN(valarray[SG_COMMENT]);
|
size += DMAPLEN(valarray[SG_COMMENT]);
|
||||||
if(valarray[SG_COMPILATION] && atoi(valarray[SG_COMPILATION]) &&
|
if(valarray[SG_COMPILATION] && atoi(valarray[SG_COMPILATION]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongCompilation))
|
daap_wantsmeta(pinfo->meta,metaSongCompilation))
|
||||||
/* asco */
|
/* asco */
|
||||||
size += 9;
|
size += 9;
|
||||||
@ -589,7 +592,7 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) {
|
|||||||
if(daap_wantsmeta(pinfo->meta, metaSongGrouping))
|
if(daap_wantsmeta(pinfo->meta, metaSongGrouping))
|
||||||
/* agrp */
|
/* agrp */
|
||||||
size += DMAPLEN(valarray[SG_GROUPING]);
|
size += DMAPLEN(valarray[SG_GROUPING]);
|
||||||
if(valarray[SG_TIME_ADDED] && atoi(valarray[SG_TIME_ADDED]) &&
|
if(valarray[SG_TIME_ADDED] && atoi(valarray[SG_TIME_ADDED]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongDateAdded))
|
daap_wantsmeta(pinfo->meta, metaSongDateAdded))
|
||||||
/* asda */
|
/* asda */
|
||||||
size += 12;
|
size += 12;
|
||||||
@ -597,11 +600,11 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) {
|
|||||||
daap_wantsmeta(pinfo->meta,metaSongDateModified))
|
daap_wantsmeta(pinfo->meta,metaSongDateModified))
|
||||||
/* asdm */
|
/* asdm */
|
||||||
size += 12;
|
size += 12;
|
||||||
if(valarray[SG_TOTAL_DISCS] && atoi(valarray[SG_TOTAL_DISCS]) &&
|
if(valarray[SG_TOTAL_DISCS] && atoi(valarray[SG_TOTAL_DISCS]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongDiscCount))
|
daap_wantsmeta(pinfo->meta, metaSongDiscCount))
|
||||||
/* asdc */
|
/* asdc */
|
||||||
size += 10;
|
size += 10;
|
||||||
if(valarray[SG_DISC] && atoi(valarray[SG_DISC]) &&
|
if(valarray[SG_DISC] && atoi(valarray[SG_DISC]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongDiscNumber))
|
daap_wantsmeta(pinfo->meta, metaSongDiscNumber))
|
||||||
/* asdn */
|
/* asdn */
|
||||||
size += 10;
|
size += 10;
|
||||||
@ -630,15 +633,15 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) {
|
|||||||
if(daap_wantsmeta(pinfo->meta,metaItemName))
|
if(daap_wantsmeta(pinfo->meta,metaItemName))
|
||||||
/* minm */
|
/* minm */
|
||||||
size += DMAPLEN(valarray[SG_TITLE]);
|
size += DMAPLEN(valarray[SG_TITLE]);
|
||||||
if(valarray[SG_DISABLED] && atoi(valarray[SG_DISABLED]) &&
|
if(valarray[SG_DISABLED] && atoi(valarray[SG_DISABLED]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongDisabled))
|
daap_wantsmeta(pinfo->meta,metaSongDisabled))
|
||||||
/* asdb */
|
/* asdb */
|
||||||
size += 9;
|
size += 9;
|
||||||
if(valarray[SG_SAMPLERATE] && atoi(valarray[SG_SAMPLERATE]) &&
|
if(valarray[SG_SAMPLERATE] && atoi(valarray[SG_SAMPLERATE]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongSampleRate))
|
daap_wantsmeta(pinfo->meta,metaSongSampleRate))
|
||||||
/* assr */
|
/* assr */
|
||||||
size += 12;
|
size += 12;
|
||||||
if(valarray[SG_FILE_SIZE] && atoi(valarray[SG_FILE_SIZE]) &&
|
if(valarray[SG_FILE_SIZE] && atoi(valarray[SG_FILE_SIZE]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongSize))
|
daap_wantsmeta(pinfo->meta,metaSongSize))
|
||||||
/* assz */
|
/* assz */
|
||||||
size += 12;
|
size += 12;
|
||||||
@ -648,23 +651,23 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) {
|
|||||||
* is required, so I'm going to disabled it
|
* is required, so I'm going to disabled it
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(valarray[SG_SONG_LENGTH] && atoi(valarray[SG_SONG_LENGTH]) &&
|
if(valarray[SG_SONG_LENGTH] && atoi(valarray[SG_SONG_LENGTH]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongTime))
|
daap_wantsmeta(pinfo->meta, metaSongTime))
|
||||||
/* astm */
|
/* astm */
|
||||||
size += 12;
|
size += 12;
|
||||||
if(valarray[SG_TOTAL_TRACKS] && atoi(valarray[SG_TOTAL_TRACKS]) &&
|
if(valarray[SG_TOTAL_TRACKS] && atoi(valarray[SG_TOTAL_TRACKS]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongTrackCount))
|
daap_wantsmeta(pinfo->meta, metaSongTrackCount))
|
||||||
/* astc */
|
/* astc */
|
||||||
size += 10;
|
size += 10;
|
||||||
if(valarray[SG_TRACK] && atoi(valarray[SG_TRACK]) &&
|
if(valarray[SG_TRACK] && atoi(valarray[SG_TRACK]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongTrackNumber))
|
daap_wantsmeta(pinfo->meta, metaSongTrackNumber))
|
||||||
/* astn */
|
/* astn */
|
||||||
size += 10;
|
size += 10;
|
||||||
if(valarray[SG_RATING] && atoi(valarray[SG_RATING]) &&
|
if(valarray[SG_RATING] && atoi(valarray[SG_RATING]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongUserRating))
|
daap_wantsmeta(pinfo->meta, metaSongUserRating))
|
||||||
/* asur */
|
/* asur */
|
||||||
size += 9;
|
size += 9;
|
||||||
if(valarray[SG_YEAR] && atoi(valarray[SG_YEAR]) &&
|
if(valarray[SG_YEAR] && atoi(valarray[SG_YEAR]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongYear))
|
daap_wantsmeta(pinfo->meta, metaSongYear))
|
||||||
/* asyr */
|
/* asyr */
|
||||||
size += 10;
|
size += 10;
|
||||||
@ -672,8 +675,8 @@ int daap_get_size(PRIVINFO *pinfo, char **valarray) {
|
|||||||
/* mcti */
|
/* mcti */
|
||||||
size += 12;
|
size += 12;
|
||||||
/* FIXME: This is not right - doesn't have to be 4 */
|
/* FIXME: This is not right - doesn't have to be 4 */
|
||||||
if((valarray[SG_CODECTYPE]) && (strlen(valarray[SG_CODECTYPE])==4) &&
|
if((valarray[SG_CODECTYPE]) && (strlen(valarray[SG_CODECTYPE])==4) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongCodecType))
|
daap_wantsmeta(pinfo->meta,metaSongCodecType))
|
||||||
/* ascd */
|
/* ascd */
|
||||||
size += 12;
|
size += 12;
|
||||||
if(daap_wantsmeta(pinfo->meta,metaSongContentRating))
|
if(daap_wantsmeta(pinfo->meta,metaSongContentRating))
|
||||||
@ -748,10 +751,10 @@ int daap_build_dmap(PRIVINFO *pinfo, char **valarray, unsigned char *presult, in
|
|||||||
if(valarray[23] && atoi(valarray[23]) && daap_wantsmeta(pinfo->meta, metaSongBPM))
|
if(valarray[23] && atoi(valarray[23]) && daap_wantsmeta(pinfo->meta, metaSongBPM))
|
||||||
current += dmap_add_short(current,"asbt",
|
current += dmap_add_short(current,"asbt",
|
||||||
(short)atoi(valarray[SG_BPM]));
|
(short)atoi(valarray[SG_BPM]));
|
||||||
if(valarray[SG_BITRATE] && atoi(valarray[SG_BITRATE]) &&
|
if(valarray[SG_BITRATE] && atoi(valarray[SG_BITRATE]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongBitRate)) {
|
daap_wantsmeta(pinfo->meta, metaSongBitRate)) {
|
||||||
if(transcode) {
|
if(transcode) {
|
||||||
if(valarray[SG_SAMPLERATE])
|
if(valarray[SG_SAMPLERATE])
|
||||||
samplerate=atoi(valarray[SG_SAMPLERATE]);
|
samplerate=atoi(valarray[SG_SAMPLERATE]);
|
||||||
if(samplerate) {
|
if(samplerate) {
|
||||||
current += dmap_add_short(current,"asbr",
|
current += dmap_add_short(current,"asbr",
|
||||||
@ -762,45 +765,45 @@ int daap_build_dmap(PRIVINFO *pinfo, char **valarray, unsigned char *presult, in
|
|||||||
(short)atoi(valarray[SG_BITRATE]));
|
(short)atoi(valarray[SG_BITRATE]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(EMIT(valarray[SG_COMMENT]) &&
|
if(EMIT(valarray[SG_COMMENT]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongComment))
|
daap_wantsmeta(pinfo->meta, metaSongComment))
|
||||||
current += dmap_add_string(current,"ascm",valarray[SG_COMMENT]);
|
current += dmap_add_string(current,"ascm",valarray[SG_COMMENT]);
|
||||||
|
|
||||||
if(valarray[SG_COMPILATION] && atoi(valarray[SG_COMPILATION]) &&
|
if(valarray[SG_COMPILATION] && atoi(valarray[SG_COMPILATION]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongCompilation))
|
daap_wantsmeta(pinfo->meta,metaSongCompilation))
|
||||||
current += dmap_add_char(current,"asco",
|
current += dmap_add_char(current,"asco",
|
||||||
(char)atoi(valarray[SG_COMPILATION]));
|
(char)atoi(valarray[SG_COMPILATION]));
|
||||||
|
|
||||||
if(EMIT(valarray[SG_COMPOSER]) &&
|
if(EMIT(valarray[SG_COMPOSER]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongComposer))
|
daap_wantsmeta(pinfo->meta, metaSongComposer))
|
||||||
current += dmap_add_string(current,"ascp",
|
current += dmap_add_string(current,"ascp",
|
||||||
valarray[SG_COMPOSER]);
|
valarray[SG_COMPOSER]);
|
||||||
|
|
||||||
if(EMIT(valarray[SG_GROUPING]) &&
|
if(EMIT(valarray[SG_GROUPING]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongGrouping))
|
daap_wantsmeta(pinfo->meta, metaSongGrouping))
|
||||||
current += dmap_add_string(current,"agrp",
|
current += dmap_add_string(current,"agrp",
|
||||||
valarray[SG_GROUPING]);
|
valarray[SG_GROUPING]);
|
||||||
|
|
||||||
if(valarray[SG_TIME_ADDED] && atoi(valarray[SG_TIME_ADDED]) &&
|
if(valarray[SG_TIME_ADDED] && atoi(valarray[SG_TIME_ADDED]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongDateAdded))
|
daap_wantsmeta(pinfo->meta, metaSongDateAdded))
|
||||||
current += dmap_add_int(current,"asda",
|
current += dmap_add_int(current,"asda",
|
||||||
(int)atoi(valarray[SG_TIME_ADDED]));
|
(int)atoi(valarray[SG_TIME_ADDED]));
|
||||||
|
|
||||||
if(valarray[SG_TIME_MODIFIED] && atoi(valarray[SG_TIME_MODIFIED]) &&
|
if(valarray[SG_TIME_MODIFIED] && atoi(valarray[SG_TIME_MODIFIED]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongDateModified))
|
daap_wantsmeta(pinfo->meta,metaSongDateModified))
|
||||||
current += dmap_add_int(current,"asdm",
|
current += dmap_add_int(current,"asdm",
|
||||||
(int)atoi(valarray[SG_TIME_MODIFIED]));
|
(int)atoi(valarray[SG_TIME_MODIFIED]));
|
||||||
|
|
||||||
if(valarray[SG_TOTAL_DISCS] && atoi(valarray[SG_TOTAL_DISCS]) &&
|
if(valarray[SG_TOTAL_DISCS] && atoi(valarray[SG_TOTAL_DISCS]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongDiscCount))
|
daap_wantsmeta(pinfo->meta, metaSongDiscCount))
|
||||||
current += dmap_add_short(current,"asdc",
|
current += dmap_add_short(current,"asdc",
|
||||||
(short)atoi(valarray[SG_TOTAL_DISCS]));
|
(short)atoi(valarray[SG_TOTAL_DISCS]));
|
||||||
if(valarray[SG_DISC] && atoi(valarray[SG_DISC]) &&
|
if(valarray[SG_DISC] && atoi(valarray[SG_DISC]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongDiscNumber))
|
daap_wantsmeta(pinfo->meta, metaSongDiscNumber))
|
||||||
current += dmap_add_short(current,"asdn",
|
current += dmap_add_short(current,"asdn",
|
||||||
(short)atoi(valarray[SG_DISC]));
|
(short)atoi(valarray[SG_DISC]));
|
||||||
|
|
||||||
if(EMIT(valarray[SG_GENRE]) &&
|
if(EMIT(valarray[SG_GENRE]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongGenre))
|
daap_wantsmeta(pinfo->meta, metaSongGenre))
|
||||||
current += dmap_add_string(current,"asgn",valarray[SG_GENRE]);
|
current += dmap_add_string(current,"asgn",valarray[SG_GENRE]);
|
||||||
|
|
||||||
@ -808,7 +811,7 @@ int daap_build_dmap(PRIVINFO *pinfo, char **valarray, unsigned char *presult, in
|
|||||||
current += dmap_add_int(current,"miid",
|
current += dmap_add_int(current,"miid",
|
||||||
(int)atoi(valarray[SG_ID]));
|
(int)atoi(valarray[SG_ID]));
|
||||||
|
|
||||||
if(EMIT(valarray[SG_TYPE]) &&
|
if(EMIT(valarray[SG_TYPE]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongFormat)) {
|
daap_wantsmeta(pinfo->meta,metaSongFormat)) {
|
||||||
if(transcode) {
|
if(transcode) {
|
||||||
current += dmap_add_string(current,"asfm","wav");
|
current += dmap_add_string(current,"asfm","wav");
|
||||||
@ -818,7 +821,7 @@ int daap_build_dmap(PRIVINFO *pinfo, char **valarray, unsigned char *presult, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(EMIT(valarray[SG_DESCRIPTION]) &&
|
if(EMIT(valarray[SG_DESCRIPTION]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongDescription)) {
|
daap_wantsmeta(pinfo->meta,metaSongDescription)) {
|
||||||
if(transcode) {
|
if(transcode) {
|
||||||
current += dmap_add_string(current,"asdt","wav audio file");
|
current += dmap_add_string(current,"asdt","wav audio file");
|
||||||
@ -827,46 +830,46 @@ int daap_build_dmap(PRIVINFO *pinfo, char **valarray, unsigned char *presult, in
|
|||||||
valarray[SG_DESCRIPTION]);
|
valarray[SG_DESCRIPTION]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(EMIT(valarray[SG_TITLE]) &&
|
if(EMIT(valarray[SG_TITLE]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaItemName))
|
daap_wantsmeta(pinfo->meta,metaItemName))
|
||||||
current += dmap_add_string(current,"minm",valarray[SG_TITLE]);
|
current += dmap_add_string(current,"minm",valarray[SG_TITLE]);
|
||||||
|
|
||||||
if(valarray[SG_DISABLED] && atoi(valarray[SG_DISABLED]) &&
|
if(valarray[SG_DISABLED] && atoi(valarray[SG_DISABLED]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongDisabled))
|
daap_wantsmeta(pinfo->meta,metaSongDisabled))
|
||||||
current += dmap_add_char(current,"asdb",
|
current += dmap_add_char(current,"asdb",
|
||||||
(char)atoi(valarray[SG_DISABLED]));
|
(char)atoi(valarray[SG_DISABLED]));
|
||||||
|
|
||||||
if(valarray[SG_SAMPLERATE] && atoi(valarray[SG_SAMPLERATE]) &&
|
if(valarray[SG_SAMPLERATE] && atoi(valarray[SG_SAMPLERATE]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongSampleRate))
|
daap_wantsmeta(pinfo->meta,metaSongSampleRate))
|
||||||
current += dmap_add_int(current,"assr",
|
current += dmap_add_int(current,"assr",
|
||||||
atoi(valarray[SG_SAMPLERATE]));
|
atoi(valarray[SG_SAMPLERATE]));
|
||||||
|
|
||||||
if(valarray[SG_FILE_SIZE] && atoi(valarray[SG_FILE_SIZE]) &&
|
if(valarray[SG_FILE_SIZE] && atoi(valarray[SG_FILE_SIZE]) &&
|
||||||
daap_wantsmeta(pinfo->meta,metaSongSize))
|
daap_wantsmeta(pinfo->meta,metaSongSize))
|
||||||
current += dmap_add_int(current,"assz",
|
current += dmap_add_int(current,"assz",
|
||||||
atoi(valarray[SG_FILE_SIZE]));
|
atoi(valarray[SG_FILE_SIZE]));
|
||||||
|
|
||||||
if(valarray[SG_SONG_LENGTH] && atoi(valarray[SG_SONG_LENGTH]) &&
|
if(valarray[SG_SONG_LENGTH] && atoi(valarray[SG_SONG_LENGTH]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongTime))
|
daap_wantsmeta(pinfo->meta, metaSongTime))
|
||||||
current += dmap_add_int(current,"astm",
|
current += dmap_add_int(current,"astm",
|
||||||
atoi(valarray[SG_SONG_LENGTH]));
|
atoi(valarray[SG_SONG_LENGTH]));
|
||||||
|
|
||||||
if(valarray[SG_TOTAL_TRACKS] && atoi(valarray[SG_TOTAL_TRACKS]) &&
|
if(valarray[SG_TOTAL_TRACKS] && atoi(valarray[SG_TOTAL_TRACKS]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongTrackCount))
|
daap_wantsmeta(pinfo->meta, metaSongTrackCount))
|
||||||
current += dmap_add_short(current,"astc",
|
current += dmap_add_short(current,"astc",
|
||||||
(short)atoi(valarray[SG_TOTAL_TRACKS]));
|
(short)atoi(valarray[SG_TOTAL_TRACKS]));
|
||||||
|
|
||||||
if(valarray[SG_TRACK] && atoi(valarray[SG_TRACK]) &&
|
if(valarray[SG_TRACK] && atoi(valarray[SG_TRACK]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongTrackNumber))
|
daap_wantsmeta(pinfo->meta, metaSongTrackNumber))
|
||||||
current += dmap_add_short(current,"astn",
|
current += dmap_add_short(current,"astn",
|
||||||
(short)atoi(valarray[SG_TRACK]));
|
(short)atoi(valarray[SG_TRACK]));
|
||||||
|
|
||||||
if(valarray[SG_RATING] && atoi(valarray[SG_RATING]) &&
|
if(valarray[SG_RATING] && atoi(valarray[SG_RATING]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongUserRating))
|
daap_wantsmeta(pinfo->meta, metaSongUserRating))
|
||||||
current += dmap_add_char(current,"asur",
|
current += dmap_add_char(current,"asur",
|
||||||
(char)atoi(valarray[SG_RATING]));
|
(char)atoi(valarray[SG_RATING]));
|
||||||
|
|
||||||
if(valarray[SG_YEAR] && atoi(valarray[SG_YEAR]) &&
|
if(valarray[SG_YEAR] && atoi(valarray[SG_YEAR]) &&
|
||||||
daap_wantsmeta(pinfo->meta, metaSongYear))
|
daap_wantsmeta(pinfo->meta, metaSongYear))
|
||||||
current += dmap_add_short(current,"asyr",
|
current += dmap_add_short(current,"asyr",
|
||||||
(short)atoi(valarray[SG_YEAR]));
|
(short)atoi(valarray[SG_YEAR]));
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -42,7 +46,7 @@ PLUGIN_REND_INFO _pri[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PLUGIN_INPUT_FN *_ppi;
|
PLUGIN_INPUT_FN *_ppi;
|
||||||
PLUGIN_INFO _pi = {
|
PLUGIN_INFO _pi = {
|
||||||
PLUGIN_VERSION, /* version */
|
PLUGIN_VERSION, /* version */
|
||||||
PLUGIN_OUTPUT, /* type */
|
PLUGIN_OUTPUT, /* type */
|
||||||
"rsp/" VERSION, /* server */
|
"rsp/" VERSION, /* server */
|
||||||
@ -57,7 +61,7 @@ typedef struct tag_response {
|
|||||||
char *uri[10];
|
char *uri[10];
|
||||||
void (*dispatch)(WS_CONNINFO *, PRIVINFO *);
|
void (*dispatch)(WS_CONNINFO *, PRIVINFO *);
|
||||||
} PLUGIN_RESPONSE;
|
} PLUGIN_RESPONSE;
|
||||||
|
|
||||||
|
|
||||||
PLUGIN_RESPONSE rsp_uri_map[] = {
|
PLUGIN_RESPONSE rsp_uri_map[] = {
|
||||||
{{"rsp", "info",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }, rsp_info },
|
{{"rsp", "info",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }, rsp_info },
|
||||||
@ -203,7 +207,7 @@ void plugin_handler(WS_CONNINFO *pwsc) {
|
|||||||
|
|
||||||
string = _ppi->ws_uri(pwsc);
|
string = _ppi->ws_uri(pwsc);
|
||||||
string++;
|
string++;
|
||||||
|
|
||||||
_ppi->log(E_DBG,"Mallocing privinfo...\n");
|
_ppi->log(E_DBG,"Mallocing privinfo...\n");
|
||||||
ppi = (PRIVINFO *)malloc(sizeof(PRIVINFO));
|
ppi = (PRIVINFO *)malloc(sizeof(PRIVINFO));
|
||||||
if(ppi) {
|
if(ppi) {
|
||||||
@ -239,7 +243,7 @@ void plugin_handler(WS_CONNINFO *pwsc) {
|
|||||||
if((ppi->uri_sections[part]) && (!rsp_uri_map[index].uri[part]))
|
if((ppi->uri_sections[part]) && (!rsp_uri_map[index].uri[part]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if((rsp_uri_map[index].uri[part]) &&
|
if((rsp_uri_map[index].uri[part]) &&
|
||||||
(strcmp(rsp_uri_map[index].uri[part],"*") != 0)) {
|
(strcmp(rsp_uri_map[index].uri[part],"*") != 0)) {
|
||||||
if(strcmp(rsp_uri_map[index].uri[part],
|
if(strcmp(rsp_uri_map[index].uri[part],
|
||||||
ppi->uri_sections[part])!= 0)
|
ppi->uri_sections[part])!= 0)
|
||||||
@ -270,7 +274,7 @@ void plugin_handler(WS_CONNINFO *pwsc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get server info
|
* get server info
|
||||||
*/
|
*/
|
||||||
void rsp_info(WS_CONNINFO *pwsc, PRIVINFO *ppi) {
|
void rsp_info(WS_CONNINFO *pwsc, PRIVINFO *ppi) {
|
||||||
XMLSTRUCT *pxml;
|
XMLSTRUCT *pxml;
|
||||||
@ -308,7 +312,7 @@ void rsp_info(WS_CONNINFO *pwsc, PRIVINFO *ppi) {
|
|||||||
/**
|
/**
|
||||||
* /rsp/db
|
* /rsp/db
|
||||||
*
|
*
|
||||||
* dump details about all playlists
|
* dump details about all playlists
|
||||||
*/
|
*/
|
||||||
void rsp_db(WS_CONNINFO *pwsc, PRIVINFO *ppi) {
|
void rsp_db(WS_CONNINFO *pwsc, PRIVINFO *ppi) {
|
||||||
XMLSTRUCT *pxml;
|
XMLSTRUCT *pxml;
|
||||||
@ -384,7 +388,7 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) {
|
|||||||
if(_ppi->ws_getvar(pwsc,"limit")) {
|
if(_ppi->ws_getvar(pwsc,"limit")) {
|
||||||
ppi->dq.limit = atoi(_ppi->ws_getvar(pwsc,"limit"));
|
ppi->dq.limit = atoi(_ppi->ws_getvar(pwsc,"limit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
browse_type = _ppi->ws_getvar(pwsc,"type");
|
browse_type = _ppi->ws_getvar(pwsc,"type");
|
||||||
type = F_FULL;
|
type = F_FULL;
|
||||||
|
|
||||||
@ -414,7 +418,7 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) {
|
|||||||
returned = 0;
|
returned = 0;
|
||||||
} else {
|
} else {
|
||||||
returned = ppi->dq.limit;
|
returned = ppi->dq.limit;
|
||||||
if(returned > (ppi->dq.totalcount - ppi->dq.offset))
|
if(returned > (ppi->dq.totalcount - ppi->dq.offset))
|
||||||
returned = ppi->dq.totalcount - ppi->dq.offset;
|
returned = ppi->dq.totalcount - ppi->dq.offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +432,7 @@ void rsp_playlist(WS_CONNINFO *pwsc, PRIVINFO *ppi) {
|
|||||||
|
|
||||||
xml_push(pxml,"items");
|
xml_push(pxml,"items");
|
||||||
|
|
||||||
while((!done) && (_ppi->db_enum_fetch_row(NULL,&row,&ppi->dq) == 0) &&
|
while((!done) && (_ppi->db_enum_fetch_row(NULL,&row,&ppi->dq) == 0) &&
|
||||||
(row)) {
|
(row)) {
|
||||||
xml_push(pxml,"item");
|
xml_push(pxml,"item");
|
||||||
rowindex=0;
|
rowindex=0;
|
||||||
@ -505,7 +509,7 @@ void rsp_browse(WS_CONNINFO *pwsc, PRIVINFO *ppi) {
|
|||||||
if(_ppi->ws_getvar(pwsc,"offset")) {
|
if(_ppi->ws_getvar(pwsc,"offset")) {
|
||||||
ppi->dq.offset = atoi(_ppi->ws_getvar(pwsc,"offset"));
|
ppi->dq.offset = atoi(_ppi->ws_getvar(pwsc,"offset"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_ppi->ws_getvar(pwsc,"limit")) {
|
if(_ppi->ws_getvar(pwsc,"limit")) {
|
||||||
ppi->dq.limit = atoi(_ppi->ws_getvar(pwsc,"limit"));
|
ppi->dq.limit = atoi(_ppi->ws_getvar(pwsc,"limit"));
|
||||||
}
|
}
|
||||||
@ -524,7 +528,7 @@ void rsp_browse(WS_CONNINFO *pwsc, PRIVINFO *ppi) {
|
|||||||
returned = 0;
|
returned = 0;
|
||||||
} else {
|
} else {
|
||||||
returned = ppi->dq.limit;
|
returned = ppi->dq.limit;
|
||||||
if(returned > (ppi->dq.totalcount - ppi->dq.offset))
|
if(returned > (ppi->dq.totalcount - ppi->dq.offset))
|
||||||
returned = ppi->dq.totalcount - ppi->dq.offset;
|
returned = ppi->dq.totalcount - ppi->dq.offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -85,12 +89,12 @@ PLUGIN_INFO *plugin_info(PLUGIN_INPUT_FN *ppi) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get a new transcode handle
|
* get a new transcode handle
|
||||||
*/
|
*/
|
||||||
void *ssc_script_init(void) {
|
void *ssc_script_init(void) {
|
||||||
SSCHANDLE *handle;
|
SSCHANDLE *handle;
|
||||||
|
|
||||||
handle = (SSCHANDLE*)malloc(sizeof(SSCHANDLE));
|
handle = (SSCHANDLE*)malloc(sizeof(SSCHANDLE));
|
||||||
if(handle) {
|
if(handle) {
|
||||||
memset(handle,0,sizeof(SSCHANDLE));
|
memset(handle,0,sizeof(SSCHANDLE));
|
||||||
@ -109,7 +113,7 @@ char *ssc_script_error(void *vp) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* dispose of the transocde handle obtained from init
|
* dispose of the transocde handle obtained from init
|
||||||
*
|
*
|
||||||
* @param pv handle to dispose
|
* @param pv handle to dispose
|
||||||
*/
|
*/
|
||||||
void ssc_script_deinit(void *vp) {
|
void ssc_script_deinit(void *vp) {
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -152,7 +156,7 @@ int xml_stream_write(XMLSTRUCT *pxml, char *out) {
|
|||||||
psb->strm.avail_out = XML_STREAM_BLOCK;
|
psb->strm.avail_out = XML_STREAM_BLOCK;
|
||||||
psb->strm.next_out = psb->out_buffer;
|
psb->strm.next_out = psb->out_buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +173,7 @@ int xml_stream_close(XMLSTRUCT *pxml) {
|
|||||||
psb->strm.next_out = psb->out_buffer;
|
psb->strm.next_out = psb->out_buffer;
|
||||||
psb->strm.avail_in = 0;
|
psb->strm.avail_in = 0;
|
||||||
psb->strm.next_in = psb->in_buffer;
|
psb->strm.next_in = psb->in_buffer;
|
||||||
|
|
||||||
deflate(&psb->strm,Z_FINISH);
|
deflate(&psb->strm,Z_FINISH);
|
||||||
_ppi->ws_writebinary(pxml->pwsc,(char*)psb->out_buffer,
|
_ppi->ws_writebinary(pxml->pwsc,(char*)psb->out_buffer,
|
||||||
XML_STREAM_BLOCK - psb->strm.avail_out);
|
XML_STREAM_BLOCK - psb->strm.avail_out);
|
||||||
@ -331,7 +335,7 @@ void xml_deinit(XMLSTRUCT *pxml) {
|
|||||||
free(pstack->tag);
|
free(pstack->tag);
|
||||||
free(pstack);
|
free(pstack);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pxml->psb) {
|
if(pxml->psb) {
|
||||||
xml_stream_close(pxml);
|
xml_stream_close(pxml);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,9 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <id3tag.h>
|
#include <id3tag.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -57,7 +60,7 @@
|
|||||||
NULL)
|
NULL)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* scan a flac file for metainfo.
|
* scan a flac file for metainfo.
|
||||||
*
|
*
|
||||||
* @param filename file to read metainfo for
|
* @param filename file to read metainfo for
|
||||||
* @param pmp3 MP3FILE structure to fill
|
* @param pmp3 MP3FILE structure to fill
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <id3tag.h>
|
#include <id3tag.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -306,7 +309,7 @@ int scan_mp3_get_mp3tags(char *file, MP3FILE *pmp3) {
|
|||||||
DPRINTF(E_WARN,L_SCAN,"Cannot open %s\n",file);
|
DPRINTF(E_WARN,L_SCAN,"Cannot open %s\n",file);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pid3file=id3_file_fdopen(mp3_fd,ID3_FILE_MODE_READONLY);
|
pid3file=id3_file_fdopen(mp3_fd,ID3_FILE_MODE_READONLY);
|
||||||
if(!pid3file) {
|
if(!pid3file) {
|
||||||
DPRINTF(E_WARN,L_SCAN,"Cannot open %s\n",file);
|
DPRINTF(E_WARN,L_SCAN,"Cannot open %s\n",file);
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -32,7 +35,7 @@
|
|||||||
#include "err.h"
|
#include "err.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* scan a musepack file for metainfo.
|
* scan a musepack file for metainfo.
|
||||||
*
|
*
|
||||||
* @param filename file to read metainfo for
|
* @param filename file to read metainfo for
|
||||||
* @param pmp3 MP3FILE structure to fill
|
* @param pmp3 MP3FILE structure to fill
|
||||||
@ -108,8 +111,8 @@ int scan_get_mpcinfo(char *filename, MP3FILE *pmp3) {
|
|||||||
pmp3->song_length = taglib_audioproperties_length(properties) * 1000;
|
pmp3->song_length = taglib_audioproperties_length(properties) * 1000;
|
||||||
pmp3->bitrate = taglib_audioproperties_bitrate(properties);
|
pmp3->bitrate = taglib_audioproperties_bitrate(properties);
|
||||||
pmp3->samplerate = taglib_audioproperties_samplerate(properties);
|
pmp3->samplerate = taglib_audioproperties_samplerate(properties);
|
||||||
|
|
||||||
taglib_file_free(file);
|
taglib_file_free(file);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Copyright (C) 2003 Ron Pedde (ron@pedde.com)
|
* Copyright (C) 2003 Ron Pedde (ron@pedde.com)
|
||||||
@ -23,6 +23,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -34,7 +37,7 @@
|
|||||||
* Get info from a "url" file -- a media stream file.
|
* Get info from a "url" file -- a media stream file.
|
||||||
* This should really get more metainfo, but I'll leave that
|
* This should really get more metainfo, but I'll leave that
|
||||||
* to later.
|
* to later.
|
||||||
*
|
*
|
||||||
* @param filename .url file to process
|
* @param filename .url file to process
|
||||||
* @param pmp3 MP3FILE structure that must be filled
|
* @param pmp3 MP3FILE structure that must be filled
|
||||||
* @returns TRUE if file should be added to db, FALSE otherwise
|
* @returns TRUE if file should be added to db, FALSE otherwise
|
||||||
@ -75,7 +78,7 @@ int scan_get_urlinfo(char *filename, MP3FILE *pmp3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
*tail++='\0';
|
*tail++='\0';
|
||||||
|
|
||||||
pmp3->title=strdup(head);
|
pmp3->title=strdup(head);
|
||||||
pmp3->url=strdup(tail);
|
pmp3->url=strdup(tail);
|
||||||
fclose(infile);
|
fclose(infile);
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -235,8 +238,8 @@ typedef struct tag_wma_header {
|
|||||||
char reserved1;
|
char reserved1;
|
||||||
char reserved2;
|
char reserved2;
|
||||||
} _PACKED WMA_HEADER;
|
} _PACKED WMA_HEADER;
|
||||||
|
|
||||||
|
|
||||||
typedef struct tag_wma_subheader {
|
typedef struct tag_wma_subheader {
|
||||||
unsigned char objectid[16];
|
unsigned char objectid[16];
|
||||||
long long size;
|
long long size;
|
||||||
@ -262,7 +265,7 @@ typedef struct tag_wma_header_extension {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Forwards
|
* Forwards
|
||||||
*/
|
*/
|
||||||
WMA_GUID *wma_find_guid(unsigned char *guid);
|
WMA_GUID *wma_find_guid(unsigned char *guid);
|
||||||
unsigned short int wma_convert_short(unsigned char *src);
|
unsigned short int wma_convert_short(unsigned char *src);
|
||||||
unsigned int wma_convert_int(unsigned char *src);
|
unsigned int wma_convert_int(unsigned char *src);
|
||||||
@ -322,7 +325,7 @@ int wma_file_read_utf16(int fd, int len, char **utf8) {
|
|||||||
if(!utf16)
|
if(!utf16)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(r_read(fd,utf16,len) != len)
|
if(r_read(fd,utf16,len) != len)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out = wma_utf16toutf8(utf16,len);
|
out = wma_utf16toutf8(utf16,len);
|
||||||
@ -417,7 +420,7 @@ int wma_parse_stream_properties(int fd, int size, MP3FILE *pmp3) {
|
|||||||
if(!pguid)
|
if(!pguid)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if(strcmp(pguid->name,"ASF_Audio_Media") != 0)
|
if(strcmp(pguid->name,"ASF_Audio_Media") != 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* it is an audio stream... find codec. The Type-Specific
|
/* it is an audio stream... find codec. The Type-Specific
|
||||||
@ -428,7 +431,7 @@ int wma_parse_stream_properties(int fd, int size, MP3FILE *pmp3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parse the audio media section... This is essentially a
|
* parse the audio media section... This is essentially a
|
||||||
* WAVFORMATEX structure. Generally we only care about the
|
* WAVFORMATEX structure. Generally we only care about the
|
||||||
* codec type.
|
* codec type.
|
||||||
*
|
*
|
||||||
@ -514,9 +517,9 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3, int e
|
|||||||
DPRINTF(E_DBG,L_SCAN,"Reading descr %d of %d\n",index,descriptor_count);
|
DPRINTF(E_DBG,L_SCAN,"Reading descr %d of %d\n",index,descriptor_count);
|
||||||
if(!extended) {
|
if(!extended) {
|
||||||
if(!wma_file_read_short(fd,&descriptor_name_len)) return FALSE;
|
if(!wma_file_read_short(fd,&descriptor_name_len)) return FALSE;
|
||||||
if(!wma_file_read_utf16(fd,descriptor_name_len,&descriptor_name))
|
if(!wma_file_read_utf16(fd,descriptor_name_len,&descriptor_name))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if(!wma_file_read_short(fd,&descriptor_value_type)) {
|
if(!wma_file_read_short(fd,&descriptor_value_type)) {
|
||||||
free(descriptor_name);
|
free(descriptor_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -531,7 +534,7 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3, int e
|
|||||||
if(!wma_file_read_short(fd,&descriptor_name_len)) return FALSE;
|
if(!wma_file_read_short(fd,&descriptor_name_len)) return FALSE;
|
||||||
if(!wma_file_read_short(fd,&descriptor_value_type)) return FALSE;
|
if(!wma_file_read_short(fd,&descriptor_value_type)) return FALSE;
|
||||||
if(!wma_file_read_int(fd,&descriptor_value_int)) return FALSE;
|
if(!wma_file_read_int(fd,&descriptor_value_int)) return FALSE;
|
||||||
if(!wma_file_read_utf16(fd,descriptor_name_len,&descriptor_name))
|
if(!wma_file_read_utf16(fd,descriptor_name_len,&descriptor_name))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +634,7 @@ int wma_parse_extended_content_description(int fd,int size, MP3FILE *pmp3, int e
|
|||||||
pmp3->composer = descriptor_byte_value;
|
pmp3->composer = descriptor_byte_value;
|
||||||
descriptor_byte_value = NULL;
|
descriptor_byte_value = NULL;
|
||||||
} else {
|
} else {
|
||||||
size = (int)strlen(pmp3->composer) + 1 +
|
size = (int)strlen(pmp3->composer) + 1 +
|
||||||
(int)strlen(descriptor_byte_value) + 1;
|
(int)strlen(descriptor_byte_value) + 1;
|
||||||
tmp = malloc(size);
|
tmp = malloc(size);
|
||||||
if(!tmp)
|
if(!tmp)
|
||||||
@ -716,7 +719,7 @@ int wma_parse_content_description(int fd,int size, MP3FILE *pmp3) {
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
DPRINTF(E_DBG,L_SCAN,"Got item of length %d: %s\n",sizes[index],utf8);
|
DPRINTF(E_DBG,L_SCAN,"Got item of length %d: %s\n",sizes[index],utf8);
|
||||||
|
|
||||||
switch(index) {
|
switch(index) {
|
||||||
case 0: /* title */
|
case 0: /* title */
|
||||||
if(pmp3->title)
|
if(pmp3->title)
|
||||||
@ -729,7 +732,7 @@ int wma_parse_content_description(int fd,int size, MP3FILE *pmp3) {
|
|||||||
pmp3->artist = utf8;
|
pmp3->artist = utf8;
|
||||||
break;
|
break;
|
||||||
case 2: /* copyright - dontcare */
|
case 2: /* copyright - dontcare */
|
||||||
free(utf8);
|
free(utf8);
|
||||||
break;
|
break;
|
||||||
case 3: /* description */
|
case 3: /* description */
|
||||||
if(pmp3->comment)
|
if(pmp3->comment)
|
||||||
@ -761,11 +764,11 @@ int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) {
|
|||||||
unsigned long long play_duration;
|
unsigned long long play_duration;
|
||||||
unsigned long long send_duration;
|
unsigned long long send_duration;
|
||||||
unsigned long long preroll;
|
unsigned long long preroll;
|
||||||
|
|
||||||
unsigned int max_bitrate;
|
unsigned int max_bitrate;
|
||||||
|
|
||||||
/* skip guid (16 bytes), filesize (8), creation time (8),
|
/* skip guid (16 bytes), filesize (8), creation time (8),
|
||||||
* data packets (8)
|
* data packets (8)
|
||||||
*/
|
*/
|
||||||
lseek(fd,40,SEEK_CUR);
|
lseek(fd,40,SEEK_CUR);
|
||||||
|
|
||||||
@ -787,7 +790,7 @@ int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) {
|
|||||||
* length.
|
* length.
|
||||||
*/
|
*/
|
||||||
pmp3->song_length = (int)((play_duration / 10000) - preroll);
|
pmp3->song_length = (int)((play_duration / 10000) - preroll);
|
||||||
|
|
||||||
/* skip flags(4),
|
/* skip flags(4),
|
||||||
* min_packet_size (4), max_packet_size(4)
|
* min_packet_size (4), max_packet_size(4)
|
||||||
*/
|
*/
|
||||||
@ -805,7 +808,7 @@ int wma_parse_file_properties(int fd,int size, MP3FILE *pmp3) {
|
|||||||
* convert utf16 string to utf8. This is a bit naive, but...
|
* convert utf16 string to utf8. This is a bit naive, but...
|
||||||
* Since utf-8 can't expand past 4 bytes per code point, and
|
* Since utf-8 can't expand past 4 bytes per code point, and
|
||||||
* we're converting utf-16, we can't be more than 2n+1 bytes, so
|
* we're converting utf-16, we can't be more than 2n+1 bytes, so
|
||||||
* we'll just allocate that much.
|
* we'll just allocate that much.
|
||||||
*
|
*
|
||||||
* Probably it could be more efficiently calculated, but this will
|
* Probably it could be more efficiently calculated, but this will
|
||||||
* always work. Besides, these are small strings, and will be freed
|
* always work. Besides, these are small strings, and will be freed
|
||||||
@ -964,7 +967,7 @@ int scan_get_wmainfo(char *filename, MP3FILE *pmp3) {
|
|||||||
int err;
|
int err;
|
||||||
int res=TRUE;
|
int res=TRUE;
|
||||||
int encrypted = 0;
|
int encrypted = 0;
|
||||||
|
|
||||||
wma_fd = r_open2(filename,O_RDONLY);
|
wma_fd = r_open2(filename,O_RDONLY);
|
||||||
if(wma_fd == -1) {
|
if(wma_fd == -1) {
|
||||||
DPRINTF(E_INF,L_SCAN,"Error opening WMA file (%s): %s\n",filename,
|
DPRINTF(E_INF,L_SCAN,"Error opening WMA file (%s): %s\n",filename,
|
||||||
@ -998,7 +1001,7 @@ int scan_get_wmainfo(char *filename, MP3FILE *pmp3) {
|
|||||||
/* Now we just walk through all the headers and see if we
|
/* Now we just walk through all the headers and see if we
|
||||||
* find anything interesting
|
* find anything interesting
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for(item=0; item < (int) hdr.objects; item++) {
|
for(item=0; item < (int) hdr.objects; item++) {
|
||||||
if(lseek(wma_fd,offset,SEEK_SET) == (off_t)-1) {
|
if(lseek(wma_fd,offset,SEEK_SET) == (off_t)-1) {
|
||||||
DPRINTF(E_INF,L_SCAN,"Error seeking in %s\n",filename);
|
DPRINTF(E_INF,L_SCAN,"Error seeking in %s\n",filename);
|
||||||
@ -1061,7 +1064,7 @@ int scan_get_wmainfo(char *filename, MP3FILE *pmp3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
r_close(wma_fd);
|
r_close(wma_fd);
|
||||||
|
|
||||||
|
|
||||||
if(encrypted) {
|
if(encrypted) {
|
||||||
if(pmp3->codectype)
|
if(pmp3->codectype)
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -220,7 +223,7 @@ int scan_xml_translate_path(char *pold, char *pnew) {
|
|||||||
ptemp++;
|
ptemp++;
|
||||||
}
|
}
|
||||||
strcpy(working_path,pold);
|
strcpy(working_path,pold);
|
||||||
|
|
||||||
if(!path_found) {
|
if(!path_found) {
|
||||||
DPRINTF(E_DBG,L_SCAN,"Translating %s, base %s\n",pold,scan_xml_file);
|
DPRINTF(E_DBG,L_SCAN,"Translating %s, base %s\n",pold,scan_xml_file);
|
||||||
|
|
||||||
@ -690,7 +693,7 @@ int scan_xml_tracks_section(int action, char *info) {
|
|||||||
if((!is_streaming)&&scan_xml_translate_path(song_path,real_path)) {
|
if((!is_streaming)&&scan_xml_translate_path(song_path,real_path)) {
|
||||||
/* FIXME: Error handling */
|
/* FIXME: Error handling */
|
||||||
pmp3=db_fetch_path(NULL,real_path,0);
|
pmp3=db_fetch_path(NULL,real_path,0);
|
||||||
if(!pmp3) {
|
if(!pmp3) {
|
||||||
/* file doesn't exist... let's add it? */
|
/* file doesn't exist... let's add it? */
|
||||||
scan_filename(real_path,SCAN_TEST_COMPDIR,NULL);
|
scan_filename(real_path,SCAN_TEST_COMPDIR,NULL);
|
||||||
pmp3=db_fetch_path(NULL,real_path,0);
|
pmp3=db_fetch_path(NULL,real_path,0);
|
||||||
@ -734,7 +737,7 @@ int scan_xml_tracks_section(int action, char *info) {
|
|||||||
DPRINTF(E_DBG,L_SCAN,"Adding %s\n",song_path);
|
DPRINTF(E_DBG,L_SCAN,"Adding %s\n",song_path);
|
||||||
pmp3 = calloc(sizeof(MP3FILE),1);
|
pmp3 = calloc(sizeof(MP3FILE),1);
|
||||||
|
|
||||||
if(!pmp3)
|
if(!pmp3)
|
||||||
DPRINTF(E_FATAL,L_SCAN,
|
DPRINTF(E_FATAL,L_SCAN,
|
||||||
"malloc: scan_xml_tracks_section\n");
|
"malloc: scan_xml_tracks_section\n");
|
||||||
} else {
|
} else {
|
||||||
@ -761,7 +764,7 @@ int scan_xml_tracks_section(int action, char *info) {
|
|||||||
MAYBECOPY(time_added);
|
MAYBECOPY(time_added);
|
||||||
MAYBECOPY(disabled);
|
MAYBECOPY(disabled);
|
||||||
MAYBECOPYSTRING(album_artist);
|
MAYBECOPYSTRING(album_artist);
|
||||||
|
|
||||||
make_composite_tags(pmp3);
|
make_composite_tags(pmp3);
|
||||||
if(db_add(NULL,pmp3,&added_id) == DB_E_SUCCESS) {
|
if(db_add(NULL,pmp3,&added_id) == DB_E_SUCCESS) {
|
||||||
scan_xml_add_lookup(current_track_id,added_id);
|
scan_xml_add_lookup(current_track_id,added_id);
|
||||||
@ -944,7 +947,7 @@ int scan_xml_playlists_section(int action, char *info) {
|
|||||||
DPRINTF(E_LOG,L_SCAN,"err adding playlist %s\n",current_name);
|
DPRINTF(E_LOG,L_SCAN,"err adding playlist %s\n",current_name);
|
||||||
current_id=0;
|
current_id=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dont_scan=0;
|
dont_scan=0;
|
||||||
state=XML_PL_ST_EXPECTING_PL_TRACKLIST;
|
state=XML_PL_ST_EXPECTING_PL_TRACKLIST;
|
||||||
return XML_STATE_PLAYLISTS;
|
return XML_STATE_PLAYLISTS;
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -460,7 +463,7 @@ void xml_browse_path(WS_CONNINFO *pwsc) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* skip symlinks and devices and whatnot */
|
/* skip symlinks and devices and whatnot */
|
||||||
if((!(sb.st_mode & S_IFDIR)) &&
|
if((!(sb.st_mode & S_IFDIR)) &&
|
||||||
(!(sb.st_mode & S_IFREG)))
|
(!(sb.st_mode & S_IFREG)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user