From 6eb6c454be37c54a34fc871e21a9b1cc2ad41b89 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Sun, 20 Jun 2004 17:07:13 +0000 Subject: fix qball's bug, crossfading playing with funny samplerate git-svn-id: https://svn.musicpd.org/mpd/trunk@1585 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/decode.c | 4 +++- src/inputStream.c | 5 +++++ src/inputStream_file.c | 3 +++ src/inputStream_file.h | 2 ++ src/inputStream_http.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/inputStream_http.h | 2 ++ 6 files changed, 65 insertions(+), 1 deletion(-) diff --git a/src/decode.c b/src/decode.c index e81cddb76..c42d130d6 100644 --- a/src/decode.c +++ b/src/decode.c @@ -486,7 +486,9 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { pc->queueState = PLAYER_QUEUE_DECODE; kill(getppid(),SIGUSR1); } - if(next>=0 && doCrossFade==0 && !dc->start) { + if(next>=0 && doCrossFade==0 && !dc->start && + dc->state!=DECODE_STATE_START) + { nextChunk = -1; if(isCurrentAudioFormat(&(cb->audioFormat))) { doCrossFade = 1; diff --git a/src/inputStream.c b/src/inputStream.c index e15788a13..465ea63eb 100644 --- a/src/inputStream.c +++ b/src/inputStream.c @@ -25,6 +25,11 @@ #include #include +void initInputStream() { + inputStream_initFile(); + inputStream_initHttp(); +} + int openInputStream(InputStream * inStream, char * url) { inStream->offset = 0; inStream->size = 0; diff --git a/src/inputStream_file.c b/src/inputStream_file.c index 5d88fa5ac..ac0b2d173 100644 --- a/src/inputStream_file.c +++ b/src/inputStream_file.c @@ -23,6 +23,9 @@ #include #include +void inputStream_initFile() { +} + int inputStream_fileOpen(InputStream * inStream, char * filename) { FILE * fp; diff --git a/src/inputStream_file.h b/src/inputStream_file.h index b4b53f3c0..e45fe714e 100644 --- a/src/inputStream_file.h +++ b/src/inputStream_file.h @@ -21,6 +21,8 @@ #include "inputStream.h" +void inputStream_initFile(); + int inputStream_fileOpen(InputStream * inStream, char * filename); int inputStream_fileSeek(InputStream * inStream, long offset, int whence); diff --git a/src/inputStream_http.c b/src/inputStream_http.c index 66e98b5a8..7ea4470a4 100644 --- a/src/inputStream_http.c +++ b/src/inputStream_http.c @@ -20,6 +20,7 @@ #include "utils.h" #include "log.h" +#include "conf.h" #include #include @@ -61,6 +62,55 @@ typedef struct _InputStreemHTTPData { int icyOffset; } InputStreamHTTPData; +void inputStream_initHttp() { + if(getConf()[CONF_HTTP_PROXY_HOST]) { + char * portStr = getConf()[CONF_HTTP_PROXY_PORT]; + int port = 0; + char * test; + + if(!portStr) { + ERROR("http_proxy_host specified but not the http_" + "proxy_port\n"); + exit(EXIT_FAILURE); + } + + port = strtol(portStr, &test, 10); + if(port <= 0 || *test != '\0') { + ERROR("http_proxy_port \"%s\" is not a positive integer" + "\n", portStr); + } + + if(getConf()[CONF_HTTP_PROXY_USER] && + !getConf()[CONF_HTTP_PROXY_PASSWORD]) + { + ERROR("http_proxy_user specified, but not http_proxy_" + "password\n"); + exit(EXIT_FAILURE); + } + + if(getConf()[CONF_HTTP_PROXY_PASSWORD] && + !getConf()[CONF_HTTP_PROXY_USER]) + { + ERROR("http proxy password specified, but not http " + "proxy user\n"); + exit(EXIT_FAILURE); + } + } + else if(getConf()[CONF_HTTP_PROXY_PORT]) { + ERROR("http_proxy_port specified but not http_proxy_host\n"); + exit(EXIT_FAILURE); + } + else if(getConf()[CONF_HTTP_PROXY_USER]) { + ERROR("http_proxy_user specified but not http_proxy_host\n"); + exit(EXIT_FAILURE); + } + else if(getConf()[CONF_HTTP_PROXY_PASSWORD]) { + ERROR("http_proxy_password specified but not http_proxy_host" + "\n"); + exit(EXIT_FAILURE); + } +} + static InputStreamHTTPData * newInputStreamHTTPData() { InputStreamHTTPData * ret = malloc(sizeof(InputStreamHTTPData)); diff --git a/src/inputStream_http.h b/src/inputStream_http.h index 021ae2c76..4e213cd57 100644 --- a/src/inputStream_http.h +++ b/src/inputStream_http.h @@ -21,6 +21,8 @@ #include "inputStream.h" +void inputStream_initHttp(); + int inputStream_httpOpen(InputStream * inStream, char * filename); int inputStream_httpSeek(InputStream * inStream, long offset, int whence); -- cgit v1.2.3