comparison src/madplug/input.c @ 1978:fa9f85cebade

s/vfs_/aud_vfs_/g
author William Pitcock <nenolod@atheme.org>
date Sun, 07 Oct 2007 00:25:33 -0500
parents 5fa26178eaef
children a260bd1beef0
comparison
equal deleted inserted replaced
1977:5a6b60ceaa0f 1978:fa9f85cebade
92 info->replaygain_track_scale = -1; 92 info->replaygain_track_scale = -1;
93 info->mp3gain_undo = -77; 93 info->mp3gain_undo = -77;
94 info->mp3gain_minmax = -77; 94 info->mp3gain_minmax = -77;
95 95
96 if(!fd){ 96 if(!fd){
97 info->infile = vfs_fopen(info->filename, "rb"); 97 info->infile = aud_vfs_fopen(info->filename, "rb");
98 if (info->infile == NULL) { 98 if (info->infile == NULL) {
99 return FALSE; 99 return FALSE;
100 } 100 }
101 } 101 }
102 else{ 102 else{
103 #ifdef DEBUG 103 #ifdef DEBUG
104 printf("input_init: vfs_dup\n"); 104 printf("input_init: aud_vfs_dup\n");
105 #endif 105 #endif
106 info->infile = vfs_dup(fd); 106 info->infile = aud_vfs_dup(fd);
107 } 107 }
108 108
109 // obtain file size 109 // obtain file size
110 info->size = vfs_fsize(info->infile); 110 info->size = aud_vfs_fsize(info->infile);
111 info->remote = info->size == 0 ? TRUE : FALSE; //proxy connection may result in non-zero size. 111 info->remote = info->size == 0 ? TRUE : FALSE; //proxy connection may result in non-zero size.
112 if(audmad_is_remote((gchar *)url)) 112 if(audmad_is_remote((gchar *)url))
113 info->remote = TRUE; 113 info->remote = TRUE;
114 114
115 info->fileinfo_request = FALSE; 115 info->fileinfo_request = FALSE;
360 360
361 tuple = aud_tuple_new_from_filename(info->filename); 361 tuple = aud_tuple_new_from_filename(info->filename);
362 info->tuple = tuple; 362 info->tuple = tuple;
363 363
364 if(info->infile) { 364 if(info->infile) {
365 curpos = vfs_ftell(info->infile); 365 curpos = aud_vfs_ftell(info->infile);
366 info->id3file = id3_file_vfsopen(info->infile, ID3_FILE_MODE_READONLY); 366 info->id3file = id3_file_vfsopen(info->infile, ID3_FILE_MODE_READONLY);
367 } 367 }
368 else { 368 else {
369 info->id3file = id3_file_open(info->filename, ID3_FILE_MODE_READONLY); 369 info->id3file = id3_file_open(info->filename, ID3_FILE_MODE_READONLY);
370 } 370 }
427 info->title = aud_tuple_formatter_make_title_string(tuple, audmad_config.title_override == TRUE ? 427 info->title = aud_tuple_formatter_make_title_string(tuple, audmad_config.title_override == TRUE ?
428 audmad_config.id3_format : get_gentitle_format()); 428 audmad_config.id3_format : get_gentitle_format());
429 429
430 // for connection via proxy, we have to stop transfer once. I can't explain the reason. 430 // for connection via proxy, we have to stop transfer once. I can't explain the reason.
431 if (info->infile != NULL) { 431 if (info->infile != NULL) {
432 vfs_fseek(info->infile, -1, SEEK_SET); // an impossible request 432 aud_vfs_fseek(info->infile, -1, SEEK_SET); // an impossible request
433 vfs_fseek(info->infile, curpos, SEEK_SET); 433 aud_vfs_fseek(info->infile, curpos, SEEK_SET);
434 } 434 }
435 435
436 #ifdef DEBUG 436 #ifdef DEBUG
437 g_message("e: input_read_tag"); 437 g_message("e: input_read_tag");
438 #endif 438 #endif
453 g_free(info->title); 453 g_free(info->title);
454 info->title = NULL; 454 info->title = NULL;
455 aud_tuple_disassociate(info->tuple, FIELD_TITLE, NULL); 455 aud_tuple_disassociate(info->tuple, FIELD_TITLE, NULL);
456 aud_tuple_disassociate(info->tuple, FIELD_ALBUM, NULL); 456 aud_tuple_disassociate(info->tuple, FIELD_ALBUM, NULL);
457 457
458 tmp = vfs_get_metadata(info->infile, "track-name"); 458 tmp = aud_vfs_get_metadata(info->infile, "track-name");
459 if(tmp){ 459 if(tmp){
460 metadata = TRUE; 460 metadata = TRUE;
461 gchar *scratch; 461 gchar *scratch;
462 462
463 scratch = str_to_utf8(tmp); 463 scratch = str_to_utf8(tmp);
466 466
467 g_free(tmp); 467 g_free(tmp);
468 tmp = NULL; 468 tmp = NULL;
469 } 469 }
470 470
471 tmp = vfs_get_metadata(info->infile, "stream-name"); 471 tmp = aud_vfs_get_metadata(info->infile, "stream-name");
472 if(tmp){ 472 if(tmp){
473 metadata = TRUE; 473 metadata = TRUE;
474 gchar *scratch; 474 gchar *scratch;
475 475
476 scratch = str_to_utf8(tmp); 476 scratch = str_to_utf8(tmp);
536 #endif 536 #endif
537 return FALSE; 537 return FALSE;
538 } 538 }
539 539
540 /* reset the input file to the start */ 540 /* reset the input file to the start */
541 vfs_fseek(info->infile, 0, SEEK_SET); 541 aud_vfs_fseek(info->infile, 0, SEEK_SET);
542 info->offset = 0; 542 info->offset = 0;
543 543
544 /* use the filename for the title as a last resort */ 544 /* use the filename for the title as a last resort */
545 if (!info->title) { 545 if (!info->title) {
546 char *pos = strrchr(info->filename, DIR_SEPARATOR); //XXX info->filename is uri. --yaz 546 char *pos = strrchr(info->filename, DIR_SEPARATOR); //XXX info->filename is uri. --yaz
574 #ifdef DEBUG_INTENSIVELY 574 #ifdef DEBUG_INTENSIVELY
575 g_message ("f: input_get_data: %d", buffer_size); 575 g_message ("f: input_get_data: %d", buffer_size);
576 #endif 576 #endif
577 #endif 577 #endif
578 /* simply read to data from the file */ 578 /* simply read to data from the file */
579 len = vfs_fread(buffer, 1, buffer_size, info->infile); //vfs_fread returns num of elements. 579 len = aud_vfs_fread(buffer, 1, buffer_size, info->infile); //aud_vfs_fread returns num of elements.
580 580
581 if(len == 0 && info->playback){ 581 if(len == 0 && info->playback){
582 info->playback->eof = TRUE; 582 info->playback->eof = TRUE;
583 } 583 }
584 584
605 if (info->url) 605 if (info->url)
606 g_free(info->url); 606 g_free(info->url);
607 if (info->filename) 607 if (info->filename)
608 g_free(info->filename); 608 g_free(info->filename);
609 if (info->infile) 609 if (info->infile)
610 vfs_fclose(info->infile); 610 aud_vfs_fclose(info->infile);
611 if (info->id3file) 611 if (info->id3file)
612 id3_file_close(info->id3file); 612 id3_file_close(info->id3file);
613 613
614 if (info->replaygain_album_str) 614 if (info->replaygain_album_str)
615 g_free(info->replaygain_album_str); 615 g_free(info->replaygain_album_str);