annotate src/evdev-plug/ed.c @ 422:5e46b57d1eda trunk

[svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
author giacomo
date Sun, 14 Jan 2007 17:55:24 -0800
parents
children f757e1aa62e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
422
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
1 /*
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
2 *
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
3 * Author: Giacomo Lozito <james@develia.org>, (C) 2005-2007
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
4 *
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify it
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
6 * under the terms of the GNU General Public License as published by the
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
7 * Free Software Foundation; either version 2 of the License, or (at your
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
8 * option) any later version.
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
9 *
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful, but
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
13 * General Public License for more details.
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
14 *
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License along
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
16 * with this program; if not, write to the Free Software Foundation, Inc.,
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
18 *
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
19 */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
20
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
21 #include "ed.h"
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
22 #include "ed_types.h"
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
23 #include "ed_internals.h"
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
24 #include "ed_actions.h"
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
25 #include "ed_ui.h"
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
26 #include "ed_common.h"
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
27 #include <glib/gi18n.h>
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
28 #include <audacious/beepctrl.h>
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
29
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
30
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
31 GList *ed_device_listening_list = NULL;
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
32 gboolean plugin_is_active = FALSE;
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
33
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
34 /* action callbacks */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
35 void ed_action_pb_play ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
36 void ed_action_pb_stop ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
37 void ed_action_pb_pause ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
38 void ed_action_pb_prev ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
39 void ed_action_pb_next ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
40 void ed_action_pb_eject ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
41 void ed_action_vol_up5 ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
42 void ed_action_vol_down5 ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
43 void ed_action_vol_up10 ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
44 void ed_action_vol_down10 ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
45 void ed_action_win_main ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
46 void ed_action_win_playlist ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
47 void ed_action_win_equalizer ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
48 void ed_action_pl_repeat ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
49 void ed_action_pl_shuffle ( gpointer );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
50
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
51 /* map action codes to ed_action_t objects */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
52 ed_action_t player_actions[] =
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
53 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
54 [ED_ACTION_PB_PLAY] = { N_("Playback->Play") , ed_action_pb_play },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
55 [ED_ACTION_PB_STOP] = { N_("Playback->Stop") , ed_action_pb_stop },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
56 [ED_ACTION_PB_PAUSE] = { N_("Playback->Pause") , ed_action_pb_pause },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
57 [ED_ACTION_PB_PREV] = { N_("Playback->Prev") , ed_action_pb_prev },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
58 [ED_ACTION_PB_NEXT] = { N_("Playback->Next") , ed_action_pb_next },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
59 [ED_ACTION_PB_EJECT] = { N_("Playback->Eject") , ed_action_pb_eject },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
60
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
61 [ED_ACTION_PL_REPEAT] = { N_("Playlist->Repeat") , ed_action_pl_repeat },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
62 [ED_ACTION_PL_SHUFFLE] = { N_("Playlist->Shuffle") , ed_action_pl_shuffle },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
63
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
64 [ED_ACTION_VOL_UP5] = { N_("Volume->Up_5") , ed_action_vol_up5 },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
65 [ED_ACTION_VOL_DOWN5] = { N_("Volume->Down_5") , ed_action_vol_down5 },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
66 [ED_ACTION_VOL_UP10] = { N_("Volume->Up_10") , ed_action_vol_up10 },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
67 [ED_ACTION_VOL_DOWN10] = { N_("Volume->Down_10") , ed_action_vol_down10 },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
68
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
69 [ED_ACTION_WIN_MAIN] = { N_("Window->Main") , ed_action_win_main },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
70 [ED_ACTION_WIN_PLAYLIST] = { N_("Window->Playlist") , ed_action_win_playlist },
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
71 [ED_ACTION_WIN_EQUALIZER] = { N_("Window->Equalizer") , ed_action_win_equalizer }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
72 };
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
73
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
74
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
75
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
76 /* ***************** */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
77 /* plug-in functions */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
78
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
79 GeneralPlugin *get_gplugin_info()
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
80 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
81 return &ed_gp;
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
82 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
83
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
84
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
85 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
86 ed_init ( void )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
87 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
88 g_log_set_handler( NULL , G_LOG_LEVEL_WARNING , g_log_default_handler , NULL );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
89
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
90 plugin_is_active = TRUE; /* go! */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
91
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
92 /* read event devices and bindings from user
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
93 configuration and start listening for active ones */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
94 ed_device_start_listening_from_config();
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
95
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
96 return;
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
97 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
98
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
99
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
100 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
101 ed_cleanup ( void )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
102 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
103 /* shut down all devices being listened */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
104 ed_device_stop_listening_all( TRUE );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
105
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
106 plugin_is_active = FALSE; /* stop! */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
107
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
108 return;
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
109 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
110
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
111
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
112 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
113 ed_config ( void )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
114 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
115 ed_ui_config_show();
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
116 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
117
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
118
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
119 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
120 ed_about ( void )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
121 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
122 ed_ui_about_show();
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
123 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
124
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
125
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
126
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
127 /* ************** */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
128 /* player actions */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
129
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
130 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
131 ed_action_call ( gint code , gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
132 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
133 DEBUGMSG( "Calling action; code %i ( %s )\n" , code , player_actions[code].desc );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
134
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
135 /* activate callback for requested action */
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
136 player_actions[code].callback( param );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
137 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
138
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
139
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
140 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
141 ed_action_pb_play ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
142 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
143 xmms_remote_play( ed_gp.xmms_session );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
144 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
145
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
146 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
147 ed_action_pb_stop ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
148 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
149 xmms_remote_stop( ed_gp.xmms_session );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
150 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
151
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
152 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
153 ed_action_pb_pause ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
154 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
155 xmms_remote_pause( ed_gp.xmms_session );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
156 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
157
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
158 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
159 ed_action_pb_prev ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
160 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
161 xmms_remote_playlist_prev( ed_gp.xmms_session );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
162 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
163
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
164 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
165 ed_action_pb_next ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
166 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
167 xmms_remote_playlist_next( ed_gp.xmms_session );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
168 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
169
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
170 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
171 ed_action_pb_eject ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
172 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
173 xmms_remote_eject( ed_gp.xmms_session );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
174 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
175
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
176 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
177 ed_action_pl_repeat ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
178 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
179 xmms_remote_toggle_repeat( ed_gp.xmms_session );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
180 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
181
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
182 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
183 ed_action_pl_shuffle ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
184 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
185 xmms_remote_toggle_shuffle( ed_gp.xmms_session );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
186 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
187
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
188 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
189 ed_action_vol_up5 ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
190 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
191 gint vl, vr;
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
192 xmms_remote_get_volume( ed_gp.xmms_session , &vl , &vr );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
193 xmms_remote_set_volume( ed_gp.xmms_session , CLAMP(vl + 5, 0, 100) , CLAMP(vr + 5, 0, 100) );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
194 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
195
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
196 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
197 ed_action_vol_down5 ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
198 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
199 gint vl, vr;
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
200 xmms_remote_get_volume( ed_gp.xmms_session , &vl , &vr );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
201 xmms_remote_set_volume( ed_gp.xmms_session , CLAMP(vl - 5, 0, 100) , CLAMP(vr - 5, 0, 100) );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
202 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
203
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
204 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
205 ed_action_vol_up10 ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
206 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
207 gint vl, vr;
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
208 xmms_remote_get_volume( ed_gp.xmms_session , &vl , &vr );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
209 xmms_remote_set_volume( ed_gp.xmms_session , CLAMP(vl + 10, 0, 100) , CLAMP(vr + 10, 0, 100) );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
210 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
211
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
212 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
213 ed_action_vol_down10 ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
214 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
215 gint vl, vr;
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
216 xmms_remote_get_volume( ed_gp.xmms_session , &vl , &vr );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
217 xmms_remote_set_volume( ed_gp.xmms_session , CLAMP(vl - 10, 0, 100) , CLAMP(vr - 10, 0, 100) );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
218 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
219
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
220 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
221 ed_action_win_main ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
222 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
223 xmms_remote_main_win_toggle( ed_gp.xmms_session ,
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
224 !xmms_remote_is_main_win ( ed_gp.xmms_session ) );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
225 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
226
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
227 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
228 ed_action_win_playlist ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
229 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
230 xmms_remote_pl_win_toggle( ed_gp.xmms_session ,
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
231 !xmms_remote_is_pl_win ( ed_gp.xmms_session ) );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
232 }
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
233
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
234 void
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
235 ed_action_win_equalizer ( gpointer param )
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
236 {
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
237 xmms_remote_eq_win_toggle( ed_gp.xmms_session ,
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
238 !xmms_remote_is_eq_win ( ed_gp.xmms_session ) );
5e46b57d1eda [svn] - added evdev-plug, written-from-scratch plugin that allows to control the player via event devices on linux systems
giacomo
parents:
diff changeset
239 }