Diffstat (limited to 'core/multimedia/opieplayer/libmad/libmadplugin.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.cpp | 64 |
1 files changed, 19 insertions, 45 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 7978805..7bb6541 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp | |||
@@ -19,7 +19,2 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qapplication.h> | ||
21 | #include <qpe/config.h> | ||
22 | #include <qmessagebox.h> | ||
23 | #include <qstring.h> | ||
24 | |||
25 | #include <stdio.h> | 20 | #include <stdio.h> |
@@ -38,3 +33,4 @@ | |||
38 | #include <assert.h> | 33 | #include <assert.h> |
39 | 34 | #include <qapplication.h> | |
35 | #include <qpe/config.h> | ||
40 | 36 | ||
@@ -239,3 +235,2 @@ int LibMadPlugin::http_read_line(int tcp_sock, char *buf, int size) { | |||
239 | int LibMadPlugin::http_open(const QString& path ) { | 235 | int LibMadPlugin::http_open(const QString& path ) { |
240 | qDebug("Open http"); | ||
241 | char *host; | 236 | char *host; |
@@ -246,23 +241,14 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
246 | char filename[PATH_MAX]; | 241 | char filename[PATH_MAX]; |
247 | // char c; | 242 | char c; |
248 | char *arg =strdup(path.latin1()); | 243 | char *arg =strdup(path.latin1()); |
249 | 244 | ||
250 | QString errorMsg; | ||
251 | |||
252 | /* Check for URL syntax */ | 245 | /* Check for URL syntax */ |
253 | // if (strncmp(arg, "http://", strlen("http://"))) { | 246 | if (strncmp(arg, "http://", strlen("http://"))) |
254 | // qDebug("Url syntax error"); | 247 | return (0); |
255 | // return (0); | ||
256 | // } | ||
257 | 248 | ||
258 | qDebug("Parse URL"); | 249 | /* Parse URL */ |
259 | port = 80; | 250 | port = 80; |
260 | host = arg + strlen("http://"); | 251 | host = arg + strlen("http://"); |
261 | 252 | if ((request = strchr(host, '/')) == NULL) | |
262 | // we need to think of something better than that | 253 | return (0); |
263 | //if ((request = strchr(host, '/')) == NULL) { | ||
264 | // qDebug("Url syntax 2error %s", host); | ||
265 | // return (0); | ||
266 | // } | ||
267 | |||
268 | *request++ = 0; | 254 | *request++ = 0; |
@@ -275,7 +261,6 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
275 | 261 | ||
276 | qDebug("Open a TCP socket"); | 262 | /* Open a TCP socket */ |
277 | if (!(tcp_sock = tcp_open(host, port))) { | 263 | if (!(tcp_sock = tcp_open(host, port))) |
264 | { | ||
278 | perror("http_open"); | 265 | perror("http_open"); |
279 | errorMsg="http_open "+(QString)strerror(errno); | ||
280 | QMessageBox::message("OPiePlayer",errorMsg); | ||
281 | return (0); | 266 | return (0); |
@@ -291,8 +276,7 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
291 | "Pragma: no-cache\r\n" "Host: %s\r\n" "Accept: */*\r\n" "\r\n", filename, host); | 276 | "Pragma: no-cache\r\n" "Host: %s\r\n" "Accept: */*\r\n" "\r\n", filename, host); |
292 | qDebug("send"); | 277 | |
293 | send(tcp_sock, http_request, strlen(http_request), 0); | 278 | send(tcp_sock, http_request, strlen(http_request), 0); |
294 | 279 | ||
295 | qDebug("Parse server reply"); | 280 | /* Parse server reply */ |
296 | #if 0 | 281 | #if 0 |
297 | qDebug("do 0"); | ||
298 | do | 282 | do |
@@ -330,3 +314,3 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
330 | { | 314 | { |
331 | qDebug("redirect"); | 315 | /* redirect */ |
332 | std::close(tcp_sock); | 316 | std::close(tcp_sock); |
@@ -340,3 +324,3 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
340 | { | 324 | { |
341 | qDebug(" This is icecast streaming"); | 325 | /* This is icecast streaming */ |
342 | if (strncmp(http_request + 4, "200 ", 4)) | 326 | if (strncmp(http_request + 4, "200 ", 4)) |
@@ -362,3 +346,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
362 | debugMsg( "LibMadPlugin::open" ); | 346 | debugMsg( "LibMadPlugin::open" ); |
363 | Config cfg("OpiePlayer"); | 347 | Config cfg("MediaPlayer"); |
364 | cfg.setGroup("Options"); | 348 | cfg.setGroup("Options"); |
@@ -370,12 +354,7 @@ bool LibMadPlugin::open( const QString& path ) { | |||
370 | 354 | ||
371 | qDebug( "Opening %s", path.latin1() ); | 355 | //qDebug( "Opening %s", path.latin1() ); |
356 | |||
372 | 357 | ||
373 | bool isStream=FALSE; | ||
374 | if (path.left( 4 ) == "http" ) { | 358 | if (path.left( 4 ) == "http" ) { |
375 | d->input.fd = http_open(path); | 359 | d->input.fd = http_open(path); |
376 | if(d->input.fd == 0) { | ||
377 | qDebug("http_open error"); | ||
378 | } | ||
379 | isStream=TRUE; | ||
380 | qDebug("Opened ok"); | ||
381 | 360 | ||
@@ -389,6 +368,4 @@ bool LibMadPlugin::open( const QString& path ) { | |||
389 | } | 368 | } |
390 | if(!isStream) { | 369 | |
391 | qDebug("Print ID#tags"); | ||
392 | printID3Tags(); | 370 | printID3Tags(); |
393 | } | ||
394 | 371 | ||
@@ -420,7 +397,4 @@ bool LibMadPlugin::open( const QString& path ) { | |||
420 | 397 | ||
421 | qDebug("about to mad_stream"); | ||
422 | mad_stream_init(&d->stream); | 398 | mad_stream_init(&d->stream); |
423 | qDebug("mad_frame"); | ||
424 | mad_frame_init(&d->frame); | 399 | mad_frame_init(&d->frame); |
425 | qDebug("mad_synth"); | ||
426 | mad_synth_init(&d->synth); | 400 | mad_synth_init(&d->synth); |