Changeset 472 for audacious-musepack/trunk/libmpc.cpp
- Timestamp:
- 06/18/11 14:56:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
audacious-musepack/trunk/libmpc.cpp
r468 r472 62 62 VFSFile *file = (VFSFile *) d->data; 63 63 64 return (mpc_int32_t) aud_vfs_fread(ptr, 1, size, file);64 return (mpc_int32_t) vfs_fread(ptr, 1, size, file); 65 65 } 66 66 … … 70 70 VFSFile *file = (VFSFile *) d->data; 71 71 72 return d->canseek(d) ? aud_vfs_fseek(file, offset, SEEK_SET) == 0 : FALSE;72 return d->canseek(d) ? vfs_fseek(file, offset, SEEK_SET) == 0 : FALSE; 73 73 } 74 74 … … 78 78 VFSFile *file = (VFSFile *) d->data; 79 79 80 return aud_vfs_ftell(file);80 return vfs_ftell(file); 81 81 } 82 82 … … 87 87 VFSFile *file = (VFSFile *) d->data; 88 88 89 f_pos = aud_vfs_ftell(file); 90 aud_vfs_fseek(file, 0, SEEK_END); 91 f_size = aud_vfs_ftell(file); 92 aud_vfs_fseek(file, f_pos, SEEK_SET); 89 f_pos = vfs_ftell(file); 90 if (vfs_fseek(file, 0, SEEK_END) != 0) { 91 AUDDBG("Could not seek to the end of file\n"); 92 return 0; 93 } 94 f_size = vfs_ftell(file); 95 if (vfs_fseek(file, f_pos, SEEK_SET) != 0) 96 AUDDBG("Could not seek to %d\n", f_pos); 93 97 94 98 return f_size; … … 115 119 p_reader->canseek = aud_vfs_canseek_impl; 116 120 p_reader->data = input; // no worries, it gets cast back -nenolod 117 aud_vfs_fseek(input, 0, SEEK_SET); 121 if (vfs_fseek(input, 0, SEEK_SET) != 0) 122 AUDDBG("Could not seek to the beginning of file\n"); 118 123 } 119 124 … … 138 143 char* titleText = g_strdup_printf(_("Musepack Decoder Plugin %s"), VERSION); 139 144 const char* contentText = _("Plugin code by\nBenoit Amiaux\nMartin Spuler\nKuniklo\nNicolas Botti\n\nGet latest version at http://musepack.net\n"); 140 const char* buttonText = _("Nevermind"); 141 aboutBox = audacious_info_dialog(titleText, contentText, buttonText, FALSE, NULL, NULL); 145 audgui_simple_message (& aboutBox, GTK_MESSAGE_INFO, titleText, contentText); 142 146 widgets.aboutBox = aboutBox; 143 147 g_signal_connect(G_OBJECT(aboutBox), "destroy", G_CALLBACK(gtk_widget_destroyed), &widgets.aboutBox); … … 271 275 { 272 276 gchar magic[4]; 273 aud_vfs_fread(magic, 1, 4, file); 277 if (4 != vfs_fread(magic, 1, 4, file)) 278 return 0; 274 279 if (memcmp(magic, "MP+", 3) == 0) 275 280 return 1; … … 419 424 420 425 if (input == 0) { 421 input = aud_vfs_fopen(p_Filename, "rb");426 input = vfs_fopen(p_Filename, "rb"); 422 427 if (input == 0) { 423 428 gchar* temp = g_strdup_printf("[xmms-musepack] mpcGetTuple is unable to open %s\n", p_Filename); … … 429 434 } 430 435 431 tuple = aud_tuple_new_from_filename(p_Filename);436 tuple = tuple_new_from_filename(p_Filename); 432 437 433 438 mpc_streaminfo info; … … 438 443 mpc_demux_exit(demux); 439 444 440 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, static_cast<int> (1000 * mpc_streaminfo_get_length(&info)));445 tuple_associate_int(tuple, FIELD_LENGTH, NULL, static_cast<int> (1000 * mpc_streaminfo_get_length(&info))); 441 446 442 447 gchar *scratch = g_strdup_printf("Musepack v%d (encoder %s)", info.stream_version, info.encoder); 443 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, scratch);448 tuple_associate_string(tuple, FIELD_CODEC, NULL, scratch); 444 449 g_free(scratch); 445 450 446 451 scratch = g_strdup_printf("lossy (%s)", info.profile_name); 447 aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, scratch);452 tuple_associate_string(tuple, FIELD_QUALITY, NULL, scratch); 448 453 g_free(scratch); 449 454 450 aud_tuple_associate_int(tuple, FIELD_BITRATE, NULL, static_cast<int> (info.average_bitrate / 1000));455 tuple_associate_int(tuple, FIELD_BITRATE, NULL, static_cast<int> (info.average_bitrate / 1000)); 451 456 452 457 MpcInfo tags = getTags(p_Filename); 453 458 454 aud_tuple_associate_string(tuple, FIELD_DATE, NULL, tags.date);455 aud_tuple_associate_string(tuple, FIELD_TITLE, NULL, tags.title);456 aud_tuple_associate_string(tuple, FIELD_ARTIST, NULL, tags.artist);457 aud_tuple_associate_string(tuple, FIELD_ALBUM, NULL, tags.album);458 aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, tags.track);459 aud_tuple_associate_int(tuple, FIELD_YEAR, NULL, tags.year);460 aud_tuple_associate_string(tuple, FIELD_GENRE, NULL, tags.genre);461 aud_tuple_associate_string(tuple, FIELD_COMMENT, NULL, tags.comment);459 tuple_associate_string(tuple, FIELD_DATE, NULL, tags.date); 460 tuple_associate_string(tuple, FIELD_TITLE, NULL, tags.title); 461 tuple_associate_string(tuple, FIELD_ARTIST, NULL, tags.artist); 462 tuple_associate_string(tuple, FIELD_ALBUM, NULL, tags.album); 463 tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, tags.track); 464 tuple_associate_int(tuple, FIELD_YEAR, NULL, tags.year); 465 tuple_associate_string(tuple, FIELD_GENRE, NULL, tags.genre); 466 tuple_associate_string(tuple, FIELD_COMMENT, NULL, tags.comment); 462 467 463 468 freeTags(tags); 464 469 465 470 if (close_input) 466 aud_vfs_fclose(input);471 vfs_fclose(input); 467 472 468 473 return tuple; … … 644 649 GtkWidget* albumGainLabel = mpcGtkLabel(infoVbox); 645 650 646 VFSFile *input = aud_vfs_fopen(p_Filename, "rb");651 VFSFile *input = vfs_fopen(p_Filename, "rb"); 647 652 if(input) 648 653 { … … 689 694 g_free(entry); 690 695 freeTags(tags); 691 aud_vfs_fclose(input);696 vfs_fclose(input); 692 697 } 693 698 else … … 726 731 mpcDecoder.isAlive = false; 727 732 if(p_FileHandle) 728 aud_vfs_fclose(p_FileHandle);733 vfs_fclose(p_FileHandle); 729 734 return 0; 730 735 } … … 755 760 lockAcquire(); 756 761 gchar* filename = data->filename; 757 VFSFile *input = aud_vfs_fopen(filename, "rb");762 VFSFile *input = vfs_fopen(filename, "rb"); 758 763 if (!input) 759 764 { … … 847 852 mpcConfigBox, // configure : Show Configure box 848 853 0, // PluginPreferences *settings 854 0, // sendmsg 849 855 850 856 0, // gboolean have_subtune : Plugin supports/uses subtunes. 851 857 (gchar **)mpc_fmts, // vfs_extensions 852 0, // GList *(*scan_dir) (gchar * dirname); 853 0, // is_our_file 858 0, // priority 854 859 mpcIsOurFD, // is_our_file_from_vfs 860 mpcGetSongTuple, // get_song_tuple : Acquire tuple for song 855 861 mpcProbeForTuple, // Tuple *(*probe_for_tuple)(gchar *uri, VFSFile *fd); 856 mpcPlay, // play_file 862 0, // gboolean (*update_song_tuple)(Tuple *tuple, VFSFile *fd); 863 mpcFileInfoBox, // file_info_box : Show File Info Box 864 0, // get_song_image 865 0, // play 866 mpcPause, // pause 867 mpcSeekm, // void (*mseek) (InputPlayback * playback, gulong millisecond); 857 868 mpcStop, // stop 858 mpcPause, // pause859 mpcSeek, // seek860 mpcSeekm, // void (*mseek) (InputPlayback * playback, gulong millisecond);861 869 0, // get_time 862 870 0, // get_volume 863 871 0, // set_volume 864 mpcFileInfoBox, // file_info_box : Show File Info Box 865 mpcGetSongTuple, // get_song_tuple : Acquire tuple for song 866 0, // gboolean (*update_song_tuple)(Tuple *tuple, VFSFile *fd); 867 0 //gint priority; /* 0 = first, 10 = last */ 872 873 /* Deprecated */ 874 0, // is_our_file 875 mpcPlay, // play_file 876 mpcSeek, // seek 868 877 }; 869 878
Note: See TracChangeset
for help on using the changeset viewer.