diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-21 21:36:32 +0100 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-01-21 21:47:56 +0100 |
commit | 454f852f361477b0f365a9705574a700339497ac (patch) | |
tree | 24bf5f0a2239527c74d35fcf95b8c0dbfc284ada /plugins | |
parent | f89029d063c855b03adbcd20d09380fd42cb11c9 (diff) | |
parent | 4d12a12570876810d0376d31b280674b5c49054a (diff) |
Merge branch 'master' into devel
Conflicts:
Makefile.am
configure.ac
deadbeef.h
main.c
plugins/oss/Makefile.am
plugins/oss/oss.c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/alsa/alsa.c | 8 | ||||
-rw-r--r-- | plugins/gtkui/callbacks.c | 8 | ||||
-rw-r--r-- | plugins/gtkui/deadbeef.glade | 6 | ||||
-rw-r--r-- | plugins/gtkui/gtkplaylist.c | 2 | ||||
-rw-r--r-- | plugins/gtkui/interface.c | 3 | ||||
-rw-r--r-- | plugins/notification/Makefile.am | 5 | ||||
-rw-r--r-- | plugins/notification/notification.c | 63 | ||||
-rw-r--r-- | plugins/oss/Makefile.am | 2 | ||||
-rw-r--r-- | plugins/oss/oss.c | 33 | ||||
-rw-r--r-- | plugins/vorbis/vorbis.c | 2 |
10 files changed, 115 insertions, 17 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index 3f37e8ec..9d6e35d8 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -474,6 +474,14 @@ palsa_thread (void *context) { /* deliver the data */ // FIXME: under some conditions, frames_to_deliver may become huge // like 20M. this case is not handled here. + if (frames_to_deliver < 1024) { + trace ("alsa: frames_to_deliver clipped from %d to 1024\n", frames_to_deliver); + frames_to_deliver = 1024; + } + else if (frames_to_deliver > 2048) { + trace ("alsa: frames_to_deliver clipped from %d to 2048\n", frames_to_deliver); + frames_to_deliver = 2048; + } char buf[frames_to_deliver*4]; palsa_callback (buf, frames_to_deliver*4); if ((err = snd_pcm_writei (audio, buf, frames_to_deliver)) < 0) { diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index c256d18c..c0df2f66 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -1791,9 +1791,9 @@ on_add_column_activate (GtkMenuItem *menuitem, if (response == GTK_RESPONSE_OK) { const gchar *title = gtk_entry_get_text (GTK_ENTRY (lookup_widget (dlg, "title"))); const gchar *format = gtk_entry_get_text (GTK_ENTRY (lookup_widget (dlg, "format"))); - int id = gtk_combo_box_get_active (GTK_COMBO_BOX (lookup_widget (dlg, "id"))) + 1; + int id = gtk_combo_box_get_active (GTK_COMBO_BOX (lookup_widget (dlg, "id"))); int align = gtk_combo_box_get_active (GTK_COMBO_BOX (lookup_widget (dlg, "align"))); - if (id > DB_COLUMN_ID_MAX) { + if (id >= DB_COLUMN_ID_MAX) { id = -1; } gtkpl_column_insert_before (ps, ps->active_column, gtkpl_column_alloc (title, 100, id, format, align)); @@ -1883,13 +1883,13 @@ on_column_id_changed (GtkComboBox *combobox, trace ("failed to get toplevel widget for column id combobox\n"); return; } - int act = gtk_combo_box_get_active (combobox) + 1; + int act = gtk_combo_box_get_active (combobox); GtkWidget *fmt = lookup_widget (toplevel, "format"); if (!fmt) { trace ("failed to get column format widget\n"); return; } - gtk_widget_set_sensitive (fmt, act > DB_COLUMN_ID_MAX ? TRUE : FALSE); + gtk_widget_set_sensitive (fmt, act >= DB_COLUMN_ID_MAX ? TRUE : FALSE); } diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index cfd07055..022a1515 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -3218,7 +3218,8 @@ SOCKS5_HOSTNAME</property> <child> <widget class="GtkComboBox" id="id"> <property name="visible">True</property> - <property name="items" translatable="yes">Playing + <property name="items" translatable="yes">File number +Playing Artist - Album Artist Album @@ -3295,7 +3296,8 @@ Custom</property> <property name="can_focus">True</property> <property name="label" translatable="yes">Format conversions (start with %): [a]rtist, [t]itle, al[b]um, track[n]umber, - [l]ength, [y]ear, [g]enre, [c]omment, copy[r]ight + [l]ength, [y]ear, [g]enre, [c]omment, + copy[r]ight, [f]ilename Example: %a - %t [%l]</property> <property name="use_underline">False</property> <property name="use_markup">True</property> diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c index 762be03f..22fcf630 100644 --- a/plugins/gtkui/gtkplaylist.c +++ b/plugins/gtkui/gtkplaylist.c @@ -396,7 +396,7 @@ gtkpl_draw_pl_row (gtkplaylist_t *ps, int row, DB_playItem_t *it) { } else { char text[1024]; - deadbeef->pl_format_title (it, text, sizeof (text), c->id, c->format); + deadbeef->pl_format_title (it, row, text, sizeof (text), c->id, c->format); if (c->align_right) { draw_text (x+5, row * rowheight - ps->scrollpos * rowheight + rowheight/2 - draw_get_font_size ()/2 - 2, c->width-10, 1, text); diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index 0b614e97..ca824c85 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -2083,6 +2083,7 @@ create_editcolumndlg (void) gtk_table_attach (GTK_TABLE (table9), id, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_combo_box_append_text (GTK_COMBO_BOX (id), "File number"); gtk_combo_box_append_text (GTK_COMBO_BOX (id), "Playing"); gtk_combo_box_append_text (GTK_COMBO_BOX (id), "Artist - Album"); gtk_combo_box_append_text (GTK_COMBO_BOX (id), "Artist"); @@ -2107,7 +2108,7 @@ create_editcolumndlg (void) gtk_entry_set_invisible_char (GTK_ENTRY (format), 9679); gtk_entry_set_activates_default (GTK_ENTRY (format), TRUE); - label25 = gtk_label_new ("Format conversions (start with %):\n [a]rtist, [t]itle, al[b]um, track[n]umber,\n [l]ength, [y]ear, [g]enre, [c]omment, copy[r]ight\nExample: %a - %t [%l]"); + label25 = gtk_label_new ("Format conversions (start with %):\n [a]rtist, [t]itle, al[b]um, track[n]umber,\n [l]ength, [y]ear, [g]enre, [c]omment,\n copy[r]ight, [f]ilename\nExample: %a - %t [%l]"); gtk_widget_show (label25); gtk_table_attach (GTK_TABLE (table9), label25, 0, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), diff --git a/plugins/notification/Makefile.am b/plugins/notification/Makefile.am new file mode 100644 index 00000000..5a9f7f65 --- /dev/null +++ b/plugins/notification/Makefile.am @@ -0,0 +1,5 @@ +notificationdir = $(libdir)/$(PACKAGE) +pkglib_LTLIBRARIES = notification.la +notification_la_SOURCES = notification.c +notification_la_LDFLAGS = -module +AM_CFLAGS = -std=c99 diff --git a/plugins/notification/notification.c b/plugins/notification/notification.c new file mode 100644 index 00000000..dc5b669f --- /dev/null +++ b/plugins/notification/notification.c @@ -0,0 +1,63 @@ +#include "../../deadbeef.h" + +#include <stdio.h> +#include <stdlib.h> + +static DB_misc_t plugin; +static DB_functions_t *deadbeef; + +#define DEFAULT_COMMAND "notify-send '%t' '%a - %b'" + +static const char settings_dlg[] = + "property Command entry notification.command \"" DEFAULT_COMMAND "\";\n" +; + +static void +show_notification (DB_playItem_t *track) +{ + char cmd [1024]; + deadbeef->pl_format_title (track, -1, cmd, sizeof (cmd), -1, deadbeef->conf_get_str ("notification.command", DEFAULT_COMMAND)); + //system (cmd); +} + +static int +songchanged (DB_event_trackchange_t *ev, uintptr_t data) { + DB_playItem_t *track = deadbeef->pl_get_for_idx (ev->to); + if (track) { + show_notification (track); + } + return 0; +} + +static int +notification_stop (void) { + deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (songchanged), 0); + return 0; +} + +static int +notification_start (void) { + deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (songchanged), 0); + return 0; +} + +DB_plugin_t * +notification_load (DB_functions_t *api) { + deadbeef = api; + return DB_PLUGIN (&plugin); +} + +// define plugin interface +static DB_misc_t plugin = { + DB_PLUGIN_SET_API_VERSION + .plugin.type = DB_PLUGIN_MISC, + .plugin.name = "Current track notification", + .plugin.descr = "Displays notification when current track is changed", + .plugin.author = "Viktor Semykin", + .plugin.email = "thesame.ml@gmail.com", + .plugin.website = "http://deadbeef.sf.net", + .plugin.start = notification_start, + .plugin.stop = notification_stop, + .plugin.configdialog = settings_dlg +}; + diff --git a/plugins/oss/Makefile.am b/plugins/oss/Makefile.am index 810bd249..e2195996 100644 --- a/plugins/oss/Makefile.am +++ b/plugins/oss/Makefile.am @@ -1,6 +1,6 @@ ossdir = $(libdir)/$(PACKAGE) pkglib_LTLIBRARIES = oss.la -AM_CFLAGS = $(CFLAGS) $(OSS4_CFLAGS) +AM_CFLAGS = $(CFLAGS) $(OSS_CFLAGS) -std=c99 oss_la_SOURCES = oss.c oss_la_LDFLAGS = -module diff --git a/plugins/oss/oss.c b/plugins/oss/oss.c index 11dd52ee..64f857d3 100644 --- a/plugins/oss/oss.c +++ b/plugins/oss/oss.c @@ -15,6 +15,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifdef HAVE_CONFIG_H +# include "../../config.h" +#endif #include <stdint.h> #include <unistd.h> #ifdef __linux__ @@ -22,16 +25,16 @@ #endif #include <stdio.h> #include <string.h> +#if HAVE_SYS_SOUNDCARD_H #include <sys/soundcard.h> +#else +#include <soundcard.h> +#endif #include <fcntl.h> #include <sys/ioctl.h> #include <stdlib.h> #include "../../deadbeef.h" -//#if OSS_VERSION<0x040000 -//#error oss4 plugin: at least oss v4.0 is required to build this plugin -//#endif - #define trace(...) { fprintf(stderr, __VA_ARGS__); } //#define trace(fmt,...) @@ -45,6 +48,8 @@ static int state; static int fd; static uintptr_t mutex; +#define BLOCKSIZE 4096 + static void oss_thread (void *context); @@ -68,6 +73,18 @@ oss_init (void) { return -1; } +#if OSS_VERSION>=0x040000 +/* + int cooked = 1; + ioctl (fd, SNDCTL_DSP_COOKEDMODE, &cooked); + trace ("oss: cooked_mode=%d\n", cooked); + + int policy = 3; + ioctl (fd, SNDCTL_DSP_POLICY, &policy); + trace ("oss: policy=%d\n", policy); +*/ +#endif + int fmt = AFMT_S16_NE; if (ioctl (fd, SNDCTL_DSP_SETFMT, &fmt) == -1) { trace ("oss: failed to set format\n"); @@ -157,7 +174,9 @@ oss_free (void) { static int oss_play (void) { if (!oss_tid) { - oss_init (); + if (oss_init () < 0) { + return -1; + } } state = OUTPUT_STATE_PLAYING; return 0; @@ -227,8 +246,8 @@ oss_thread (void *context) { continue; } - char buf[1024]; - oss_callback (buf, 1024); + char buf[BLOCKSIZE]; + oss_callback (buf, sizeof (buf)); deadbeef->mutex_lock (mutex); int res = write (fd, buf, sizeof (buf)); deadbeef->mutex_unlock (mutex); diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index aff400ab..3e7ddefb 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -434,7 +434,7 @@ vorbis_stop (void) { return 0; } -static const char * exts[] = { "ogg", NULL }; +static const char * exts[] = { "ogg", "ogx", NULL }; static const char *filetypes[] = { "OggVorbis", NULL }; // define plugin interface |