annotate src/lirc/lirc.c @ 3196:0f7180e3b163

alsa-ng: Enforce a minimum buffer size of 500ms.
author William Pitcock <nenolod@atheme.org>
date Sun, 12 Jul 2009 08:30:13 -0500
parents 3134a0987162
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 /* Lirc plugin
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3 Copyright (C) 2005 Audacious development team
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
5 Copyright (c) 1998-1999 Carl van Schaik (carl@leg.uct.ac.za)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 Copyright (C) 2000 Christoph Bartelmus (xmms@bartelmus.de)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9 some code was stolen from:
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 IRman plugin for xmms by Charles Sielski (stray@teklabs.net)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
11
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12 This program is free software; you can redistribute it and/or modify
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
13 it under the terms of the GNU General Public License as published by
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
14 the Free Software Foundation; either version 2 of the License, or
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 (at your option) any later version.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 This program is distributed in the hope that it will be useful,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
20 GNU General Public License for more details.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
21
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
22 You should have received a copy of the GNU General Public License
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
23 along with this program; if not, write to the Free Software
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26
1914
5e88191720a7 - Fix HAVE_CONFIG_H for lirc
Ralf Ertzinger <ralf@skytale.net>
parents: 1716
diff changeset
27 #include "config.h"
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29 #include <stdio.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
30 #include <unistd.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31 #include <fcntl.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32 #include <string.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
33 #include <signal.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 #include <stdlib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
35 #include <ctype.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
36
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
37 #include <gtk/gtk.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
38
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
39 #include <glib.h>
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2309
diff changeset
40 #include <audlegacy/i18n.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
41
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2309
diff changeset
42 #include <audlegacy/plugin.h>
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2309
diff changeset
43 #include <audlegacy/auddrct.h>
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
44
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
45 #include <lirc/lirc_client.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
46
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
47 #include "lirc.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
48
2277
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
49 #include "common.h"
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
50
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
51 const char *plugin_name="LIRC Plugin";
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
52
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
53 GeneralPlugin lirc_plugin = {
1716
fd393aeaad23 - update LIRC plugin structure
Giacomo Lozito <james@develia.org>
parents: 1395
diff changeset
54 .description = "LIRC Plugin",
fd393aeaad23 - update LIRC plugin structure
Giacomo Lozito <james@develia.org>
parents: 1395
diff changeset
55 .init = init,
fd393aeaad23 - update LIRC plugin structure
Giacomo Lozito <james@develia.org>
parents: 1395
diff changeset
56 .about = about,
2277
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
57 .configure = configure,
1716
fd393aeaad23 - update LIRC plugin structure
Giacomo Lozito <james@develia.org>
parents: 1395
diff changeset
58 .cleanup = cleanup
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
59 };
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
60
1118
6f9882365155 [svn] - lirc: converted to v2 plugin system
giacomo
parents: 1060
diff changeset
61 GeneralPlugin *lirc_gplist[] = { &lirc_plugin, NULL };
1395
761e17b23e0c added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 1118
diff changeset
62 DECLARE_PLUGIN(lirc, NULL, NULL, NULL, NULL, NULL, lirc_gplist, NULL, NULL);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
63
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
64 int lirc_fd=-1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
65 struct lirc_config *config=NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
66 gint tracknr=0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
67 gint mute=0; /* mute flag */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
68 gint mute_vol=0; /* holds volume before mute */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
69
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
70 gint input_tag;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
71
2305
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
72 char track_no[64];
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
73 int track_no_pos;
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
74
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
75 gint tid;
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
76
2277
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
77 void init_lirc(void)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
78 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
79 int flags;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
80
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
81 if((lirc_fd=lirc_init("audacious",1))==-1)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
82 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
83 fprintf(stderr,_("%s: could not init LIRC support\n"),
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
84 plugin_name);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
85 return;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
86 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
87 if(lirc_readconfig(NULL,&config,NULL)==-1)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
88 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
89 lirc_deinit();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
90 fprintf(stderr,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
91 _("%s: could not read LIRC config file\n"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
92 "%s: please read the documentation of LIRC\n"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
93 "%s: how to create a proper config file\n"),
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
94 plugin_name,plugin_name,plugin_name);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
95 return;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
96 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
97 input_tag=gdk_input_add(lirc_fd,GDK_INPUT_READ,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
98 lirc_input_callback,NULL);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
99 fcntl(lirc_fd,F_SETOWN,getpid());
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
100 flags=fcntl(lirc_fd,F_GETFL,0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
101 if(flags!=-1)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
102 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
103 fcntl(lirc_fd,F_SETFL,flags|O_NONBLOCK);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
104 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
105 fflush(stdout);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
106 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
107
2277
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
108 void init(void)
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
109 {
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
110 load_cfg();
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
111 init_lirc();
2305
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
112 track_no_pos=0;
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
113 tid=0;
2277
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
114 }
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
115
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
116 gboolean reconnect_lirc(gpointer data)
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
117 {
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
118 fprintf(stderr,_("%s: trying to reconnect...\n"),plugin_name);
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
119 init();
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
120 return (lirc_fd==-1);
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
121 }
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
122
2305
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
123 gboolean jump_to(gpointer data)
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
124 {
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
125 audacious_drct_pl_set_pos(atoi(track_no)-1);
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
126 track_no_pos=0;
2309
8d4db9a04cd2 Prevent g_source_remove() from being called multiple times. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2305
diff changeset
127 tid=0;
2305
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
128 return FALSE;
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
129 }
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
130
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
131 void lirc_input_callback(gpointer data,gint source,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
132 GdkInputCondition condition)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
133 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
134 char *code;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
135 char *c;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
136 gint playlist_time,playlist_pos,output_time,v;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
137 int ret;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
138 char *ptr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
139 gint balance;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
140 gboolean show_pl;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
141 int n;
2305
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
142 gchar *utf8_title_markup;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
143
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
144 while((ret=lirc_nextcode(&code))==0 && code!=NULL)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
145 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
146 while((ret=lirc_code2char(config,code,&c))==0 && c!=NULL)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
147 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
148 if(strcasecmp("PLAY",c)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
149 {
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
150 audacious_drct_play();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
151 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
152 else if(strcasecmp("STOP",c)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
153 {
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
154 audacious_drct_stop();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
155 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
156 else if(strcasecmp("PAUSE",c)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
157 {
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
158 audacious_drct_pause();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
159 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
160 else if(strcasecmp("PLAYPAUSE",c) == 0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
161 {
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
162 if(audacious_drct_get_playing())
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
163 audacious_drct_pause();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
164 else
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
165 audacious_drct_play();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
166 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
167 else if(strncasecmp("NEXT",c,4)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
168 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
169 ptr=c+4;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
170 while(isspace(*ptr)) ptr++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
171 n=atoi(ptr);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
172
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
173 if(n<=0) n=1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
174 for(;n>0;n--)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
175 {
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
176 audacious_drct_pl_next();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
177 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
178 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
179 else if(strncasecmp("PREV",c,4)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
180 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
181 ptr=c+4;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
182 while(isspace(*ptr)) ptr++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
183 n=atoi(ptr);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
184
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
185 if(n<=0) n=1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
186 for(;n>0;n--)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
187 {
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
188 audacious_drct_pl_prev();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
189 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
190 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
191 else if(strcasecmp("SHUFFLE",c)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
192 {
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
193 audacious_drct_pl_shuffle_toggle();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
194 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
195 else if(strcasecmp("REPEAT",c)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
196 {
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
197 audacious_drct_pl_repeat_toggle();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
198 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
199 else if(strncasecmp("FWD",c,3)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
200 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
201 ptr=c+3;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
202 while(isspace(*ptr)) ptr++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
203 n=atoi(ptr)*1000;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
204
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
205 if(n<=0) n=5000;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
206 output_time=audacious_drct_get_time();
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
207 playlist_pos=audacious_drct_pl_get_pos();
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
208 playlist_time=audacious_drct_pl_get_time(playlist_pos);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
209 if(playlist_time-output_time<n)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
210 output_time=playlist_time-n;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
211 audacious_drct_seek(output_time+n);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
212 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
213 else if(strncasecmp("BWD",c,3)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
214 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
215 ptr=c+3;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
216 while(isspace(*ptr)) ptr++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
217 n=atoi(ptr)*1000;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
218
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
219 if(n<=0) n=5000;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
220 output_time=audacious_drct_get_time();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
221 if(output_time<n)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
222 output_time=n;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
223 audacious_drct_seek(output_time-n);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
224 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
225 else if(strncasecmp("VOL_UP",c,6)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
226 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
227 ptr=c+6;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
228 while(isspace(*ptr)) ptr++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
229 n=atoi(ptr);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
230 if(n<=0) n=5;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
231
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
232 audacious_drct_get_volume_main(&v);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
233 if(v > (100-n)) v=100-n;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
234 audacious_drct_set_volume_main(v+n);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
235 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
236 else if(strncasecmp("VOL_DOWN",c,8)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
237 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
238 ptr=c+8;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
239 while (isspace(*ptr)) ptr++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
240 n=atoi(ptr);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
241 if(n<=0) n=5;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
242
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
243 audacious_drct_get_volume_main(&v);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
244 if(v<n) v=n;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
245 audacious_drct_set_volume_main(v-n);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
246 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
247 else if(strcasecmp("QUIT",c)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
248 {
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
249 audacious_drct_quit();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
250 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
251 else if(strcasecmp("MUTE",c)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
252 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
253 if(mute==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
254 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
255 mute=1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
256 /* store the master volume so
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
257 we can restore it on unmute. */
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
258 audacious_drct_get_volume_main(&mute_vol);
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
259 audacious_drct_set_volume_main(0);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
260 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
261 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
262 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
263 mute=0;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
264 audacious_drct_set_volume_main(mute_vol);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
265 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
266 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
267 else if(strncasecmp("BAL_LEFT",c,8)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
268 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
269 ptr=c+8;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
270 while(isspace(*ptr)) ptr++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
271 n=atoi(ptr);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
272 if(n<=0) n=5;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
273
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
274 audacious_drct_get_volume_balance(&balance);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
275 balance-=n;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
276 if(balance<-100) balance=-100;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
277 audacious_drct_set_volume_balance(balance);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
278 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
279 else if(strncasecmp("BAL_RIGHT",c,9)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
280 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
281 ptr=c+9;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
282 while(isspace(*ptr)) ptr++;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
283 n=atoi(ptr);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
284 if(n<=0) n=5;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
285
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
286 audacious_drct_get_volume_balance(&balance);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
287 balance+=n;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
288 if(balance>100) balance=100;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
289 audacious_drct_set_volume_balance(balance);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
290 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
291 else if(strcasecmp("BAL_CENTER",c)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
292 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
293 balance=0;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
294 audacious_drct_set_volume_balance(balance);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
295 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
296 else if(strcasecmp("LIST",c)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
297 {
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
298 show_pl=audacious_drct_pl_win_is_visible();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
299 show_pl=(show_pl) ? 0:1;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
300 audacious_drct_pl_win_toggle(show_pl);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
301 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
302 else if(strcasecmp("PLAYLIST_CLEAR",c)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
303 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
304 gboolean pl_visible;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
305
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
306 pl_visible=audacious_drct_pl_win_is_visible();
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
307 audacious_drct_stop();
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
308 audacious_drct_pl_clear();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
309 /* This is to refresh window content */
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
310 audacious_drct_pl_win_toggle(pl_visible);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
311 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
312 else if(strncasecmp("PLAYLIST_ADD ",c,13)==0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
313 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
314 gboolean pl_visible;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
315 GList list;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
316
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
317 pl_visible=audacious_drct_pl_win_is_visible();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
318 list.prev=list.next=NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
319 list.data=c+13;
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
320 audacious_drct_pl_add(&list);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
321 /* This is to refresh window content */
1034
b0cb6f8d4339 [svn] - lirc: works again with auddrct
giacomo
parents: 527
diff changeset
322 audacious_drct_pl_win_toggle(pl_visible);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
323 }
2305
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
324 else if((strlen(c)==1) && ((*c>='0') || (*c<='9')))
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
325 {
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
326 if (track_no_pos<63)
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
327 {
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
328 if (tid) g_source_remove(tid);
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
329 track_no[track_no_pos++]=*c;
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
330 track_no[track_no_pos]=0;
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
331 tid=g_timeout_add(1500, jump_to, NULL);
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
332 utf8_title_markup = g_markup_printf_escaped(
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
333 "<span font_desc='%s'>%s</span>", aosd_font, track_no);
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
334 aud_hook_call("aosd toggle", utf8_title_markup);
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
335 }
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
336 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
337 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
338 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
339 fprintf(stderr,_("%s: unknown command \"%s\"\n"),
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
340 plugin_name,c);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
341 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
342 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
343 free(code);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
344 if(ret==-1) break;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
345 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
346 if(ret==-1)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
347 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
348 /* something went badly wrong */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
349 fprintf(stderr,_("%s: disconnected from LIRC\n"),plugin_name);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
350 cleanup();
2277
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
351 if(b_enable_reconnect)
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
352 {
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
353 fprintf(stderr,_("%s: will try reconnect every %d seconds...\n"),plugin_name,reconnect_timeout);
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
354 g_timeout_add(1000*reconnect_timeout, reconnect_lirc, NULL);
5e54ffc4f46f Apply lirc patch from bugzilla. (Bugzilla #62).
Andrew O. Shadoura <bugzilla@tut.by>
parents: 1914
diff changeset
355 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
356 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
357 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
358
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
359 void cleanup()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
360 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
361 if(config)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
362 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
363 if(input_tag)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
364 gtk_input_remove(input_tag);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
365
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
366 config=NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
367 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
368 if(lirc_fd!=-1)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
369 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
370 lirc_deinit();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
371 lirc_fd=-1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
372 }
2305
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2277
diff changeset
373 g_free(aosd_font);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
374 }