# HG changeset patch # User Matti Hamalainen # Date 1210274200 -10800 # Node ID d26db7f0812476281921d02e670b3463bb520ea8 # Parent 04b1b020be88670cf8d38224378049e4e42e2a71# Parent d3432c34e81758d5437875704f75115704c4ff48 Automated merge with ssh://hg.atheme.org//hg/audacious-plugins diff -r d3432c34e817 -r d26db7f08124 src/modplug/gui/Makefile --- a/src/modplug/gui/Makefile Wed May 07 19:10:06 2008 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -STATIC_LIB_NOINST = libgui.a - -SRCS = main.cxx \ - support.cxx \ - interface.cxx \ - callbacks.cxx - -include ../../../buildsys.mk -include ../../../extra.mk - -CFLAGS += ${PLUGIN_CFLAGS} -CXXFLAGS += ${PLUGIN_CFLAGS} -CPPFLAGS += ${MOWGLI_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} -I../../.. diff -r d3432c34e817 -r d26db7f08124 src/sndfile/plugin.c --- a/src/sndfile/plugin.c Wed May 07 19:10:06 2008 +0300 +++ b/src/sndfile/plugin.c Thu May 08 22:16:40 2008 +0300 @@ -45,8 +45,8 @@ static SNDFILE *sndfile = NULL; static SF_INFO sfinfo; -static int song_length; -static int bit_rate = 0; +static gint song_length; +static gint bit_rate = 0; static glong seek_time = -1; static GThread *decode_thread; @@ -54,28 +54,36 @@ static GCond *decode_cond; - - -static sf_count_t sf_get_filelen (void *user_data) +static sf_count_t +sf_get_filelen (void *user_data) { return aud_vfs_fsize (user_data); } -static sf_count_t sf_vseek (sf_count_t offset, int whence, void *user_data) + +static sf_count_t +sf_vseek (sf_count_t offset, int whence, void *user_data) { return aud_vfs_fseek(user_data, offset, whence); } -static sf_count_t sf_vread (void *ptr, sf_count_t count, void *user_data) + +static sf_count_t +sf_vread (void *ptr, sf_count_t count, void *user_data) { return aud_vfs_fread(ptr, 1, count, user_data); } -static sf_count_t sf_vwrite (const void *ptr, sf_count_t count, void *user_data) + +static sf_count_t +sf_vwrite (const void *ptr, sf_count_t count, void *user_data) { return aud_vfs_fwrite(ptr, 1, count, user_data); } -static sf_count_t sf_tell (void *user_data) + +static sf_count_t +sf_tell (void *user_data) { return aud_vfs_ftell(user_data); } + static SF_VIRTUAL_IO sf_virtual_io = { sf_get_filelen, @@ -85,18 +93,19 @@ sf_tell }; + static SNDFILE * -open_sndfile_from_uri(gchar *filename, VFSFile *vfsfile, SF_INFO *tmp_sfinfo) +open_sndfile_from_uri(gchar *filename, VFSFile **vfsfile, SF_INFO *tmp_sfinfo) { SNDFILE *snd_file = NULL; - vfsfile = aud_vfs_fopen(filename, "rb"); + *vfsfile = aud_vfs_fopen(filename, "rb"); - if (vfsfile == NULL) + if (*vfsfile == NULL) return NULL; - snd_file = sf_open_virtual (&sf_virtual_io, SFM_READ, tmp_sfinfo, vfsfile); + snd_file = sf_open_virtual (&sf_virtual_io, SFM_READ, tmp_sfinfo, *vfsfile); if (snd_file == NULL) - aud_vfs_fclose(vfsfile); + aud_vfs_fclose(*vfsfile); return snd_file; } @@ -109,7 +118,6 @@ } - static void plugin_init (void) { @@ -127,16 +135,15 @@ } static void -fill_song_tuple (char *filename, Tuple *ti) +fill_song_tuple (gchar *filename, Tuple *ti) { VFSFile *vfsfile = NULL; SNDFILE *tmp_sndfile; SF_INFO tmp_sfinfo; - unsigned int lossy = 0; - gchar *codec = NULL, *format, *subformat = NULL; - GString *codec_gs = NULL; + gboolean lossy = FALSE; + gchar *codec, *format, *subformat; - tmp_sndfile = open_sndfile_from_uri(filename, vfsfile, &tmp_sfinfo); + tmp_sndfile = open_sndfile_from_uri(filename, &vfsfile, &tmp_sfinfo); if ( sf_get_string(tmp_sndfile, SF_STR_TITLE) == NULL) aud_tuple_associate_string(ti, FIELD_TITLE, NULL, g_path_get_basename(filename)); else @@ -151,10 +158,9 @@ return; close_sndfile (tmp_sndfile, vfsfile); - tmp_sndfile = NULL; if (tmp_sfinfo.samplerate > 0) - aud_tuple_associate_int(ti, FIELD_LENGTH, NULL, (int) ceil (1000.0 * tmp_sfinfo.frames / tmp_sfinfo.samplerate)); + aud_tuple_associate_int(ti, FIELD_LENGTH, NULL, (gint) ceil (1000.0 * tmp_sfinfo.frames / tmp_sfinfo.samplerate)); switch (tmp_sfinfo.format & SF_FORMAT_TYPEMASK) { @@ -220,8 +226,9 @@ format = "Core Audio File"; break; default: - format = "unknown sndfile"; + format = "Unknown sndfile"; } + switch (tmp_sfinfo.format & SF_FORMAT_SUBMASK) { case SF_FORMAT_PCM_S8: @@ -247,79 +254,78 @@ break; case SF_FORMAT_ULAW: subformat = "U-Law"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_ALAW: subformat = "A-Law"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_IMA_ADPCM: subformat = "IMA ADPCM"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_MS_ADPCM: subformat = "MS ADPCM"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_GSM610: subformat = "GSM 6.10"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_VOX_ADPCM: subformat = "Oki Dialogic ADPCM"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_G721_32: subformat = "32kbs G721 ADPCM"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_G723_24: subformat = "24kbs G723 ADPCM"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_G723_40: subformat = "40kbs G723 ADPCM"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_DWVW_12: subformat = "12 bit Delta Width Variable Word"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_DWVW_16: subformat = "16 bit Delta Width Variable Word"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_DWVW_24: subformat = "24 bit Delta Width Variable Word"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_DWVW_N: subformat = "N bit Delta Width Variable Word"; - lossy = 1; + lossy = TRUE; break; case SF_FORMAT_DPCM_8: subformat = "8 bit differential PCM"; break; case SF_FORMAT_DPCM_16: subformat = "16 bit differential PCM"; + break; + default: + subformat = NULL; } - codec_gs = g_string_new(""); if (subformat != NULL) - g_string_append_printf(codec_gs, "%s (%s)", format, subformat); + codec = g_strdup_printf("%s (%s)", format, subformat); else - g_string_append_printf(codec_gs, "%s", format); - codec = g_strdup(codec_gs->str); - g_string_free(codec_gs, TRUE); + codec = g_strdup_printf("%s", format); aud_tuple_associate_string(ti, FIELD_CODEC, NULL, codec); - - if (lossy != 0) - aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "lossy"); - else - aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "lossless"); + g_free(codec); + + aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, lossy ? "lossy" : "lossless"); } -static gchar *get_title(char *filename) +static gchar * +get_title(gchar *filename) { Tuple *tuple; gchar *title; @@ -337,19 +343,18 @@ return title; } -static int -is_our_file (char *filename) +static gint +is_our_file (gchar *filename) { VFSFile *vfsfile = NULL; SNDFILE *tmp_sndfile; SF_INFO tmp_sfinfo; /* Have to open the file to see if libsndfile can handle it. */ - tmp_sndfile = open_sndfile_from_uri(filename, vfsfile, &tmp_sfinfo); + tmp_sndfile = open_sndfile_from_uri(filename, &vfsfile, &tmp_sfinfo); - if (!tmp_sndfile) { + if (!tmp_sndfile) return FALSE; - } /* It can so close file and return TRUE. */ close_sndfile (tmp_sndfile, vfsfile); @@ -361,8 +366,8 @@ static gpointer play_loop (gpointer arg) { - static short buffer [BUFFER_SIZE]; - int samples; + gshort buffer[BUFFER_SIZE]; + gint samples; InputPlayback *playback = arg; for (;;) @@ -386,7 +391,7 @@ } playback->pass_audio(playback, FMT_S16_NE, sfinfo.channels, - samples * sizeof (short), buffer, &playback->playing); + samples * sizeof(buffer[0]), buffer, &playback->playing); } else { while(playback->output->buffer_playing()) { @@ -432,7 +437,7 @@ play_start (InputPlayback *playback) { VFSFile *vfsfile = NULL; - int pcmbitwidth; + gint pcmbitwidth; gchar *song_title; if (sndfile) /* already opened */ @@ -441,7 +446,7 @@ pcmbitwidth = 32; song_title = get_title(playback->filename); - sndfile = open_sndfile_from_uri(playback->filename, vfsfile, &sfinfo); + sndfile = open_sndfile_from_uri(playback->filename, &vfsfile, &sfinfo); if (!sndfile) return; @@ -449,7 +454,7 @@ bit_rate = sfinfo.samplerate * pcmbitwidth; if (sfinfo.samplerate > 0) - song_length = (int) ceil (1000.0 * sfinfo.frames / sfinfo.samplerate); + song_length = (gint) ceil (1000.0 * sfinfo.frames / sfinfo.samplerate); else song_length = 0; @@ -497,7 +502,7 @@ static void file_mseek (InputPlayback *playback, gulong millisecond) { - if (! sfinfo.seekable) + if (!sfinfo.seekable) return; seek_time = (glong)millisecond; @@ -521,7 +526,8 @@ return ti; } -static int is_our_file_from_vfs(char *filename, VFSFile *fin) +static gint +is_our_file_from_vfs(gchar *filename, VFSFile *fin) { SNDFILE *tmp_sndfile; SF_INFO tmp_sfinfo; @@ -539,34 +545,37 @@ return TRUE; } +static GtkWidget *sndfile_about_box = NULL; + static void plugin_about(void) { - static GtkWidget *box; - if (!box) + if (!sndfile_about_box) { - box = audacious_info_dialog(_("About sndfile plugin"), - _("Adapted for Audacious usage by Tony Vroon \n" - "from the xmms_sndfile plugin which is:\n" - "Copyright (C) 2000, 2002 Erik de Castro Lopo\n\n" - "This program is free software ; you can redistribute it and/or modify \n" - "it under the terms of the GNU General Public License as published by \n" - "the Free Software Foundation ; either version 2 of the License, or \n" - "(at your option) any later version. \n \n" - "This program is distributed in the hope that it will be useful, \n" - "but WITHOUT ANY WARRANTY ; without even the implied warranty of \n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n" - "See the GNU General Public License for more details. \n\n" - "You should have received a copy of the GNU General Public \n" - "License along with this program ; if not, write to \n" - "the Free Software Foundation, Inc., \n" - "51 Franklin Street, Fifth Floor, \n" - "Boston, MA 02110-1301 USA"), - _("Ok"), FALSE, NULL, NULL); - g_signal_connect(G_OBJECT(box), "destroy", - (GCallback)gtk_widget_destroyed, &box); + sndfile_about_box = audacious_info_dialog( + _("About sndfile plugin"), + _("Adapted for Audacious usage by Tony Vroon \n" + "from the xmms_sndfile plugin which is:\n" + "Copyright (C) 2000, 2002 Erik de Castro Lopo\n\n" + "This program is free software ; you can redistribute it and/or modify \n" + "it under the terms of the GNU General Public License as published by \n" + "the Free Software Foundation ; either version 2 of the License, or \n" + "(at your option) any later version. \n \n" + "This program is distributed in the hope that it will be useful, \n" + "but WITHOUT ANY WARRANTY ; without even the implied warranty of \n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n" + "See the GNU General Public License for more details. \n\n" + "You should have received a copy of the GNU General Public \n" + "License along with this program ; if not, write to \n" + "the Free Software Foundation, Inc., \n" + "51 Franklin Street, Fifth Floor, \n" + "Boston, MA 02110-1301 USA"), + _("Ok"), FALSE, NULL, NULL); + g_signal_connect(G_OBJECT(sndfile_about_box), "destroy", + (GCallback)gtk_widget_destroyed, &sndfile_about_box); } } + static gchar *fmts[] = { "aiff", "au", "raw", "wav", NULL }; InputPlugin sndfile_ip = {