summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-04-22 22:05:28 (UTC)
committer harlekin <harlekin>2002-04-22 22:05:28 (UTC)
commit1ce5e1128e3c062d45e6dcfbcda20f195b4d5b13 (patch) (side-by-side diff)
tree81303ba33d6f6aa7e56b9ea6ff6d85a7a894ede0
parentf77f012023dbe7582a4b4297f61c6521ad8a3aa5 (diff)
downloadopie-1ce5e1128e3c062d45e6dcfbcda20f195b4d5b13.zip
opie-1ce5e1128e3c062d45e6dcfbcda20f195b4d5b13.tar.gz
opie-1ce5e1128e3c062d45e6dcfbcda20f195b4d5b13.tar.bz2
more updates for shoutcast
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
index 0f952f4..8b692ef 100644
--- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp
+++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
@@ -309,9 +309,9 @@ int LibMadPlugin::http_open(const QString& path ) {
char *request;
int tcp_sock;
char http_request[PATH_MAX];
char filename[PATH_MAX];
- char c;
+ //char c;
char *arg =strdup(path.latin1());
/* Check for URL syntax */
if (strncmp(arg, "http://", strlen("http://"))) {
@@ -371,36 +371,33 @@ int LibMadPlugin::http_open(const QString& path ) {
QString genre;
QString bitrate;
QString url;
QString message = tr("Info: ");
-
do {
int len;
len = http_read_line(tcp_sock, http_request, sizeof(http_request));
if (len == -1) {
- fprintf(stderr, "http_open: %s\n", strerror(errno));
+ qDebug( "http_open: "+ QString(strerror(errno)) +"\n");
return 0;
}
- if (strncmp(http_request, "Location:", 9) == 0) {
+ if (QString(http_request).left(9) == "Location:") {
/* redirect */
std::close(tcp_sock);
-
http_request[strlen(http_request) - 1] = '\0';
-
return http_open(&http_request[10]);
}
- if (strncmp(http_request, "ICY ", 4) == 0) {
- /* This is icecast streaming */
+ if (QString(http_request).left(4) == "ICY ") {
+ /* This is shoutcast/icecast streaming */
if (strncmp(http_request + 4, "200 ", 4)) {
- fprintf(stderr, "http_open: %s\n", http_request);
+ qDebug("http_open: " + QString(http_request) + "\n");
return 0;
}
- } else if (strncmp(http_request, "icy-", 4) == 0) {
+ } else if (QString(http_request).left(4) == "icy-") {
/* we can have: icy-noticeX, icy-name, icy-genre, icy-url, icy-pub, icy-metaint, icy-br */
if ( QString( http_request ).left( 8 ) == "icy-name" ) {
name = tr("Name: ") + QString(http_request).mid(9, (QString(http_request).length())- 9 );
} else if ( QString( http_request ).left( 9 ) == "icy-genre" ) {