Mercurial > audlegacy-plugins
comparison src/sndfile/plugin.c @ 2551:92300fe06f15
Cosmetic cleanups / indentation.
| author | Matti Hamalainen <ccr@tnsp.org> |
|---|---|
| date | Thu, 08 May 2008 21:56:41 +0300 |
| parents | 6fdb69f0f169 |
| children | 7d7f7d9ae98e |
comparison
equal
deleted
inserted
replaced
| 2550:6fdb69f0f169 | 2551:92300fe06f15 |
|---|---|
| 52 static GThread *decode_thread; | 52 static GThread *decode_thread; |
| 53 static GMutex *decode_mutex; | 53 static GMutex *decode_mutex; |
| 54 static GCond *decode_cond; | 54 static GCond *decode_cond; |
| 55 | 55 |
| 56 | 56 |
| 57 | 57 static sf_count_t |
| 58 | 58 sf_get_filelen (void *user_data) |
| 59 static sf_count_t sf_get_filelen (void *user_data) | |
| 60 { | 59 { |
| 61 return aud_vfs_fsize (user_data); | 60 return aud_vfs_fsize (user_data); |
| 62 } | 61 } |
| 63 static sf_count_t sf_vseek (sf_count_t offset, int whence, void *user_data) | 62 |
| 63 static sf_count_t | |
| 64 sf_vseek (sf_count_t offset, int whence, void *user_data) | |
| 64 { | 65 { |
| 65 return aud_vfs_fseek(user_data, offset, whence); | 66 return aud_vfs_fseek(user_data, offset, whence); |
| 66 } | 67 } |
| 67 static sf_count_t sf_vread (void *ptr, sf_count_t count, void *user_data) | 68 |
| 69 static sf_count_t | |
| 70 sf_vread (void *ptr, sf_count_t count, void *user_data) | |
| 68 { | 71 { |
| 69 return aud_vfs_fread(ptr, 1, count, user_data); | 72 return aud_vfs_fread(ptr, 1, count, user_data); |
| 70 } | 73 } |
| 71 static sf_count_t sf_vwrite (const void *ptr, sf_count_t count, void *user_data) | 74 |
| 75 static sf_count_t | |
| 76 sf_vwrite (const void *ptr, sf_count_t count, void *user_data) | |
| 72 { | 77 { |
| 73 return aud_vfs_fwrite(ptr, 1, count, user_data); | 78 return aud_vfs_fwrite(ptr, 1, count, user_data); |
| 74 } | 79 } |
| 75 static sf_count_t sf_tell (void *user_data) | 80 |
| 81 static sf_count_t | |
| 82 sf_tell (void *user_data) | |
| 76 { | 83 { |
| 77 return aud_vfs_ftell(user_data); | 84 return aud_vfs_ftell(user_data); |
| 78 } | 85 } |
| 86 | |
| 79 static SF_VIRTUAL_IO sf_virtual_io = | 87 static SF_VIRTUAL_IO sf_virtual_io = |
| 80 { | 88 { |
| 81 sf_get_filelen, | 89 sf_get_filelen, |
| 82 sf_vseek, | 90 sf_vseek, |
| 83 sf_vread, | 91 sf_vread, |
| 84 sf_vwrite, | 92 sf_vwrite, |
| 85 sf_tell | 93 sf_tell |
| 86 }; | 94 }; |
| 87 | 95 |
| 96 | |
| 88 static SNDFILE * | 97 static SNDFILE * |
| 89 open_sndfile_from_uri(gchar *filename, VFSFile *vfsfile, SF_INFO *tmp_sfinfo) | 98 open_sndfile_from_uri(gchar *filename, VFSFile *vfsfile, SF_INFO *tmp_sfinfo) |
| 90 { | 99 { |
| 91 SNDFILE *snd_file = NULL; | 100 SNDFILE *snd_file = NULL; |
| 92 vfsfile = aud_vfs_fopen(filename, "rb"); | 101 vfsfile = aud_vfs_fopen(filename, "rb"); |
| 105 close_sndfile(SNDFILE *snd_file, VFSFile *vfsfile) | 114 close_sndfile(SNDFILE *snd_file, VFSFile *vfsfile) |
| 106 { | 115 { |
| 107 sf_close(snd_file); | 116 sf_close(snd_file); |
| 108 aud_vfs_fclose(vfsfile); | 117 aud_vfs_fclose(vfsfile); |
| 109 } | 118 } |
| 110 | |
| 111 | 119 |
| 112 | 120 |
| 113 static void | 121 static void |
| 114 plugin_init (void) | 122 plugin_init (void) |
| 115 { | 123 { |
| 317 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "lossy"); | 325 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "lossy"); |
| 318 else | 326 else |
| 319 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "lossless"); | 327 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "lossless"); |
| 320 } | 328 } |
| 321 | 329 |
| 322 static gchar *get_title(gchar *filename) | 330 static gchar * |
| 331 get_title(gchar *filename) | |
| 323 { | 332 { |
| 324 Tuple *tuple; | 333 Tuple *tuple; |
| 325 gchar *title; | 334 gchar *title; |
| 326 | 335 |
| 327 tuple = aud_tuple_new_from_filename(filename); | 336 tuple = aud_tuple_new_from_filename(filename); |
| 519 Tuple *ti = aud_tuple_new_from_filename(filename); | 528 Tuple *ti = aud_tuple_new_from_filename(filename); |
| 520 fill_song_tuple(filename, ti); | 529 fill_song_tuple(filename, ti); |
| 521 return ti; | 530 return ti; |
| 522 } | 531 } |
| 523 | 532 |
| 524 static gint is_our_file_from_vfs(gchar *filename, VFSFile *fin) | 533 static gint |
| 534 is_our_file_from_vfs(gchar *filename, VFSFile *fin) | |
| 525 { | 535 { |
| 526 SNDFILE *tmp_sndfile; | 536 SNDFILE *tmp_sndfile; |
| 527 SF_INFO tmp_sfinfo; | 537 SF_INFO tmp_sfinfo; |
| 528 | 538 |
| 529 /* Have to open the file to see if libsndfile can handle it. */ | 539 /* Have to open the file to see if libsndfile can handle it. */ |
| 543 | 553 |
| 544 static void plugin_about(void) | 554 static void plugin_about(void) |
| 545 { | 555 { |
| 546 if (!sndfile_about_box) | 556 if (!sndfile_about_box) |
| 547 { | 557 { |
| 548 sndfile_about_box = audacious_info_dialog(_("About sndfile plugin"), | 558 sndfile_about_box = audacious_info_dialog( |
| 549 _("Adapted for Audacious usage by Tony Vroon <chainsaw@gentoo.org>\n" | 559 _("About sndfile plugin"), |
| 550 "from the xmms_sndfile plugin which is:\n" | 560 _("Adapted for Audacious usage by Tony Vroon <chainsaw@gentoo.org>\n" |
| 551 "Copyright (C) 2000, 2002 Erik de Castro Lopo\n\n" | 561 "from the xmms_sndfile plugin which is:\n" |
| 552 "This program is free software ; you can redistribute it and/or modify \n" | 562 "Copyright (C) 2000, 2002 Erik de Castro Lopo\n\n" |
| 553 "it under the terms of the GNU General Public License as published by \n" | 563 "This program is free software ; you can redistribute it and/or modify \n" |
| 554 "the Free Software Foundation ; either version 2 of the License, or \n" | 564 "it under the terms of the GNU General Public License as published by \n" |
| 555 "(at your option) any later version. \n \n" | 565 "the Free Software Foundation ; either version 2 of the License, or \n" |
| 556 "This program is distributed in the hope that it will be useful, \n" | 566 "(at your option) any later version. \n \n" |
| 557 "but WITHOUT ANY WARRANTY ; without even the implied warranty of \n" | 567 "This program is distributed in the hope that it will be useful, \n" |
| 558 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n" | 568 "but WITHOUT ANY WARRANTY ; without even the implied warranty of \n" |
| 559 "See the GNU General Public License for more details. \n\n" | 569 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n" |
| 560 "You should have received a copy of the GNU General Public \n" | 570 "See the GNU General Public License for more details. \n\n" |
| 561 "License along with this program ; if not, write to \n" | 571 "You should have received a copy of the GNU General Public \n" |
| 562 "the Free Software Foundation, Inc., \n" | 572 "License along with this program ; if not, write to \n" |
| 563 "51 Franklin Street, Fifth Floor, \n" | 573 "the Free Software Foundation, Inc., \n" |
| 564 "Boston, MA 02110-1301 USA"), | 574 "51 Franklin Street, Fifth Floor, \n" |
| 565 _("Ok"), FALSE, NULL, NULL); | 575 "Boston, MA 02110-1301 USA"), |
| 576 _("Ok"), FALSE, NULL, NULL); | |
| 566 g_signal_connect(G_OBJECT(sndfile_about_box), "destroy", | 577 g_signal_connect(G_OBJECT(sndfile_about_box), "destroy", |
| 567 (GCallback)gtk_widget_destroyed, &sndfile_about_box); | 578 (GCallback)gtk_widget_destroyed, &sndfile_about_box); |
| 568 } | 579 } |
| 569 } | 580 } |
| 581 | |
| 570 | 582 |
| 571 static gchar *fmts[] = { "aiff", "au", "raw", "wav", NULL }; | 583 static gchar *fmts[] = { "aiff", "au", "raw", "wav", NULL }; |
| 572 | 584 |
| 573 InputPlugin sndfile_ip = { | 585 InputPlugin sndfile_ip = { |
| 574 .description = "sndfile plugin", | 586 .description = "sndfile plugin", |
