author | llornkcor <llornkcor> | 2002-04-20 19:23:50 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-20 19:23:50 (UTC) |
commit | cab475701ef94588394bb10f7fdc86dff98867c8 (patch) (unidiff) | |
tree | b647e764a904e2896187db5949509a4be317cb0f | |
parent | 0169070eeca0ef41d33c4e8b2feee9c90f34f6ae (diff) | |
download | opie-cab475701ef94588394bb10f7fdc86dff98867c8.zip opie-cab475701ef94588394bb10f7fdc86dff98867c8.tar.gz opie-cab475701ef94588394bb10f7fdc86dff98867c8.tar.bz2 |
MediaPlayer to OpiePlayer
-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 7bb6541..46f2450 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp | |||
@@ -299,97 +299,97 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
299 | #endif | 299 | #endif |
300 | 300 | ||
301 | do | 301 | do |
302 | { | 302 | { |
303 | int len; | 303 | int len; |
304 | 304 | ||
305 | len = http_read_line(tcp_sock, http_request, sizeof(http_request)); | 305 | len = http_read_line(tcp_sock, http_request, sizeof(http_request)); |
306 | 306 | ||
307 | if (len == -1) | 307 | if (len == -1) |
308 | { | 308 | { |
309 | fprintf(stderr, "http_open: %s\n", strerror(errno)); | 309 | fprintf(stderr, "http_open: %s\n", strerror(errno)); |
310 | return 0; | 310 | return 0; |
311 | } | 311 | } |
312 | 312 | ||
313 | if (strncmp(http_request, "Location:", 9) == 0) | 313 | if (strncmp(http_request, "Location:", 9) == 0) |
314 | { | 314 | { |
315 | /* redirect */ | 315 | /* redirect */ |
316 | std::close(tcp_sock); | 316 | std::close(tcp_sock); |
317 | 317 | ||
318 | http_request[strlen(http_request) - 1] = '\0'; | 318 | http_request[strlen(http_request) - 1] = '\0'; |
319 | 319 | ||
320 | return http_open(&http_request[10]); | 320 | return http_open(&http_request[10]); |
321 | } | 321 | } |
322 | 322 | ||
323 | if (strncmp(http_request, "ICY ", 4) == 0) | 323 | if (strncmp(http_request, "ICY ", 4) == 0) |
324 | { | 324 | { |
325 | /* This is icecast streaming */ | 325 | /* This is icecast streaming */ |
326 | if (strncmp(http_request + 4, "200 ", 4)) | 326 | if (strncmp(http_request + 4, "200 ", 4)) |
327 | { | 327 | { |
328 | fprintf(stderr, "http_open: %s\n", http_request); | 328 | fprintf(stderr, "http_open: %s\n", http_request); |
329 | return 0; | 329 | return 0; |
330 | } | 330 | } |
331 | } | 331 | } |
332 | else if (strncmp(http_request, "icy-", 4) == 0) | 332 | else if (strncmp(http_request, "icy-", 4) == 0) |
333 | { | 333 | { |
334 | /* we can have: icy-noticeX, icy-name, icy-genre, icy-url, icy-pub, icy-metaint, icy-br */ | 334 | /* we can have: icy-noticeX, icy-name, icy-genre, icy-url, icy-pub, icy-metaint, icy-br */ |
335 | /* Don't print these - mpg123 doesn't */ | 335 | /* Don't print these - mpg123 doesn't */ |
336 | /* fprintf(stderr,"%s\n",http_request); */ | 336 | /* fprintf(stderr,"%s\n",http_request); */ |
337 | } | 337 | } |
338 | } | 338 | } |
339 | while (strcmp(http_request, "\n") != 0); | 339 | while (strcmp(http_request, "\n") != 0); |
340 | 340 | ||
341 | return (tcp_sock); | 341 | return (tcp_sock); |
342 | } | 342 | } |
343 | 343 | ||
344 | 344 | ||
345 | bool LibMadPlugin::open( const QString& path ) { | 345 | bool LibMadPlugin::open( const QString& path ) { |
346 | debugMsg( "LibMadPlugin::open" ); | 346 | debugMsg( "LibMadPlugin::open" ); |
347 | Config cfg("MediaPlayer"); | 347 | Config cfg("OpiePlayer"); |
348 | cfg.setGroup("Options"); | 348 | cfg.setGroup("Options"); |
349 | bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); | 349 | bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); |
350 | qDebug("buffer size is %d", bufferSize); | 350 | qDebug("buffer size is %d", bufferSize); |
351 | d->bad_last_frame = 0; | 351 | d->bad_last_frame = 0; |
352 | d->flush = TRUE; | 352 | d->flush = TRUE; |
353 | info = QString( "" ); | 353 | info = QString( "" ); |
354 | 354 | ||
355 | //qDebug( "Opening %s", path.latin1() ); | 355 | //qDebug( "Opening %s", path.latin1() ); |
356 | 356 | ||
357 | 357 | ||
358 | if (path.left( 4 ) == "http" ) { | 358 | if (path.left( 4 ) == "http" ) { |
359 | d->input.fd = http_open(path); | 359 | d->input.fd = http_open(path); |
360 | 360 | ||
361 | } else { | 361 | } else { |
362 | d->input.path = path.latin1(); | 362 | d->input.path = path.latin1(); |
363 | d->input.fd = ::open( d->input.path, O_RDONLY ); | 363 | d->input.fd = ::open( d->input.path, O_RDONLY ); |
364 | } | 364 | } |
365 | if (d->input.fd == -1) { | 365 | if (d->input.fd == -1) { |
366 | qDebug("error opening %s", d->input.path ); | 366 | qDebug("error opening %s", d->input.path ); |
367 | return FALSE; | 367 | return FALSE; |
368 | } | 368 | } |
369 | 369 | ||
370 | printID3Tags(); | 370 | printID3Tags(); |
371 | 371 | ||
372 | #if defined(HAVE_MMAP) | 372 | #if defined(HAVE_MMAP) |
373 | struct stat stat; | 373 | struct stat stat; |
374 | if (fstat(d->input.fd, &stat) == -1) { | 374 | if (fstat(d->input.fd, &stat) == -1) { |
375 | qDebug("error calling fstat"); return FALSE; | 375 | qDebug("error calling fstat"); return FALSE; |
376 | } | 376 | } |
377 | if (S_ISREG(stat.st_mode) && stat.st_size > 0) { | 377 | if (S_ISREG(stat.st_mode) && stat.st_size > 0) { |
378 | d->input.length = stat.st_size; | 378 | d->input.length = stat.st_size; |
379 | d->input.fdm = map_file(d->input.fd, &d->input.length); | 379 | d->input.fdm = map_file(d->input.fd, &d->input.length); |
380 | if (d->input.fdm == 0) { | 380 | if (d->input.fdm == 0) { |
381 | qDebug("error mmapping file"); return FALSE; | 381 | qDebug("error mmapping file"); return FALSE; |
382 | } | 382 | } |
383 | d->input.data = (unsigned char *)d->input.fdm; | 383 | d->input.data = (unsigned char *)d->input.fdm; |
384 | } | 384 | } |
385 | #endif | 385 | #endif |
386 | 386 | ||
387 | if (d->input.data == 0) { | 387 | if (d->input.data == 0) { |
388 | d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/); | 388 | d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/); |
389 | if (d->input.data == 0) { | 389 | if (d->input.data == 0) { |
390 | qDebug("error allocating input buffer"); | 390 | qDebug("error allocating input buffer"); |
391 | return FALSE; | 391 | return FALSE; |
392 | } | 392 | } |
393 | d->input.length = 0; | 393 | d->input.length = 0; |
394 | } | 394 | } |
395 | 395 | ||