annotate src/audacious/auddrct.c @ 2739:953001c668ae trunk

[svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
author giacomo
date Fri, 11 May 2007 16:27:54 -0700
parents
children 1333d28e2c50
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2739
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
1 /*
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
2 * Audacious: A cross-platform multimedia player
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
3 * Copyright (c) 2007 Giacomo Lozito
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
4 *
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
7 * the Free Software Foundation; under version 2 of the License.
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
8 *
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
12 * GNU General Public License for more details.
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
13 *
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
17 * 02110-1301, USA.
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
18 */
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
19
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
20 /* audacious_drct_* provides a handy interface for player
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
21 plugins, originally intended for migration from xmms_remote_* calls */
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
22
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
23
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
24 #include "input.h"
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
25 #include "playback.h"
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
26 #include "ui_main.h"
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
27
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
28
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
29 /* playback */
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
30
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
31 void
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
32 audacious_drct_play ( void )
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
33 {
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
34 if (playback_get_paused())
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
35 playback_pause();
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
36 else if (playlist_get_length(playlist_get_active()))
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
37 playback_initiate();
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
38 else
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
39 mainwin_eject_pushed();
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
40 return;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
41 }
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
42
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
43 void
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
44 audacious_drct_pause ( void )
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
45 {
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
46 playback_pause();
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
47 return;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
48 }
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
49
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
50 void
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
51 audacious_drct_stop ( void )
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
52 {
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
53 ip_data.stop = TRUE;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
54 playback_stop();
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
55 ip_data.stop = FALSE;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
56 mainwin_clear_song_info();
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
57 return;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
58 }
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
59
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
60 gboolean
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
61 audacious_drct_get_playing ( void )
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
62 {
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
63 return playback_get_playing();
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
64 }
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
65
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
66 gboolean
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
67 audacious_drct_get_paused ( void )
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
68 {
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
69 return playback_get_paused();
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
70 }
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
71
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
72 gboolean
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
73 audacious_drct_get_stopped ( void )
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
74 {
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
75 return !playback_get_playing();
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
76 }
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
77
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
78 gint
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
79 audacious_drct_get_time ( void )
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
80 {
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
81 gint time;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
82 if (playback_get_playing())
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
83 time = playback_get_time();
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
84 else
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
85 time = 0;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
86 return time;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
87 }
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
88
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
89 void
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
90 audacious_drct_seek ( guint pos )
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
91 {
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
92 if (playlist_get_current_length(playlist_get_active()) > 0 &&
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
93 pos < (guint)playlist_get_current_length(playlist_get_active()))
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
94 playback_seek(pos / 1000);
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
95 return;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
96 }
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
97
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
98 void
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
99 audacious_drct_get_volume( gint *vl, gint *vr )
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
100 {
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
101 input_get_volume(vl, vr);
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
102 return;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
103 }
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
104
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
105 void
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
106 audacious_drct_set_volume( gint vl, gint vr )
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
107 {
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
108 if (vl > 100)
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
109 vl = 100;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
110 if (vr > 100)
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
111 vr = 100;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
112 input_set_volume(vl, vr);
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
113 return;
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
114 }
953001c668ae [svn] - added auddrct.c/h, a migration api for plugins that once used xmms_remote; to be completed
giacomo
parents:
diff changeset
115