mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-13 15:59:50 -04:00
fix seek problems using dynamic art on mac platform
This commit is contained in:
parent
b3e3f349c7
commit
44d29752c7
@ -78,7 +78,7 @@ int da_get_image_fd(char *filename) {
|
|||||||
strcpy(path_end+1,config.artfilename);
|
strcpy(path_end+1,config.artfilename);
|
||||||
fd = open(buffer,O_RDONLY);
|
fd = open(buffer,O_RDONLY);
|
||||||
if(fd != -1)
|
if(fd != -1)
|
||||||
DPRINTF(ERR_INFO,"Found image file %s\n",buffer);
|
DPRINTF(ERR_INFO,"Found image file %s (fd %d)\n",buffer,fd);
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
@ -126,14 +126,15 @@ int da_attach_image(int img_fd, int out_fd, int mp3_fd, int offset)
|
|||||||
unsigned char buffer[4];
|
unsigned char buffer[4];
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if(fstat(img_fd,&sb)) {
|
fstat(img_fd,&sb);
|
||||||
DPRINTF(ERR_INFO,"Cannot stat image file... %s\n",strerror(errno));
|
img_size=sb.st_size;
|
||||||
|
|
||||||
|
DPRINTF(ERR_INFO,"Image appears to be %ld bytes\n",img_size);
|
||||||
|
if(img_size < 1) {
|
||||||
|
r_close(img_fd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
img_size=sb.st_size;
|
|
||||||
DPRINTF(ERR_INFO,"Image appears to be %ld bytes\n",img_size);
|
|
||||||
|
|
||||||
if (offset > (img_size + 24) ) {
|
if (offset > (img_size + 24) ) {
|
||||||
lseek(mp3_fd,(offset - img_size - 24),SEEK_SET);
|
lseek(mp3_fd,(offset - img_size - 24),SEEK_SET);
|
||||||
r_close(img_fd);
|
r_close(img_fd);
|
||||||
|
@ -279,13 +279,14 @@ void daap_handler(WS_CONNINFO *pwsc) {
|
|||||||
ws_emitheaders(pwsc);
|
ws_emitheaders(pwsc);
|
||||||
|
|
||||||
config_set_status(pwsc,session_id,"Streaming file '%s'",pmp3->fname);
|
config_set_status(pwsc,session_id,"Streaming file '%s'",pmp3->fname);
|
||||||
DPRINTF(ERR_LOG,"Session %d: Streaming file '%s' to %s\n",session_id,
|
DPRINTF(ERR_LOG,"Session %d: Streaming file '%s' to %s (offset %d)\n",
|
||||||
pmp3->fname, pwsc->hostname);
|
session_id,pmp3->fname, pwsc->hostname,offset);
|
||||||
|
|
||||||
if(!offset)
|
if(!offset)
|
||||||
config.stats.songs_served++; /* FIXME: remove stat races */
|
config.stats.songs_served++; /* FIXME: remove stat races */
|
||||||
|
|
||||||
if((config.artfilename) && (img_fd=da_get_image_fd(pmp3->path) != -1)) {
|
if((config.artfilename) && ((img_fd=da_get_image_fd(pmp3->path)) != -1) &&
|
||||||
|
(!offset)) {
|
||||||
DPRINTF(ERR_INFO,"Dynamically attaching artwork to %s (fd %d)\n",
|
DPRINTF(ERR_INFO,"Dynamically attaching artwork to %s (fd %d)\n",
|
||||||
pmp3->fname, img_fd);
|
pmp3->fname, img_fd);
|
||||||
da_attach_image(img_fd, pwsc->fd, file_fd, offset);
|
da_attach_image(img_fd, pwsc->fd, file_fd, offset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user