Mercurial > audlegacy-plugins
changeset 2761:41a80a649b9d
Automated merge with ssh://hg.atheme.org//hg/audacious-plugins
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 02 Jul 2008 08:04:04 +0300 |
parents | 652651eeb5f1 (diff) 35ac6cb80680 (current diff) |
children | 22d73f09eecc |
files | |
diffstat | 15 files changed, 144 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Wed Jul 02 08:03:42 2008 +0300 +++ b/configure.ac Wed Jul 02 08:04:04 2008 +0300 @@ -120,7 +120,7 @@ dnl These plugins are always built. -INPUT_PLUGINS="tonegen console sexypsf cue alac metronom vtx" +INPUT_PLUGINS="tonegen console sexypsf psf2 cue alac metronom vtx" OUTPUT_PLUGINS="null" EFFECT_PLUGINS="audiocompress crystalizer ladspa voice_removal sndstretch stereo_plugin echo_plugin" GENERAL_PLUGINS="song_change alarm" @@ -1689,6 +1689,7 @@ echo " -> distortion patched libSIDPlay2: $xs_have_distortion" echo " Game music (spc, nsf & gbs): yes" echo " PlayStation audio (sexypsf): yes" +echo " PlayStation2 audio (psf2): yes" echo " AdLib synthesizer (adplug): $have_adplug" echo " Apple Lossless Audio Codec (alac): yes" echo " WavPack 4.31+ (wavpack): $have_wavpack"
--- a/src/bluetooth/bluetooth.c Wed Jul 02 08:03:42 2008 +0300 +++ b/src/bluetooth/bluetooth.c Wed Jul 02 08:04:04 2008 +0300 @@ -49,7 +49,7 @@ { printf("bluetooth: exit\n"); if (config ==1 ){ - destroy_scan_window(); + close_window(); config =0; } if(discover_finish == 2) { @@ -91,14 +91,25 @@ } +void clean_devices_list(){ + g_list_free(audio_devices); + dbus_g_connection_flush (bus); + dbus_g_connection_unref(bus); + audio_devices = NULL; + //g_list_free(current_device); +} void refresh_call(void) { printf("refresh function called\n"); disconnect_dbus_signals(); + clean_devices_list(); if(discover_finish == 0 ||discover_finish== 2){ discover_finish = 0; + discover_devices(); + close_window(); + show_scan(); } else printf("Scanning please wait!\n");
--- a/src/bluetooth/gui.c Wed Jul 02 08:03:42 2008 +0300 +++ b/src/bluetooth/gui.c Wed Jul 02 08:04:04 2008 +0300 @@ -173,6 +173,13 @@ } } +void refresh_resultsui(){ + gtk_widget_destroy (window); + window = NULL; + refresh_call(); +} + + void results_ui() { gchar *temp; @@ -200,7 +207,7 @@ gtk_container_add(GTK_CONTAINER(hbox_top),about_frame); refresh = gtk_button_new_with_mnemonic ("_Refresh"); - g_signal_connect (refresh, "clicked",G_CALLBACK (refresh_call), NULL); + g_signal_connect (refresh, "clicked",G_CALLBACK (refresh_resultsui), NULL); gtk_container_add(GTK_CONTAINER(hbox_bottom),refresh); connect_button = gtk_button_new_with_mnemonic("_Connect");
--- a/src/bluetooth/scan_gui.c Wed Jul 02 08:03:42 2008 +0300 +++ b/src/bluetooth/scan_gui.c Wed Jul 02 08:04:04 2008 +0300 @@ -3,11 +3,13 @@ static GtkWidget *window = NULL; static GtkWidget *winbox; static GtkWidget *scanbox; +static GtkWidget *buttonsbox; static GtkWidget *progressbox; static GtkWidget *bluetooth_img; static GtkWidget *scan_label; static GtkWidget *progress_bar; - +static GtkWidget *rescan_buttton; +static GtkWidget *close_button; gpointer progress() { for(;;){ @@ -33,6 +35,12 @@ void destroy_scan_window(){ gtk_widget_hide(window); } +void close_window(void){ + printf("scan_gui close callback \n"); + gtk_widget_destroy (window); + window = NULL; +} + void show_scan() { @@ -69,7 +77,19 @@ /* I have to add a button for Rescan when there are * no devices found and not currently scanning */ - gtk_window_set_default_size (GTK_WINDOW (window), 50, 40); + buttonsbox = gtk_hbox_new(FALSE,2); + gtk_container_set_border_width(GTK_CONTAINER(buttonsbox),2); + gtk_container_add(GTK_CONTAINER(progressbox),buttonsbox); + rescan_buttton = gtk_button_new_with_mnemonic("Rescan"); + g_signal_connect(rescan_buttton,"clicked",G_CALLBACK (refresh_call),NULL); + + close_button = gtk_button_new_with_mnemonic("Close"); + gtk_container_add(GTK_CONTAINER(buttonsbox),rescan_buttton); + gtk_container_add(GTK_CONTAINER(buttonsbox),close_button); + g_signal_connect(close_button,"clicked",G_CALLBACK (close_window),NULL); + + gtk_window_set_default_size (GTK_WINDOW (window), 60, 40); + gtk_window_set_resizable(GTK_WINDOW(window),FALSE); if (!GTK_WIDGET_VISIBLE (window)) gtk_widget_show_all (window); else
--- a/src/bluetooth/scan_gui.h Wed Jul 02 08:03:42 2008 +0300 +++ b/src/bluetooth/scan_gui.h Wed Jul 02 08:04:04 2008 +0300 @@ -3,3 +3,4 @@ void show_scan(); void show_no_devices(); void destroy_scan_window(); +void close_window();
--- a/src/psf2/README Wed Jul 02 08:03:42 2008 +0300 +++ b/src/psf2/README Wed Jul 02 08:04:04 2008 +0300 @@ -14,6 +14,8 @@ Does it work? -Not as a plugin yet. But that's coming. +Yes. But there's bugs. See http://audacious-media-player.org/?title=Audacious2/PSF2Plugin +for suggestions on things you can do. +
--- a/src/psf2/eng_protos.h Wed Jul 02 08:03:42 2008 +0300 +++ b/src/psf2/eng_protos.h Wed Jul 02 08:04:04 2008 +0300 @@ -16,4 +16,4 @@ int32 psf2_stop(void); int32 psf2_command(int32, int32); int32 psf2_fill_info(Tuple *); - +int psf2_seek(uint32);
--- a/src/psf2/peops2/spu.c Wed Jul 02 08:03:42 2008 +0300 +++ b/src/psf2/peops2/spu.c Wed Jul 02 08:04:04 2008 +0300 @@ -332,9 +332,18 @@ static u32 decaybegin; static u32 decayend; +static u32 seektime; +int psf2_seek(u32 t) +{ + seektime=t*441/10; + if(seektime>sampcount) return(1); + return(0); +} + // Counting to 65536 results in full volume offage. void setlength2(s32 stop, s32 fade) { + seektime = 0; if(stop==~0) { decaybegin=~0; @@ -739,7 +748,7 @@ if(decaybegin!=~0) // Is anyone REALLY going to be playing a song // for 13 hours? { - if(sampcount>=decayend) + if(sampcount>=decayend) { psf2_update(NULL, 0, data); return(0); @@ -760,7 +769,11 @@ ////////////////////////////////////////////////////// // feed the sound // wanna have around 1/60 sec (16.666 ms) updates - if ((((unsigned char *)pS)-((unsigned char *)pSpuBuffer)) == (735*4)) + if (seektime != 0 && sampcount < seektime) + { + pS=(short *)pSpuBuffer; + } + else if ((((unsigned char *)pS)-((unsigned char *)pSpuBuffer)) == (735*4)) { psf2_update((u8*)pSpuBuffer,(u8*)pS-(u8*)pSpuBuffer, data); pS=(short *)pSpuBuffer;
--- a/src/psf2/peops2/spu.h Wed Jul 02 08:03:42 2008 +0300 +++ b/src/psf2/peops2/spu.h Wed Jul 02 08:04:04 2008 +0300 @@ -36,4 +36,4 @@ EXPORT_GCC long CALLBACK SPU2open(void *pDsp); EXPORT_GCC void CALLBACK SPU2async(unsigned long cycle, void *); EXPORT_GCC void CALLBACK SPU2close(void); - +EXPORT_GCC int CALLBACK psf2_seek(u32 t);
--- a/src/psf2/plugin.c Wed Jul 02 08:03:42 2008 +0300 +++ b/src/psf2/plugin.c Wed Jul 02 08:04:04 2008 +0300 @@ -178,6 +178,12 @@ if (seek) { + data->eof = FALSE; + data->output->flush(seek); + + psf2_command(COMMAND_RESTART, 0); + psf2_seek(seek); + seek = 0; continue; } @@ -230,23 +236,19 @@ buffer += t; } -#if 0 - if (seek) - { - if(sexypsf_seek(seek)) - { - playback->output->flush(seek); - seek = 0; - } - else // negative time - must make a C time machine - { - sexypsf_stop(); - return; - } - } - if (stop) - sexypsf_stop(); -#endif + if (seek) + { + if (psf2_seek(seek)) + { + playback->output->flush(seek); + seek = 0; + } + else + { + playback->eof = TRUE; + return; + } + } } void psf2_Stop(InputPlayback *playback) @@ -270,21 +272,23 @@ return 0; } +void psf2_Seek(InputPlayback *playback, int time) +{ + seek = time * 1000; +} + gchar *psf2_fmts[] = { "psf2", "minipsf2", NULL }; InputPlugin psf2_ip = { - .description = "PSF2 Audio Plugin", - .play_file = psf2_play, - .stop = psf2_Stop, - .pause = psf2_pause, -#if 0 - .seek = sexypsf_xmms_seek, - .get_song_info = sexypsf_xmms_getsonginfo, -#endif - .get_song_tuple = psf2_tuple, - .is_our_file_from_vfs = psf2_is_our_fd, - .vfs_extensions = psf2_fmts, + .description = "PSF2 Audio Plugin", + .play_file = psf2_play, + .stop = psf2_Stop, + .pause = psf2_pause, + .seek = psf2_Seek, + .get_song_tuple = psf2_tuple, + .is_our_file_from_vfs = psf2_is_our_fd, + .vfs_extensions = psf2_fmts, }; InputPlugin *psf2_iplist[] = { &psf2_ip, NULL };
--- a/src/streambrowser/Makefile Wed Jul 02 08:03:42 2008 +0300 +++ b/src/streambrowser/Makefile Wed Jul 02 08:04:04 2008 +0300 @@ -6,11 +6,16 @@ gui/about_win.c \ gui/streambrowser_win.c +DATA = images/shoutcast.png + include ../../buildsys.mk include ../../extra.mk +PACKAGE = audacious + plugindir := ${plugindir}/${INPUT_PLUGIN_DIR} -CFLAGS += ${PLUGIN_CFLAGS} +CFLAGS += ${PLUGIN_CFLAGS} ${BEEP_DEFINES} CPPFLAGS += ${PLUGIN_CPPFLAGS} ${MOWGLI_CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS} ${XML_CPPFLAGS} ${ARCH_DEFINES} -I../.. LIBS += ${GTK_LIBS} ${GLIB_LIBS} ${MOWGLI_LIBS} ${XML_LIBS} +
--- a/src/streambrowser/gui/streambrowser_win.c Wed Jul 02 08:03:42 2008 +0300 +++ b/src/streambrowser/gui/streambrowser_win.c Wed Jul 02 08:04:04 2008 +0300 @@ -202,20 +202,20 @@ static GtkWidget *gtk_streamdir_tree_view_new() { GtkWidget *tree_view = gtk_tree_view_new(); - + GtkTreeStore *store = gtk_tree_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view), GTK_TREE_MODEL(store)); // todo: why doesn't the tree view allow to be resized? - //gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), FALSE); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), TRUE); gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(tree_view), TRUE); - //gtk_tree_view_set_reorderable(GTK_TREE_VIEW(tree_view), TRUE); + gtk_tree_view_set_reorderable(GTK_TREE_VIEW(tree_view), TRUE); gtk_tree_view_set_fixed_height_mode(GTK_TREE_VIEW(tree_view), FALSE); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), -1, "", cell_renderer_pixbuf, "pixbuf", 0, NULL); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), -1, "Stream name", cell_renderer_text, "text", 1, NULL); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), -1, "Now playing", cell_renderer_text, "text", 2, NULL); - + g_signal_connect(G_OBJECT(tree_view), "cursor-changed", G_CALLBACK(on_tree_view_cursor_changed), NULL); return tree_view; @@ -238,8 +238,14 @@ return FALSE; /* update the current selected stream */ + + /* streamdir_gui_t *streamdir_gui = g_list_nth_data(streamdir_gui_list, page_num); update_function(streamdir_gui->streamdir, NULL, NULL); + */ + + /* clear the search box */ + gtk_entry_set_text(GTK_ENTRY(search_entry), ""); return TRUE; } @@ -249,11 +255,12 @@ GtkTreePath *path; GtkTreeViewColumn *focus_column; + /* obtain the current category */ gtk_tree_view_get_cursor(tree_view, &path, &focus_column); if (path == NULL) return TRUE; - + gint *indices = gtk_tree_path_get_indices(path); if (gtk_tree_path_get_depth(path) != 1) { gtk_tree_path_free(path); @@ -267,8 +274,12 @@ streamdir_gui_t *streamdir_gui = find_streamdir_gui_by_tree_view(tree_view); if (streamdir_gui == NULL) return TRUE; - + + /* issue an update on the current category */ update_function(streamdir_gui->streamdir, category_get_by_index(streamdir_gui->streamdir, category_index), NULL); + + /* clear the search box */ + gtk_entry_set_text(GTK_ENTRY(search_entry), ""); return TRUE; }
--- a/src/streambrowser/shoutcast.h Wed Jul 02 08:03:42 2008 +0300 +++ b/src/streambrowser/shoutcast.h Wed Jul 02 08:04:04 2008 +0300 @@ -5,10 +5,8 @@ #include "streambrowser.h" #include "streamdir.h" -// todo: replace hardcoded image paths with DATA_DIR G_DIR_SEPARATOR_S "images" G_DIR_SEPARATOR_S "whatever.png" - #define SHOUTCAST_NAME "Shoutcast" -#define SHOUTCAST_ICON "/usr/share/audacious/images/menu_playlist.png" +#define SHOUTCAST_ICON DATA_DIR G_DIR_SEPARATOR_S "images" G_DIR_SEPARATOR_S "shoutcast.png" #define SHOUTCAST_STREAMDIR_URL "http://www.shoutcast.com/sbin/newxml.phtml" #define SHOUTCAST_CATEGORY_URL "http://www.shoutcast.com/sbin/newxml.phtml?genre=%s" #define SHOUTCAST_STREAMINFO_URL "http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=%s&file=filename.pls"
--- a/src/streambrowser/streambrowser.c Wed Jul 02 08:03:42 2008 +0300 +++ b/src/streambrowser/streambrowser.c Wed Jul 02 08:04:04 2008 +0300 @@ -37,7 +37,7 @@ static GtkWidget* playlist_menu_item; static GtkWidget* main_menu_item; -static update_thread_data_t update_thread_data_queue[MAX_UPDATE_THREADS]; +static GQueue* update_thread_data_queue; static gint update_thread_count = 0; static GMutex* update_thread_mutex; @@ -172,7 +172,10 @@ /* main streambrowser window */ streambrowser_win_init(); streambrowser_win_set_update_function(streamdir_update); + + /* others */ update_thread_mutex = g_mutex_new(); + update_thread_data_queue = g_queue_new(); debug("gui initialized\n"); } @@ -186,6 +189,10 @@ /* main streambrowser window */ streambrowser_win_hide(); streambrowser_win_done(); + + /* others */ + g_mutex_free(update_thread_mutex); + g_queue_free(update_thread_data_queue); debug("gui destroied\n"); } @@ -238,11 +245,16 @@ debug("another %d streamdir updates are pending, this request will be queued\n", update_thread_count); g_mutex_lock(update_thread_mutex); - update_thread_data_queue[update_thread_count].streamdir = streamdir; - update_thread_data_queue[update_thread_count].category = category; - update_thread_data_queue[update_thread_count].streaminfo = streaminfo; + + update_thread_data_t *update_thread_data = g_malloc(sizeof(update_thread_data_t)); + + update_thread_data->streamdir = streamdir; + update_thread_data->category = category; + update_thread_data->streaminfo = streaminfo; + g_queue_push_tail(update_thread_data_queue, update_thread_data); update_thread_count++; + g_mutex_unlock(update_thread_mutex); } else { @@ -258,6 +270,10 @@ static gpointer update_thread_core(update_thread_data_t *data) { + g_mutex_lock(update_thread_mutex); + update_thread_count++; + g_mutex_unlock(update_thread_mutex); + /* update a streaminfo - that is - add this streaminfo to playlist */ if (data->streaminfo != NULL) { streaminfo_add_to_playlist(data->streaminfo); @@ -302,18 +318,10 @@ data = NULL; g_mutex_lock(update_thread_mutex); - if (update_thread_count > 0) { - data = g_malloc(sizeof(update_thread_data_t)); - data->streamdir = update_thread_data_queue[0].streamdir; - data->category = update_thread_data_queue[0].category; - data->streaminfo = update_thread_data_queue[0].streaminfo; + update_thread_count--; - int i; - for (i = 0; i < update_thread_count; i++) { - update_thread_data_queue[i].streamdir = update_thread_data_queue[i + 1].streamdir; - update_thread_data_queue[i].category = update_thread_data_queue[i + 1].category; - update_thread_data_queue[i].streaminfo = update_thread_data_queue[i + 1].streaminfo; - } + if (update_thread_count > 0) { + data = g_queue_pop_head(update_thread_data_queue); update_thread_count--; }