-rw-r--r-- | core/multimedia/opieplayer/libmad/libmad.pro | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.cpp | 59 |
2 files changed, 42 insertions, 19 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmad.pro b/core/multimedia/opieplayer/libmad/libmad.pro index eddf242..679242b 100644 --- a/core/multimedia/opieplayer/libmad/libmad.pro +++ b/core/multimedia/opieplayer/libmad/libmad.pro | |||
@@ -7,3 +7,3 @@ SOURCES = version.c fixed.c bit.c timer.c stream.c frame.c synth.c dec | |||
7 | TARGET = madplugin | 7 | TARGET = madplugin |
8 | DESTDIR = ../../plugins/codecs | 8 | DESTDIR = ../../../plugins/codecs |
9 | INCLUDEPATH += $(OPIEDIR)/include .. | 9 | INCLUDEPATH += $(OPIEDIR)/include .. |
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 46f2450..4665408 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp | |||
@@ -19,2 +19,7 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qapplication.h> | ||
21 | #include <qpe/config.h> | ||
22 | #include <qmessagebox.h> | ||
23 | #include <qstring.h> | ||
24 | |||
20 | #include <stdio.h> | 25 | #include <stdio.h> |
@@ -33,4 +38,3 @@ | |||
33 | #include <assert.h> | 38 | #include <assert.h> |
34 | #include <qapplication.h> | 39 | |
35 | #include <qpe/config.h> | ||
36 | 40 | ||
@@ -235,2 +239,3 @@ int LibMadPlugin::http_read_line(int tcp_sock, char *buf, int size) { | |||
235 | int LibMadPlugin::http_open(const QString& path ) { | 239 | int LibMadPlugin::http_open(const QString& path ) { |
240 | qDebug("Open http"); | ||
236 | char *host; | 241 | char *host; |
@@ -244,11 +249,17 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
244 | 249 | ||
250 | QString errorMsg; | ||
251 | |||
245 | /* Check for URL syntax */ | 252 | /* Check for URL syntax */ |
246 | if (strncmp(arg, "http://", strlen("http://"))) | 253 | // if (strncmp(arg, "http://", strlen("http://"))) { |
247 | return (0); | 254 | // qDebug("Url syntax error"); |
255 | // return (0); | ||
256 | // } | ||
248 | 257 | ||
249 | /* Parse URL */ | 258 | qDebug("Parse URL"); |
250 | port = 80; | 259 | port = 80; |
251 | host = arg + strlen("http://"); | 260 | host = arg + strlen("http://"); |
252 | if ((request = strchr(host, '/')) == NULL) | 261 | if ((request = strchr(host, '/')) == NULL) { |
262 | qDebug("Url syntax 2error %s", host); | ||
253 | return (0); | 263 | return (0); |
264 | } | ||
254 | *request++ = 0; | 265 | *request++ = 0; |
@@ -261,6 +272,7 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
261 | 272 | ||
262 | /* Open a TCP socket */ | 273 | qDebug("Open a TCP socket"); |
263 | if (!(tcp_sock = tcp_open(host, port))) | 274 | if (!(tcp_sock = tcp_open(host, port))) { |
264 | { | 275 | perror("http_open"); |
265 | perror("http_open"); | 276 | errorMsg="http_open "+(QString)strerror(errno); |
277 | QMessageBox::message("OPiePlayer",errorMsg); | ||
266 | return (0); | 278 | return (0); |
@@ -276,7 +288,8 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
276 | "Pragma: no-cache\r\n" "Host: %s\r\n" "Accept: */*\r\n" "\r\n", filename, host); | 288 | "Pragma: no-cache\r\n" "Host: %s\r\n" "Accept: */*\r\n" "\r\n", filename, host); |
277 | 289 | qDebug("send"); | |
278 | send(tcp_sock, http_request, strlen(http_request), 0); | 290 | send(tcp_sock, http_request, strlen(http_request), 0); |
279 | 291 | ||
280 | /* Parse server reply */ | 292 | qDebug("Parse server reply"); |
281 | #if 0 | 293 | #if 0 |
294 | qDebug("do 0"); | ||
282 | do | 295 | do |
@@ -314,3 +327,3 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
314 | { | 327 | { |
315 | /* redirect */ | 328 | qDebug("redirect"); |
316 | std::close(tcp_sock); | 329 | std::close(tcp_sock); |
@@ -324,3 +337,3 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
324 | { | 337 | { |
325 | /* This is icecast streaming */ | 338 | qDebug(" This is icecast streaming"); |
326 | if (strncmp(http_request + 4, "200 ", 4)) | 339 | if (strncmp(http_request + 4, "200 ", 4)) |
@@ -354,7 +367,12 @@ bool LibMadPlugin::open( const QString& path ) { | |||
354 | 367 | ||
355 | //qDebug( "Opening %s", path.latin1() ); | 368 | qDebug( "Opening %s", path.latin1() ); |
356 | |||
357 | 369 | ||
370 | bool isStream=FALSE; | ||
358 | if (path.left( 4 ) == "http" ) { | 371 | if (path.left( 4 ) == "http" ) { |
359 | d->input.fd = http_open(path); | 372 | d->input.fd = http_open(path); |
373 | if(d->input.fd == 0) { | ||
374 | qDebug("http_open error"); | ||
375 | } | ||
376 | isStream=TRUE; | ||
377 | qDebug("Opened ok"); | ||
360 | 378 | ||
@@ -368,4 +386,6 @@ bool LibMadPlugin::open( const QString& path ) { | |||
368 | } | 386 | } |
369 | 387 | if(!isStream) { | |
370 | printID3Tags(); | 388 | qDebug("Print ID#tags"); |
389 | printID3Tags(); | ||
390 | } | ||
371 | 391 | ||
@@ -397,4 +417,7 @@ bool LibMadPlugin::open( const QString& path ) { | |||
397 | 417 | ||
418 | qDebug("about to mad_stream"); | ||
398 | mad_stream_init(&d->stream); | 419 | mad_stream_init(&d->stream); |
420 | qDebug("mad_frame"); | ||
399 | mad_frame_init(&d->frame); | 421 | mad_frame_init(&d->frame); |
422 | qDebug("mad_synth"); | ||
400 | mad_synth_init(&d->synth); | 423 | mad_synth_init(&d->synth); |