From ccd268fd5a762b9d2bbfd746ebc3dcdaa1f886a8 Mon Sep 17 00:00:00 2001 From: Michael Schwendt Date: Jun 15 2011 10:19:50 +0000 Subject: Patch for Audacious 3.0-alpha1 GUI API. --- diff --git a/audacious-plugin-fc-0.6-aud30.patch b/audacious-plugin-fc-0.6-aud30.patch new file mode 100644 index 0000000..92a9eb4 --- /dev/null +++ b/audacious-plugin-fc-0.6-aud30.patch @@ -0,0 +1,649 @@ +diff -Nur audacious-plugin-fc-0.6-orig/ChangeLog audacious-plugin-fc-0.6.2/ChangeLog +--- audacious-plugin-fc-0.6-orig/ChangeLog 2010-07-23 09:55:26.000000000 +0200 ++++ audacious-plugin-fc-0.6.2/ChangeLog 2011-06-15 11:37:15.000000000 +0200 +@@ -1,3 +1,17 @@ ++2011-06-15 Michael Schwendt ++ ++ * use Audacious GUI API instead of native GTK+ ++ * require at least Audacious 3.0-alpha1 ++ ++2011-04-07 Michael Schwendt ++ ++ * src/about.c, src/configure.c: replace deprecated GTK+ stuff ++ * src/main.c: successful end of play() should return TRUE ++ ++2011-02-02 Michael Schwendt ++ ++ * src/main.c, src/plugin.c: port to Audacious 2.5 alpha1 API ++ + 2010-07-23 Michael Schwendt + + * src/plugin.c: use probe_for_tuple instead of get_song_tuple, +diff -Nur audacious-plugin-fc-0.6-orig/src/about.c audacious-plugin-fc-0.6.2/src/about.c +--- audacious-plugin-fc-0.6-orig/src/about.c 2010-06-20 19:00:14.000000000 +0200 ++++ audacious-plugin-fc-0.6.2/src/about.c 2011-06-15 11:34:19.000000000 +0200 +@@ -1,66 +1,12 @@ ++#include ++#include + #include ++#include + #include "config.h" + +-static GtkWidget *about_window = NULL; ++void fc_ip_about() { ++ static GtkWidget *about_window = NULL; + +-void fc_ip_about() +-{ +- /* This code has been taken from J. Nick Koston's Mikmod plugin +- * which comes with the XMMS distribution. */ +- +- GtkWidget *dialog_vbox1; +- GtkWidget *hbox1; +- GtkWidget *label1; +- GtkWidget *dialog_action_area1; +- GtkWidget *about_exit; +- GtkStyle *style; +- +- if (!about_window) +- { +- about_window = gtk_dialog_new(); +- gtk_object_set_data(GTK_OBJECT(about_window), "about_window", about_window); +- gtk_window_set_title(GTK_WINDOW(about_window), "About Future Composer plugin"); +- gtk_window_set_policy(GTK_WINDOW(about_window), FALSE, FALSE, FALSE); +- gtk_window_set_position(GTK_WINDOW(about_window), GTK_WIN_POS_MOUSE); +- gtk_signal_connect(GTK_OBJECT(about_window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &about_window); +- gtk_container_border_width(GTK_CONTAINER(about_window), 10); +- +- dialog_vbox1 = GTK_DIALOG(about_window)->vbox; +- gtk_object_set_data(GTK_OBJECT(about_window), "dialog_vbox1", dialog_vbox1); +- gtk_widget_show(dialog_vbox1); +- gtk_container_border_width(GTK_CONTAINER(dialog_vbox1), 5); +- +- hbox1 = gtk_hbox_new(FALSE, 0); +- gtk_object_set_data(GTK_OBJECT(about_window), "hbox1", hbox1); +- gtk_widget_show(hbox1); +- gtk_box_pack_start(GTK_BOX(dialog_vbox1), hbox1, TRUE, TRUE, 0); +- gtk_container_border_width(GTK_CONTAINER(hbox1), 5); +- gtk_widget_realize(about_window); +- +- label1 = gtk_label_new("Future Composer player plugin\nVersion " VERSION "\nhttp://xmms-fc.sourceforge.net\nCreated by Michael Schwendt.\n\nMuch room for improvement.\nHave a go if you like to.\n"); +- gtk_object_set_data(GTK_OBJECT(about_window), "label1", label1); +- gtk_widget_show(label1); +- gtk_box_pack_start(GTK_BOX(hbox1), label1, TRUE, TRUE, 0); +- +- dialog_action_area1 = GTK_DIALOG(about_window)->action_area; +- gtk_object_set_data(GTK_OBJECT(about_window), "dialog_action_area1", dialog_action_area1); +- gtk_widget_show(dialog_action_area1); +- gtk_container_border_width(GTK_CONTAINER(dialog_action_area1), 10); +- +- about_exit = gtk_button_new_with_label("Ok"); +- gtk_signal_connect_object(GTK_OBJECT(about_exit), "clicked", +- GTK_SIGNAL_FUNC +- (gtk_widget_destroy), +- GTK_OBJECT(about_window)); +- +- gtk_object_set_data(GTK_OBJECT(about_window), "about_exit", about_exit); +- gtk_widget_show(about_exit); +- gtk_box_pack_start(GTK_BOX(dialog_action_area1), about_exit, TRUE, TRUE, 0); +- +- gtk_widget_show(about_window); +- } +- else +- { +- gdk_window_raise(about_window->window); +- } ++ audgui_simple_message(&about_window, GTK_MESSAGE_INFO, ++ g_strdup_printf(_("Future Composer player plugin %s"), VERSION),_("http://xmms-fc.sourceforge.net\nCreated by Michael Schwendt.\n\nMuch room for improvement.\nHave a go if you like to.\n")); + } +diff -Nur audacious-plugin-fc-0.6-orig/src/configure.c audacious-plugin-fc-0.6.2/src/configure.c +--- audacious-plugin-fc-0.6-orig/src/configure.c 2010-07-21 17:02:14.000000000 +0200 ++++ audacious-plugin-fc-0.6.2/src/configure.c 2011-06-15 12:10:55.000000000 +0200 +@@ -1,227 +1,150 @@ + #include + #include +-#include ++#include ++#include + + #include "configure.h" + + FCpluginConfig fc_myConfig; +- +-static void config_ok(GtkWidget *widget, gpointer data); +- +-static GtkWidget *fc_config_window = NULL; ++FCpluginConfig config; + + static gchar configSection[] = "FutureComposer"; + +-static GtkWidget *Bits16; +-static GtkWidget *Bits8; +- +-static GtkWidget *Stereo; +-static GtkWidget *Mono; +- +-static GtkWidget *Sample_48; +-static GtkWidget *Sample_44; +-static GtkWidget *Sample_22; +- + static const gint FREQ_SAMPLE_48 = 48000; + static const gint FREQ_SAMPLE_44 = 44100; + static const gint FREQ_SAMPLE_22 = 22050; + +-void fc_ip_load_config() +-{ ++void fc_ip_load_config() { + mcs_handle_t *cfg; + + fc_myConfig.frequency = FREQ_SAMPLE_44; + fc_myConfig.precision = 8; + fc_myConfig.channels = 1; + +- if ((cfg = aud_cfg_db_open())) +- { ++ if ((cfg = aud_cfg_db_open())) { + aud_cfg_db_get_int(cfg, configSection, "frequency", &fc_myConfig.frequency); + aud_cfg_db_get_int(cfg, configSection, "precision", &fc_myConfig.precision); + aud_cfg_db_get_int(cfg, configSection, "channels", &fc_myConfig.channels); + + aud_cfg_db_close(cfg); + } +-} + +-void fc_ip_configure() +-{ +- GtkWidget *notebook1; +- GtkWidget *vbox; +- GtkWidget *vbox1; +- GtkWidget *hbox1; +- GtkWidget *bitsPerSample_Frame; +- GtkWidget *vbox4; +- GSList *bitsPerSample_group = NULL; +- GtkWidget *Channels_Frame; +- GtkWidget *vbox5; +- GSList *vbox5_group = NULL; +- GtkWidget *frequency_Frame; +- GtkWidget *vbox3; +- GSList *sample_group = NULL; +- GtkWidget *Quality_Label; +- GtkWidget *bbox; +- GtkWidget *ok; +- GtkWidget *cancel; +- +- if (!fc_config_window) +- { +- fc_config_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); +- gtk_window_set_type_hint(GTK_WINDOW(fc_config_window), GDK_WINDOW_TYPE_HINT_DIALOG); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "fc_config_window", fc_config_window); +- gtk_window_set_title(GTK_WINDOW(fc_config_window), "Future Composer player configuration"); +- gtk_window_set_policy(GTK_WINDOW(fc_config_window), FALSE, FALSE, FALSE); +- gtk_window_set_position(GTK_WINDOW(fc_config_window), GTK_WIN_POS_MOUSE); +- gtk_signal_connect(GTK_OBJECT(fc_config_window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &fc_config_window); +- gtk_container_border_width(GTK_CONTAINER(fc_config_window), 10); +- +- vbox = gtk_vbox_new(FALSE, 10); +- gtk_container_add(GTK_CONTAINER(fc_config_window), vbox); +- +- notebook1 = gtk_notebook_new(); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "notebook1", notebook1); +- gtk_box_pack_start(GTK_BOX(vbox), notebook1, TRUE, TRUE, 0); +- gtk_container_border_width(GTK_CONTAINER(notebook1), 3); +- +- vbox1 = gtk_vbox_new(FALSE, 0); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "vbox1", vbox1); +- +- hbox1 = gtk_hbox_new(FALSE, 0); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "hbox1", hbox1); +- gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0); +- +- bitsPerSample_Frame = gtk_frame_new("Bits per sample:"); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "bitsPerSample_Frame", bitsPerSample_Frame); +- gtk_box_pack_start(GTK_BOX(hbox1), bitsPerSample_Frame, TRUE, TRUE, 0); +- gtk_container_set_border_width(GTK_CONTAINER(bitsPerSample_Frame), 5); +- +- vbox4 = gtk_vbox_new(FALSE, 0); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "vbox4", vbox4); +- gtk_container_add(GTK_CONTAINER(bitsPerSample_Frame), vbox4); +- +- Bits16 = gtk_radio_button_new_with_label(bitsPerSample_group, "16 bit"); +- bitsPerSample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Bits16)); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "Bits16", Bits16); +- gtk_box_pack_start(GTK_BOX(vbox4), Bits16, TRUE, TRUE, 0); +- if (fc_myConfig.precision == 16) +- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Bits16), TRUE); +- +- Bits8 = gtk_radio_button_new_with_label(bitsPerSample_group, "8 bit"); +- bitsPerSample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Bits8)); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "Bits8", Bits8); +- gtk_box_pack_start(GTK_BOX(vbox4), Bits8, TRUE, TRUE, 0); +- if (fc_myConfig.precision == 8) +- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Bits8), TRUE); +- +- Channels_Frame = gtk_frame_new("Channels:"); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "Channels_Frame", Channels_Frame); +- gtk_box_pack_start(GTK_BOX(hbox1), Channels_Frame, TRUE, TRUE, 0); +- gtk_container_set_border_width(GTK_CONTAINER(Channels_Frame), 5); +- +- vbox5 = gtk_vbox_new(FALSE, 0); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "vbox5", vbox5); +- gtk_container_add(GTK_CONTAINER(Channels_Frame), vbox5); +- +- Stereo = gtk_radio_button_new_with_label(vbox5_group, "Stereo"); +- vbox5_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Stereo)); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "Stereo", Stereo); +- gtk_box_pack_start(GTK_BOX(vbox5), Stereo, TRUE, TRUE, 0); +- if (fc_myConfig.channels == 2) +- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Stereo), TRUE); +- +- Mono = gtk_radio_button_new_with_label(vbox5_group, "Mono"); +- vbox5_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Mono)); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "Mono", Mono); +- gtk_box_pack_start(GTK_BOX(vbox5), Mono, TRUE, TRUE, 0); +- if (fc_myConfig.channels == 1) +- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Mono), TRUE); +- +- frequency_Frame = gtk_frame_new("Sample frequency:"); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "Frequency_Frame", frequency_Frame); +- gtk_box_pack_start(GTK_BOX(vbox1), frequency_Frame, TRUE, TRUE, 0); +- gtk_container_set_border_width(GTK_CONTAINER(frequency_Frame), 5); +- +- vbox3 = gtk_vbox_new(FALSE, 0); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "vbox3", vbox3); +- gtk_container_add(GTK_CONTAINER(frequency_Frame), vbox3); +- +- Sample_48 = gtk_radio_button_new_with_label(sample_group, "48000 Hz"); +- sample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Sample_48)); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "Sample_48", Sample_48); +- gtk_box_pack_start(GTK_BOX(vbox3), Sample_48, TRUE, TRUE, 0); +- if (fc_myConfig.frequency == FREQ_SAMPLE_48) +- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Sample_48), TRUE); +- +- Sample_44 = gtk_radio_button_new_with_label(sample_group, "44100 Hz"); +- sample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Sample_44)); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "Sample_44", Sample_44); +- gtk_box_pack_start(GTK_BOX(vbox3), Sample_44, TRUE, TRUE, 0); +- if (fc_myConfig.frequency == FREQ_SAMPLE_44) +- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Sample_44), TRUE); +- +- Sample_22 = gtk_radio_button_new_with_label(sample_group, "22050 Hz"); +- sample_group = gtk_radio_button_group(GTK_RADIO_BUTTON(Sample_22)); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "Sample_22", Sample_22); +- gtk_box_pack_start(GTK_BOX(vbox3), Sample_22, TRUE, TRUE, 0); +- if (fc_myConfig.frequency == FREQ_SAMPLE_22) +- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Sample_22), TRUE); +- +- Quality_Label = gtk_label_new("Quality"); +- gtk_object_set_data(GTK_OBJECT(fc_config_window), "Quality_Label", Quality_Label); +- gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), vbox1, Quality_Label); +- +- bbox = gtk_hbutton_box_new(); +- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); +- gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); +- gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); +- +- ok = gtk_button_new_with_label("Ok"); +- gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(config_ok), NULL); +- GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT); +- gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0); +- gtk_widget_grab_default(ok); +- +- cancel = gtk_button_new_with_label("Cancel"); +- gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(fc_config_window)); +- GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); +- gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); +- +- gtk_widget_show_all(fc_config_window); +- } +- else +- { +- gdk_window_raise(fc_config_window->window); +- } ++ fc_myConfig.freq48 = fc_myConfig.freq44 = fc_myConfig.freq22 = FALSE; ++ fc_myConfig.bits16 = fc_myConfig.bits8 = FALSE; ++ fc_myConfig.mono = fc_myConfig.stereo = FALSE; + ++ if (fc_myConfig.frequency == FREQ_SAMPLE_48) { ++ fc_myConfig.freq48 = TRUE; ++ } ++ else if (fc_myConfig.frequency == FREQ_SAMPLE_22) { ++ fc_myConfig.freq22 = TRUE; ++ } ++ else { ++ fc_myConfig.freq44 = TRUE; ++ } ++ ++ switch (fc_myConfig.channels) { ++ case 2: ++ fc_myConfig.stereo = TRUE; ++ break; ++ case 1: ++ default: ++ fc_myConfig.mono = TRUE; ++ break; ++ } ++ ++ switch (fc_myConfig.precision) { ++ case 16: ++ fc_myConfig.bits16 = TRUE; ++ break; ++ case 8: ++ default: ++ fc_myConfig.bits8 = TRUE; ++ break; ++ } + } + +-static void config_ok(GtkWidget * widget, gpointer data) +-{ ++static void fc_ip_config_save() { + mcs_handle_t *cfg; + +- if (GTK_TOGGLE_BUTTON(Bits16)->active) +- fc_myConfig.precision = 16; +- if (GTK_TOGGLE_BUTTON(Bits8)->active) +- fc_myConfig.precision = 8; +- +- if (GTK_TOGGLE_BUTTON(Stereo)->active) +- fc_myConfig.channels = 2; +- if (GTK_TOGGLE_BUTTON(Mono)->active) +- fc_myConfig.channels = 1; +- +- if (GTK_TOGGLE_BUTTON(Sample_48)->active) +- fc_myConfig.frequency = FREQ_SAMPLE_48; +- if (GTK_TOGGLE_BUTTON(Sample_44)->active) +- fc_myConfig.frequency = FREQ_SAMPLE_44; +- if (GTK_TOGGLE_BUTTON(Sample_22)->active) +- fc_myConfig.frequency = FREQ_SAMPLE_22; +- +- if ((cfg = aud_cfg_db_open())) +- { ++ if ((cfg = aud_cfg_db_open())) { + aud_cfg_db_set_int(cfg, configSection, "frequency", fc_myConfig.frequency); + aud_cfg_db_set_int(cfg, configSection, "precision", fc_myConfig.precision); + aud_cfg_db_set_int(cfg, configSection, "channels", fc_myConfig.channels); + aud_cfg_db_close(cfg); + } +- gtk_widget_destroy(fc_config_window); + } ++ ++static void configure_apply() { ++ memcpy(&fc_myConfig, &config, sizeof(FCpluginConfig)); ++ ++ if (config.bits16) { ++ fc_myConfig.precision = 16; ++ } ++ else { /* if (config.bits8) { */ ++ fc_myConfig.precision = 8; ++ } ++ ++ if (config.stereo) { ++ fc_myConfig.channels = 2; ++ } ++ else { /* if (config.mono) { */ ++ fc_myConfig.channels = 1; ++ } ++ ++ if (config.freq48) { ++ fc_myConfig.frequency = FREQ_SAMPLE_48; ++ } ++ else if (config.freq22) { ++ fc_myConfig.frequency = FREQ_SAMPLE_22; ++ } ++ else { /* if (config.freq44) { */ ++ fc_myConfig.frequency = FREQ_SAMPLE_44; ++ } ++ ++ fc_ip_config_save(); ++} ++ ++static void configure_init(void) { ++ memcpy(&config, &fc_myConfig, sizeof(FCpluginConfig)); ++} ++ ++static PreferencesWidget prefs_precision[] = { ++ {WIDGET_RADIO_BTN, "16", &config.bits16, NULL, NULL, FALSE}, ++ {WIDGET_RADIO_BTN, "8", &config.bits8, NULL, NULL, FALSE}, ++}; ++ ++static PreferencesWidget prefs_channels[] = { ++ {WIDGET_RADIO_BTN, "Stereo", &config.stereo, NULL, NULL, FALSE}, ++ {WIDGET_RADIO_BTN, "Mono", &config.mono, NULL, NULL, FALSE}, ++}; ++ ++static PreferencesWidget prefs_frequency[] = { ++ {WIDGET_RADIO_BTN, "48000", &config.freq48, NULL, NULL, FALSE}, ++ {WIDGET_RADIO_BTN, "44100", &config.freq44, NULL, NULL, FALSE}, ++ {WIDGET_RADIO_BTN, "22050", &config.freq22, NULL, NULL, FALSE}, ++}; ++ ++static PreferencesWidget prefs_top_row[] = { ++ {WIDGET_BOX, "Frequency [Hz]:", NULL, NULL, NULL, FALSE, ++ {.box = {prefs_frequency, G_N_ELEMENTS(prefs_frequency), FALSE, TRUE}}}, ++ {WIDGET_BOX, "Precision [bits]:", NULL, NULL, NULL, FALSE, ++ {.box = {prefs_precision, G_N_ELEMENTS(prefs_precision), FALSE, TRUE}}}, ++ {WIDGET_BOX, "Channels:", NULL, NULL, NULL, FALSE, ++ {.box = {prefs_channels, G_N_ELEMENTS(prefs_channels), FALSE, TRUE}}}, ++}; ++ ++static PreferencesWidget prefs[] = { ++ {WIDGET_BOX, NULL, NULL, NULL, NULL, FALSE, ++ {.box = {prefs_top_row, G_N_ELEMENTS(prefs_top_row), TRUE, FALSE}}}, ++}; ++ ++PluginPreferences fc_ip_preferences = { ++ .domain = "fc14audiodecoder", ++ .title = "Future Composer Decoder Configuration", ++ .prefs = prefs, ++ .n_prefs = G_N_ELEMENTS(prefs), ++ .type = PREFERENCES_WINDOW, ++ .init = configure_init, ++ .apply = configure_apply, ++}; +diff -Nur audacious-plugin-fc-0.6-orig/src/configure.h audacious-plugin-fc-0.6.2/src/configure.h +--- audacious-plugin-fc-0.6-orig/src/configure.h 2002-02-06 02:11:56.000000000 +0100 ++++ audacious-plugin-fc-0.6.2/src/configure.h 2011-06-15 11:34:19.000000000 +0200 +@@ -1,16 +1,19 @@ + #ifndef CONFIGURE_H + #define CONFIGURE_H + +-#include ++#include + + typedef struct + { + gint frequency; + gint precision; + gint channels; ++ ++ gboolean freq48, freq44, freq22; ++ gboolean bits16, bits8; ++ gboolean mono, stereo; + } FCpluginConfig; + +-extern void fc_ip_configure(void); + extern void fc_ip_load_config(void); + + extern FCpluginConfig fc_myConfig; +diff -Nur audacious-plugin-fc-0.6-orig/src/main.c audacious-plugin-fc-0.6.2/src/main.c +--- audacious-plugin-fc-0.6-orig/src/main.c 2010-07-23 09:51:35.000000000 +0200 ++++ audacious-plugin-fc-0.6.2/src/main.c 2011-06-15 11:34:19.000000000 +0200 +@@ -22,8 +22,8 @@ + #include + #include + +-#if __AUDACIOUS_PLUGIN_API__ < 16 +-#error "At least Audacious 2.4 beta1 is required." ++#if _AUD_PLUGIN_VERSION < 30 ++#error "At least Audacious 3.0 alpha1 is required." + #endif + + #include "config.h" +@@ -39,13 +39,16 @@ + static GMutex *seek_mutex; + static GCond *seek_cond; + static gint jumpToTime = -1; ++static gboolean stop_flag = FALSE; + +-void ip_init(void) { ++gboolean ip_init(void) { + jumpToTime = -1; + seek_mutex = g_mutex_new(); + seek_cond = g_cond_new(); + + fc_ip_load_config(); ++ ++ return TRUE; + } + + void ip_cleanup(void) { +@@ -83,8 +86,8 @@ + return FALSE; + } + +- playback->playing = FALSE; + jumpToTime = (start_time > 0) ? start_time : -1; ++ stop_flag = FALSE; + + if ( vfs_fseek(fd,0,SEEK_END)!=0 ) { + return FALSE; +@@ -171,18 +174,17 @@ + if ( haveSampleBuf && haveModule ) { + int msecSongLen = fc14dec_duration(decoder); + +- Tuple *t = tuple_new_from_filename( playback->filename ); ++ Tuple *t = tuple_new_from_filename( filename ); + tuple_associate_int(t, FIELD_LENGTH, NULL, msecSongLen); + tuple_associate_string(t, FIELD_QUALITY, NULL, "sequenced"); + playback->set_tuple( playback, t ); + + /* bitrate => 4*1000 will be displayed as "4 CHANNELS" */ +- playback->set_params( playback, NULL, 0, 1000*4, myFormat.freq, myFormat.channels ); ++ playback->set_params( playback, 1000*4, myFormat.freq, myFormat.channels ); + +- playback->playing = TRUE; + playback->set_pb_ready(playback); + +- while ( playback->playing ) { ++ while ( !stop_flag ) { + if (stop_time >= 0 && playback->output->written_time () >= stop_time) { + goto DRAIN; + } +@@ -196,53 +198,51 @@ + g_mutex_unlock(seek_mutex); + + fc14dec_buffer_fill(decoder,sampleBuf,sampleBufSize); +- if ( playback->playing && jumpToTime<0 ) { ++ if ( !stop_flag && jumpToTime<0 ) { + playback->output->write_audio(sampleBuf,sampleBufSize); + } + if ( fc14dec_song_end(decoder) && jumpToTime<0 ) { +- playback->eof = TRUE; +- playback->playing = FALSE; ++ stop_flag = TRUE; + DRAIN: +- while (playback->output->buffer_playing() && playback->playing) { ++ while ( !stop_flag && playback->output->buffer_playing() ) { + g_usleep(20000); + } + break; + } + } + } +- CLEANUP: + g_mutex_lock(seek_mutex); +- playback->playing = FALSE; ++ stop_flag = TRUE; + g_cond_signal(seek_cond); /* wake up any waiting request */ + g_mutex_unlock(seek_mutex); + + playback->output->close_audio(); + g_free(sampleBuf); + fc14dec_delete(decoder); +- return FALSE; ++ return TRUE; + } + + void ip_stop(InputPlayback *playback) { + g_mutex_lock(seek_mutex); +- if (playback->playing) { +- playback->playing = FALSE; ++ if (!stop_flag) { ++ stop_flag = TRUE; + playback->output->abort_write(); + g_cond_signal(seek_cond); + } + g_mutex_unlock(seek_mutex); + } + +-void ip_pause(InputPlayback *playback, gshort p) { ++void ip_pause(InputPlayback *playback, gboolean p) { + g_mutex_lock(seek_mutex); +- if (playback->playing) { ++ if (!stop_flag) { + playback->output->pause(p); + } + g_mutex_unlock(seek_mutex); + } + +-void ip_mseek(InputPlayback *playback, gulong msec) { ++void ip_mseek(InputPlayback *playback, gint msec) { + g_mutex_lock(seek_mutex); +- if (playback->playing) { ++ if (!stop_flag) { + jumpToTime = msec; + playback->output->abort_write(); + g_cond_signal(seek_cond); +diff -Nur audacious-plugin-fc-0.6-orig/src/plugin.c audacious-plugin-fc-0.6.2/src/plugin.c +--- audacious-plugin-fc-0.6-orig/src/plugin.c 2010-07-23 09:38:18.000000000 +0200 ++++ audacious-plugin-fc-0.6.2/src/plugin.c 2011-06-15 11:34:19.000000000 +0200 +@@ -1,28 +1,29 @@ + #include + +-gchar *fc_fmts[] = { "fc", "fc13", "fc14", NULL }; ++const gchar* const fc_fmts[] = { "fc", "fc13", "fc14", NULL }; + +-void ip_init(void); ++extern PluginPreferences fc_ip_preferences; ++ ++gboolean ip_init(void); + void ip_cleanup(void); + void fc_ip_about(void); +-void fc_ip_configure(void); + gint ip_is_valid_file_vfs(const gchar *filename, VFSFile *fd); + gboolean ip_play(InputPlayback *playback, const gchar *filename, VFSFile *fd, + gint start_time, gint stop_time, gboolean pause); + void ip_stop(InputPlayback *playback); +-void ip_pause(InputPlayback *playback, gshort p); ++void ip_pause(InputPlayback *playback, gboolean p); + void ip_seek(InputPlayback *playback, gint secs); +-void ip_mseek(InputPlayback *playback, gulong msec); ++void ip_mseek(InputPlayback *playback, gint msec); + Tuple *ip_probe_for_tuple(const gchar *filename, VFSFile *fd); + +-InputPlugin iplugin = +-{ +- .description = "Future Composer decoder", ++AUD_INPUT_PLUGIN ++( ++ .name = "Future Composer decoder", + .init = ip_init, + .about = fc_ip_about, +- .configure = fc_ip_configure, ++ .settings = &fc_ip_preferences, + .have_subtune = FALSE, +- .vfs_extensions = fc_fmts, ++ .extensions = fc_fmts, + .play = ip_play, + .stop = ip_stop, + .pause = ip_pause, +@@ -30,8 +31,4 @@ + .cleanup = ip_cleanup, + .probe_for_tuple = ip_probe_for_tuple, + .is_our_file_from_vfs = ip_is_valid_file_vfs +-}; +- +-InputPlugin *fc_iplist[] = { &iplugin, NULL }; +- +-SIMPLE_INPUT_PLUGIN(libfc, fc_iplist); ++) diff --git a/audacious-plugin-fc-0.6-plugin-api18.patch b/audacious-plugin-fc-0.6-plugin-api18.patch deleted file mode 100644 index 67306f2..0000000 --- a/audacious-plugin-fc-0.6-plugin-api18.patch +++ /dev/null @@ -1,150 +0,0 @@ -diff -Nur audacious-plugin-fc-0.6-orig/src/main.c audacious-plugin-fc-0.6/src/main.c ---- audacious-plugin-fc-0.6-orig/src/main.c 2010-07-23 09:51:35.000000000 +0200 -+++ audacious-plugin-fc-0.6/src/main.c 2011-02-02 00:17:44.000000000 +0100 -@@ -22,8 +22,8 @@ - #include - #include - --#if __AUDACIOUS_PLUGIN_API__ < 16 --#error "At least Audacious 2.4 beta1 is required." -+#if _AUD_PLUGIN_VERSION < 18 -+#error "At least Audacious 2.5 alpha1 is required." - #endif - - #include "config.h" -@@ -39,13 +39,16 @@ - static GMutex *seek_mutex; - static GCond *seek_cond; - static gint jumpToTime = -1; -+static gboolean stop_flag = FALSE; - --void ip_init(void) { -+gboolean ip_init(void) { - jumpToTime = -1; - seek_mutex = g_mutex_new(); - seek_cond = g_cond_new(); - - fc_ip_load_config(); -+ -+ return TRUE; - } - - void ip_cleanup(void) { -@@ -83,8 +86,8 @@ - return FALSE; - } - -- playback->playing = FALSE; - jumpToTime = (start_time > 0) ? start_time : -1; -+ stop_flag = FALSE; - - if ( vfs_fseek(fd,0,SEEK_END)!=0 ) { - return FALSE; -@@ -171,18 +174,17 @@ - if ( haveSampleBuf && haveModule ) { - int msecSongLen = fc14dec_duration(decoder); - -- Tuple *t = tuple_new_from_filename( playback->filename ); -+ Tuple *t = tuple_new_from_filename( filename ); - tuple_associate_int(t, FIELD_LENGTH, NULL, msecSongLen); - tuple_associate_string(t, FIELD_QUALITY, NULL, "sequenced"); - playback->set_tuple( playback, t ); - - /* bitrate => 4*1000 will be displayed as "4 CHANNELS" */ -- playback->set_params( playback, NULL, 0, 1000*4, myFormat.freq, myFormat.channels ); -+ playback->set_params( playback, 1000*4, myFormat.freq, myFormat.channels ); - -- playback->playing = TRUE; - playback->set_pb_ready(playback); - -- while ( playback->playing ) { -+ while ( !stop_flag ) { - if (stop_time >= 0 && playback->output->written_time () >= stop_time) { - goto DRAIN; - } -@@ -196,23 +198,21 @@ - g_mutex_unlock(seek_mutex); - - fc14dec_buffer_fill(decoder,sampleBuf,sampleBufSize); -- if ( playback->playing && jumpToTime<0 ) { -+ if ( !stop_flag && jumpToTime<0 ) { - playback->output->write_audio(sampleBuf,sampleBufSize); - } - if ( fc14dec_song_end(decoder) && jumpToTime<0 ) { -- playback->eof = TRUE; -- playback->playing = FALSE; -+ stop_flag = TRUE; - DRAIN: -- while (playback->output->buffer_playing() && playback->playing) { -+ while ( !stop_flag && playback->output->buffer_playing() ) { - g_usleep(20000); - } - break; - } - } - } -- CLEANUP: - g_mutex_lock(seek_mutex); -- playback->playing = FALSE; -+ stop_flag = TRUE; - g_cond_signal(seek_cond); /* wake up any waiting request */ - g_mutex_unlock(seek_mutex); - -@@ -224,25 +224,25 @@ - - void ip_stop(InputPlayback *playback) { - g_mutex_lock(seek_mutex); -- if (playback->playing) { -- playback->playing = FALSE; -+ if (!stop_flag) { -+ stop_flag = TRUE; - playback->output->abort_write(); - g_cond_signal(seek_cond); - } - g_mutex_unlock(seek_mutex); - } - --void ip_pause(InputPlayback *playback, gshort p) { -+void ip_pause(InputPlayback *playback, gboolean p) { - g_mutex_lock(seek_mutex); -- if (playback->playing) { -+ if (!stop_flag) { - playback->output->pause(p); - } - g_mutex_unlock(seek_mutex); - } - --void ip_mseek(InputPlayback *playback, gulong msec) { -+void ip_mseek(InputPlayback *playback, gint msec) { - g_mutex_lock(seek_mutex); -- if (playback->playing) { -+ if (!stop_flag) { - jumpToTime = msec; - playback->output->abort_write(); - g_cond_signal(seek_cond); -diff -Nur audacious-plugin-fc-0.6-orig/src/plugin.c audacious-plugin-fc-0.6/src/plugin.c ---- audacious-plugin-fc-0.6-orig/src/plugin.c 2010-07-23 09:38:18.000000000 +0200 -+++ audacious-plugin-fc-0.6/src/plugin.c 2011-02-02 00:14:04.257839525 +0100 -@@ -1,8 +1,8 @@ - #include - --gchar *fc_fmts[] = { "fc", "fc13", "fc14", NULL }; -+const gchar* const fc_fmts[] = { "fc", "fc13", "fc14", NULL }; - --void ip_init(void); -+gboolean ip_init(void); - void ip_cleanup(void); - void fc_ip_about(void); - void fc_ip_configure(void); -@@ -10,9 +10,9 @@ - gboolean ip_play(InputPlayback *playback, const gchar *filename, VFSFile *fd, - gint start_time, gint stop_time, gboolean pause); - void ip_stop(InputPlayback *playback); --void ip_pause(InputPlayback *playback, gshort p); -+void ip_pause(InputPlayback *playback, gboolean p); - void ip_seek(InputPlayback *playback, gint secs); --void ip_mseek(InputPlayback *playback, gulong msec); -+void ip_mseek(InputPlayback *playback, gint msec); - Tuple *ip_probe_for_tuple(const gchar *filename, VFSFile *fd); - - InputPlugin iplugin = diff --git a/audacious-plugin-fc.spec b/audacious-plugin-fc.spec index 9ad0261..24fd2c3 100644 --- a/audacious-plugin-fc.spec +++ b/audacious-plugin-fc.spec @@ -5,22 +5,23 @@ %{?aud_plugin_dep} # Minimum audacious/audacious-plugins version in inter-package dependencies. -%global aud_ver 2.5 -Requires: audacious >= %{aud_ver} +%global aud_ver 3.0 +#Requires: audacious >= %{aud_ver} %global plugindir %(pkg-config audacious --variable=input_plugin_dir 2>/dev/null) Summary: Future Composer input plugin for Audacious Name: audacious-plugin-fc Version: 0.6 -Release: 6%{?dist} +Release: 7%{?dist} Provides: audacious-plugins-fc = %{version}-%{release} URL: http://xmms-fc.sourceforge.net/ License: GPLv2+ Source: http://downloads.sourceforge.net/xmms-fc/audacious-plugin-fc-%{version}.tar.bz2 -Patch0: audacious-plugin-fc-0.6-plugin-api18.patch +# post 0.6.1 +Patch0: audacious-plugin-fc-0.6-aud30.patch Group: Applications/Multimedia -Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + BuildRequires: audacious-devel >= %{aud_ver} BuildRequires: libfc14audiodecoder-devel BuildRequires: pkgconfig @@ -32,13 +33,11 @@ music files from AMIGA. Song-length detection and seek are implemented, too. %prep -%if 0%{?fedora} > 13 # Enforce availability of the audacious(plugin-api) dependency. %{!?aud_plugin_dep:echo 'No audacious(plugin-api) dependency!' && exit -1} -%endif %setup -q -%patch0 -p1 -b .plugin-api18 +%patch0 -p1 -b .aud30 %build @@ -47,14 +46,9 @@ make %{?_smp_mflags} %install -rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install -%clean -rm -rf $RPM_BUILD_ROOT - - %files %defattr(-,root,root,-) %doc COPYING README @@ -63,6 +57,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Wed Jun 15 2011 Michael Schwendt - 0.6-7 +- Patch for Audacious 3.0-alpha1 GUI API. + * Wed Feb 23 2011 Michael Schwendt - 0.6-6 - Update the audacious(plugin-api) stuff in the spec file, so the new _AUD_PLUGIN_VERSION_MIN is not taken by mistake.