Merge branch 'master' into ffmpeg
This commit is contained in:
commit
ca6645e980
26
albumart.c
26
albumart.c
@ -25,6 +25,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <limits.h>
|
||||
#include <libgen.h>
|
||||
#include <setjmp.h>
|
||||
#include <errno.h>
|
||||
@ -127,23 +128,22 @@ update_if_album_art(const char *path)
|
||||
return;
|
||||
while ((dp = readdir(dh)) != NULL)
|
||||
{
|
||||
switch( dp->d_type )
|
||||
if (is_reg(dp) == 1)
|
||||
{
|
||||
case DT_REG:
|
||||
type = TYPE_FILE;
|
||||
break;
|
||||
case DT_LNK:
|
||||
case DT_UNKNOWN:
|
||||
snprintf(file, sizeof(file), "%s/%s", dir, dp->d_name);
|
||||
type = resolve_unknown_type(file, ALL_MEDIA);
|
||||
break;
|
||||
default:
|
||||
type = TYPE_UNKNOWN;
|
||||
break;
|
||||
type = TYPE_FILE;
|
||||
}
|
||||
else if (is_dir(dp) == 1)
|
||||
{
|
||||
type = TYPE_DIR;
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(file, sizeof(file), "%s/%s", dir, dp->d_name);
|
||||
type = resolve_unknown_type(file, ALL_MEDIA);
|
||||
}
|
||||
if( type != TYPE_FILE )
|
||||
continue;
|
||||
if( (*(dp->d_name) != '.') &&
|
||||
if( (dp->d_name[0] != '.') &&
|
||||
(is_video(dp->d_name) || is_audio(dp->d_name)) &&
|
||||
(album_art || strncmp(dp->d_name, match, ncmp) == 0) )
|
||||
{
|
||||
|
@ -59,6 +59,7 @@ m4_ifdef([AC_TYPE_INT32_T], [AC_TYPE_INT32_T])
|
||||
m4_ifdef([AC_TYPE_UINT32_T], [AC_TYPE_UINT32_T])
|
||||
m4_ifdef([AC_TYPE_UINT64_T], [AC_TYPE_UINT64_T])
|
||||
m4_ifdef([AC_TYPE_SSIZE_T], [AC_TYPE_SSIZE_T])
|
||||
AC_STRUCT_DIRENT_D_TYPE
|
||||
AC_STRUCT_ST_BLOCKS
|
||||
AC_HEADER_STDBOOL
|
||||
AC_C_BIGENDIAN
|
||||
|
10
getifaddr.c
10
getifaddr.c
@ -173,7 +173,7 @@ getsyshwaddr(char *buf, int len)
|
||||
{
|
||||
unsigned char mac[6];
|
||||
int ret = -1;
|
||||
#if defined(HAVE_GETIFADDRS) && !defined (__linux__)
|
||||
#if defined(HAVE_GETIFADDRS) && !defined (__linux__) && !defined (__sun__)
|
||||
struct ifaddrs *ifap, *p;
|
||||
struct sockaddr_in *addr_in;
|
||||
uint8_t a;
|
||||
@ -191,7 +191,7 @@ getsyshwaddr(char *buf, int len)
|
||||
a = (htonl(addr_in->sin_addr.s_addr) >> 0x18) & 0xFF;
|
||||
if (a == 127)
|
||||
continue;
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
struct ifreq ifr;
|
||||
int fd;
|
||||
fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
@ -242,9 +242,15 @@ getsyshwaddr(char *buf, int len)
|
||||
continue;
|
||||
if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0)
|
||||
continue;
|
||||
#ifdef __sun__
|
||||
if (MACADDR_IS_ZERO(ifr.ifr_addr.sa_data))
|
||||
continue;
|
||||
memcpy(mac, ifr.ifr_addr.sa_data, 6);
|
||||
#else
|
||||
if (MACADDR_IS_ZERO(ifr.ifr_hwaddr.sa_data))
|
||||
continue;
|
||||
memcpy(mac, ifr.ifr_hwaddr.sa_data, 6);
|
||||
#endif
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <limits.h>
|
||||
#include <libgen.h>
|
||||
#include <pwd.h>
|
||||
|
||||
|
22
scanner.c
22
scanner.c
@ -604,10 +604,14 @@ filter_hidden(scan_filter *d)
|
||||
static int
|
||||
filter_type(scan_filter *d)
|
||||
{
|
||||
#if HAVE_STRUCT_DIRENT_D_TYPE
|
||||
return ( (d->d_type == DT_DIR) ||
|
||||
(d->d_type == DT_LNK) ||
|
||||
(d->d_type == DT_UNKNOWN)
|
||||
);
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
@ -615,7 +619,7 @@ filter_a(scan_filter *d)
|
||||
{
|
||||
return ( filter_hidden(d) &&
|
||||
(filter_type(d) ||
|
||||
((d->d_type == DT_REG) &&
|
||||
(is_reg(d) &&
|
||||
(is_audio(d->d_name) ||
|
||||
is_playlist(d->d_name))))
|
||||
);
|
||||
@ -626,7 +630,7 @@ filter_av(scan_filter *d)
|
||||
{
|
||||
return ( filter_hidden(d) &&
|
||||
(filter_type(d) ||
|
||||
((d->d_type == DT_REG) &&
|
||||
(is_reg(d) &&
|
||||
(is_audio(d->d_name) ||
|
||||
is_video(d->d_name) ||
|
||||
is_playlist(d->d_name))))
|
||||
@ -638,7 +642,7 @@ filter_ap(scan_filter *d)
|
||||
{
|
||||
return ( filter_hidden(d) &&
|
||||
(filter_type(d) ||
|
||||
((d->d_type == DT_REG) &&
|
||||
(is_reg(d) &&
|
||||
(is_audio(d->d_name) ||
|
||||
is_image(d->d_name) ||
|
||||
is_playlist(d->d_name))))
|
||||
@ -650,7 +654,7 @@ filter_v(scan_filter *d)
|
||||
{
|
||||
return ( filter_hidden(d) &&
|
||||
(filter_type(d) ||
|
||||
(d->d_type == DT_REG &&
|
||||
(is_reg(d) &&
|
||||
is_video(d->d_name)))
|
||||
);
|
||||
}
|
||||
@ -660,7 +664,7 @@ filter_vp(scan_filter *d)
|
||||
{
|
||||
return ( filter_hidden(d) &&
|
||||
(filter_type(d) ||
|
||||
((d->d_type == DT_REG) &&
|
||||
(is_reg(d) &&
|
||||
(is_video(d->d_name) ||
|
||||
is_image(d->d_name))))
|
||||
);
|
||||
@ -671,7 +675,7 @@ filter_p(scan_filter *d)
|
||||
{
|
||||
return ( filter_hidden(d) &&
|
||||
(filter_type(d) ||
|
||||
(d->d_type == DT_REG &&
|
||||
(is_reg(d) &&
|
||||
is_image(d->d_name)))
|
||||
);
|
||||
}
|
||||
@ -681,7 +685,7 @@ filter_avp(scan_filter *d)
|
||||
{
|
||||
return ( filter_hidden(d) &&
|
||||
(filter_type(d) ||
|
||||
((d->d_type == DT_REG) &&
|
||||
(is_reg(d) &&
|
||||
(is_audio(d->d_name) ||
|
||||
is_image(d->d_name) ||
|
||||
is_video(d->d_name) ||
|
||||
@ -754,11 +758,11 @@ ScanDirectory(const char *dir, const char *parent, media_types dir_types)
|
||||
type = TYPE_UNKNOWN;
|
||||
snprintf(full_path, PATH_MAX, "%s/%s", dir, namelist[i]->d_name);
|
||||
name = escape_tag(namelist[i]->d_name, 1);
|
||||
if( namelist[i]->d_type == DT_DIR )
|
||||
if( is_dir(namelist[i]) == 1 )
|
||||
{
|
||||
type = TYPE_DIR;
|
||||
}
|
||||
else if( namelist[i]->d_type == DT_REG )
|
||||
else if( is_reg(namelist[i]) == 1 )
|
||||
{
|
||||
type = TYPE_FILE;
|
||||
}
|
||||
|
@ -375,9 +375,9 @@ _asf_load_string(FILE *fp, int type, int size, char *buf, int len)
|
||||
unsigned char data[2048];
|
||||
uint16_t wc;
|
||||
int i, j;
|
||||
int16_t *wd16;
|
||||
int32_t *wd32;
|
||||
int64_t *wd64;
|
||||
int16_t *wd16;
|
||||
|
||||
i = 0;
|
||||
if(size && (size <= sizeof(data)) && (size == fread(data, 1, size, fp)))
|
||||
@ -413,11 +413,7 @@ _asf_load_string(FILE *fp, int type, int size, char *buf, int len)
|
||||
if(size >= 8)
|
||||
{
|
||||
wd64 = (int64_t *) &data[0];
|
||||
#if __WORDSIZE == 64
|
||||
i = snprintf(buf, len, "%ld", le64_to_cpu(*wd64));
|
||||
#else
|
||||
i = snprintf(buf, len, "%lld", le64_to_cpu(*wd64));
|
||||
#endif
|
||||
i = snprintf(buf, len, "%lld", (long long)le64_to_cpu(*wd64));
|
||||
}
|
||||
break;
|
||||
case ASF_VT_WORD:
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/param.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "upnpglobalvars.h"
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "upnpglobalvars.h"
|
||||
|
1
utils.c
1
utils.c
@ -26,6 +26,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
17
utils.h
17
utils.h
@ -25,6 +25,7 @@
|
||||
#define __UTILS_H__
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "minidlnatypes.h"
|
||||
@ -55,6 +56,22 @@ static inline void strncpyt(char *dst, const char *src, size_t len)
|
||||
strncpy(dst, src, len);
|
||||
dst[len-1] = '\0';
|
||||
}
|
||||
static inline int is_reg(const struct dirent *d)
|
||||
{
|
||||
#if HAVE_STRUCT_DIRENT_D_TYPE
|
||||
return (d->d_type == DT_REG);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
static inline int is_dir(const struct dirent *d)
|
||||
{
|
||||
#if HAVE_STRUCT_DIRENT_D_TYPE
|
||||
return (d->d_type == DT_DIR);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
int xasprintf(char **strp, char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
|
||||
int ends_with(const char * haystack, const char * needle);
|
||||
char *trim(char *str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user