Mercurial > audlegacy-plugins
annotate src/cue/cuesheet.c @ 1274:bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
- revise signaling of conditional variable.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Mon, 16 Jul 2007 00:39:17 +0900 |
parents | de5d238cd42a |
children | da987606127e |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* Audacious: An advanced media player. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 * cuesheet.c: Support cuesheets as a media container. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 * Copyright (C) 2006 William Pitcock <nenolod -at- nenolod.net>. |
52
ac74515f80c1
[svn] Add +1 to the position so that the position isn't in two tracks anymore
js
parents:
51
diff
changeset
|
5 * Jonathan Schleifer <js@h3c.de> (only small fixes) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 * |
848 | 7 * Copyright (C) 2007 Yoshiki Yazawa <yaz@cc.rim.or.jp> (millisecond |
8 * seek and multithreading) | |
9 * | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 * This file was hacked out of of xmms-cueinfo, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 * Copyright (C) 2003 Oskar Liljeblad |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 * This software is copyrighted work licensed under the terms of the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 * GNU General Public License. Please consult the file "COPYING" for |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 * details. |
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 #ifdef HAVE_CONFIG_H |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 #include "config.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 |
848 | 21 /* #define DEBUG 1 */ |
809 | 22 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 #include <stdio.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 #include <ctype.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 #include <audacious/plugin.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 #include <audacious/output.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 #include <audacious/playlist.h> |
5 | 30 #include <audacious/vfs.h> |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
31 #include <audacious/util.h> |
532
04b0c54d16bb
[svn] - if the performer of a track is not specified in cue sheet, the performer of the album will be used.
yaz
parents:
520
diff
changeset
|
32 #include <audacious/strings.h> |
356 | 33 #include <audacious/main.h> |
520
8f1785471613
[svn] - add missing inclusion of audacious/strings.h where necessary
giacomo
parents:
363
diff
changeset
|
34 #include <audacious/strings.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 #define MAX_CUE_LINE_LENGTH 1000 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 #define MAX_CUE_TRACKS 1000 |
859
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
38 #define TRANSITION_GUARD_TIME 500000 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 static void cache_cue_file(gchar *f); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 static void free_cue_info(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 static void fix_cue_argument(char *line); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 static gboolean is_our_file(gchar *filespec); |
559 | 44 static void play(InputPlayback *data); |
45 static void play_cue_uri(InputPlayback *data, gchar *uri); | |
46 static gint get_time(InputPlayback *data); | |
47 static void seek(InputPlayback *data, gint time); | |
48 static void stop(InputPlayback *data); | |
49 static void cue_pause(InputPlayback *data, short); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 static TitleInput *get_tuple(gchar *uri); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 static TitleInput *get_tuple_uri(gchar *uri); |
86
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
52 static void get_song_info(gchar *uri, gchar **title, gint *length); |
809 | 53 static void cue_init(void); |
54 static void cue_cleanup(void); | |
55 static gpointer watchdog_func(gpointer data); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 |
809 | 57 GThread *watchdog_thread; |
58 static GMutex *cue_mutex; | |
59 static GCond *cue_cond; | |
60 static enum { | |
61 STOP, | |
62 RUN, | |
63 EXIT, | |
64 } watchdog_state; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 |
848 | 66 static InputPlayback *caller_ip = NULL; |
67 GThread *exec_thread; | |
68 | |
356 | 69 static gchar *cue_file = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 static gchar *cue_title = NULL; |
356 | 71 static gchar *cue_performer = NULL; |
72 static gchar *cue_genre = NULL; | |
73 static gchar *cue_year = NULL; | |
74 static gchar *cue_track = NULL; | |
75 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 static gint last_cue_track = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 static gint cur_cue_track = 0; |
356 | 78 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 static struct { |
356 | 80 gchar *title; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 gchar *performer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 gint index; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 } cue_tracks[MAX_CUE_TRACKS]; |
356 | 84 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 static gint finetune_seek = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 |
559 | 87 static InputPlayback *real_ip = NULL; |
0
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 InputPlugin cue_ip = |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
90 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 NULL, /* handle */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
92 NULL, /* filename */ |
1088 | 93 "Cuesheet Plugin", /* description */ |
809 | 94 cue_init, /* init */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
95 NULL, /* about */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
96 NULL, /* configure */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
97 is_our_file, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
98 NULL, /* audio cd */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
99 play, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
100 stop, |
251 | 101 cue_pause, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
102 seek, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
103 NULL, /* set eq */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 get_time, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
106 NULL, |
809 | 107 cue_cleanup, /* cleanup */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
108 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
109 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
111 NULL, |
86
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
112 get_song_info, /* XXX get_song_info iface */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 NULL, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
115 get_tuple, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
116 NULL |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
117 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
118 |
1088 | 119 InputPlugin *cue_iplist[] = { &cue_ip, NULL }; |
120 | |
121 DECLARE_PLUGIN(cue, NULL, NULL, cue_iplist, NULL, NULL, NULL, NULL); | |
122 | |
809 | 123 static void cue_init(void) |
124 { | |
125 cue_mutex = g_mutex_new(); | |
126 cue_cond = g_cond_new(); | |
127 | |
128 /* create watchdog thread */ | |
129 g_mutex_lock(cue_mutex); | |
130 watchdog_state = STOP; | |
131 g_mutex_unlock(cue_mutex); | |
132 watchdog_thread = g_thread_create(watchdog_func, NULL, TRUE, NULL); | |
133 #ifdef DEBUG | |
134 g_print("watchdog_thread = %p\n", watchdog_thread); | |
135 #endif | |
136 } | |
137 | |
138 static void cue_cleanup(void) | |
139 { | |
140 g_mutex_lock(cue_mutex); | |
141 watchdog_state = EXIT; | |
142 g_mutex_unlock(cue_mutex); | |
848 | 143 g_cond_broadcast(cue_cond); |
809 | 144 |
145 g_thread_join(watchdog_thread); | |
146 | |
147 g_cond_free(cue_cond); | |
148 g_mutex_free(cue_mutex); | |
149 } | |
150 | |
76
0b53b7f1959d
[svn] - too much was reverted here, only the if (!ext) return TRUE; was wrong.
nenolod
parents:
73
diff
changeset
|
151 static int is_our_file(gchar *filename) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
152 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
153 gchar *ext; |
86
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
154 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 /* is it a cue:// URI? */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
156 if (!strncasecmp(filename, "cue://", 6)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 return TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
158 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 ext = strrchr(filename, '.'); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
160 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
161 if(!ext) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
162 return FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
163 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
164 if (!strncasecmp(ext, ".cue", 4)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
165 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
166 gint i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
167 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
168 /* add the files, build cue urls, etc. */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
169 cache_cue_file(filename); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
170 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
171 for (i = 0; i < last_cue_track; i++) |
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 gchar _buf[65535]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 g_snprintf(_buf, 65535, "cue://%s?%d", filename, i); |
363
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
176 playlist_add_url(playlist_get_active(), _buf); |
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 free_cue_info(); |
81
254cc9620517
[svn] - fix issue where cuesheet plugin owns all codecs
nenolod
parents:
76
diff
changeset
|
180 |
254cc9620517
[svn] - fix issue where cuesheet plugin owns all codecs
nenolod
parents:
76
diff
changeset
|
181 return -1; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
182 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 |
81
254cc9620517
[svn] - fix issue where cuesheet plugin owns all codecs
nenolod
parents:
76
diff
changeset
|
184 return FALSE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
185 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 |
559 | 187 static gint get_time(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
188 { |
602
20b8e735f69e
[svn] - adaptation for playback API. make cuesheet plugin pass playback->output to real_ip.
yaz
parents:
559
diff
changeset
|
189 return playback->output->output_time(); |
0
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 |
559 | 192 static void play(InputPlayback *data) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 { |
809 | 194 gchar *uri = data->filename; |
848 | 195 |
196 #ifdef DEBUG | |
197 g_print("play: playback = %p\n", data); | |
198 #endif | |
199 | |
200 caller_ip = data; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 /* this isn't a cue:// uri? */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 if (strncasecmp("cue://", uri, 6)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 gchar *tmp = g_strdup_printf("cue://%s?0", uri); |
559 | 205 play_cue_uri(data, tmp); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 g_free(tmp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
207 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
208 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
209 |
559 | 210 play_cue_uri(data, uri); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
211 } |
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 static TitleInput *get_tuple(gchar *uri) |
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 TitleInput *ret; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 /* this isn't a cue:// uri? */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 if (strncasecmp("cue://", uri, 6)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 gchar *tmp = g_strdup_printf("cue://%s?0", uri); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
221 ret = get_tuple_uri(tmp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 g_free(tmp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 return ret; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
226 return get_tuple_uri(uri); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
227 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 static TitleInput *get_tuple_uri(gchar *uri) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 { |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
231 gchar *path2 = g_strdup(uri + 6); |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
232 gchar *_path = strchr(path2, '?'); |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
233 gint track = 0; |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
234 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 InputPlugin *dec; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 TitleInput *phys_tuple, *out; |
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 if (_path != NULL && *_path == '?') |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
239 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
240 *_path = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 _path++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 track = atoi(_path); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 cache_cue_file(path2); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 |
241
a1e15310703e
[svn] Crash avoidance for zeroed cue sheets. By TiCPU, submitted in #audacious.
chainsaw
parents:
239
diff
changeset
|
247 if (cue_file == NULL) |
a1e15310703e
[svn] Crash avoidance for zeroed cue sheets. By TiCPU, submitted in #audacious.
chainsaw
parents:
239
diff
changeset
|
248 return NULL; |
a1e15310703e
[svn] Crash avoidance for zeroed cue sheets. By TiCPU, submitted in #audacious.
chainsaw
parents:
239
diff
changeset
|
249 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 dec = input_check_file(cue_file, FALSE); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 if (dec == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
255 if (dec->get_song_tuple) |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
256 phys_tuple = dec->get_song_tuple(cue_file); |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
257 else |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
258 phys_tuple = input_get_song_tuple(cue_file); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 out = bmp_title_input_new(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 |
1192
16413a86172c
fix for crash when the file pointed in a cuesheet does not exist. closes #978.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1088
diff
changeset
|
262 if(!phys_tuple) |
16413a86172c
fix for crash when the file pointed in a cuesheet does not exist. closes #978.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1088
diff
changeset
|
263 return out; |
16413a86172c
fix for crash when the file pointed in a cuesheet does not exist. closes #978.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1088
diff
changeset
|
264 |
16413a86172c
fix for crash when the file pointed in a cuesheet does not exist. closes #978.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1088
diff
changeset
|
265 if(phys_tuple->file_path) |
16413a86172c
fix for crash when the file pointed in a cuesheet does not exist. closes #978.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1088
diff
changeset
|
266 out->file_path = g_strdup(phys_tuple->file_path); |
16413a86172c
fix for crash when the file pointed in a cuesheet does not exist. closes #978.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1088
diff
changeset
|
267 if(phys_tuple->file_name) |
16413a86172c
fix for crash when the file pointed in a cuesheet does not exist. closes #978.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1088
diff
changeset
|
268 out->file_name = g_strdup(phys_tuple->file_name); |
16413a86172c
fix for crash when the file pointed in a cuesheet does not exist. closes #978.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1088
diff
changeset
|
269 if(phys_tuple->file_ext) |
16413a86172c
fix for crash when the file pointed in a cuesheet does not exist. closes #978.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1088
diff
changeset
|
270 out->file_ext = g_strdup(phys_tuple->file_ext); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
271 out->length = phys_tuple->length; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 bmp_title_input_free(phys_tuple); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 out->track_name = g_strdup(cue_tracks[track].title); |
532
04b0c54d16bb
[svn] - if the performer of a track is not specified in cue sheet, the performer of the album will be used.
yaz
parents:
520
diff
changeset
|
276 out->performer = g_strdup(cue_tracks[track].performer ? |
04b0c54d16bb
[svn] - if the performer of a track is not specified in cue sheet, the performer of the album will be used.
yaz
parents:
520
diff
changeset
|
277 cue_tracks[track].performer : cue_performer); |
356 | 278 out->album_name = g_strdup(cue_title); |
279 out->genre = g_strdup(cue_genre); | |
357 | 280 out->year = cue_year ? atoi(cue_year) : 0; |
356 | 281 out->track_number = track + 1; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 return out; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
283 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 |
86
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
285 static void get_song_info(gchar *uri, gchar **title, gint *length) |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
286 { |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
287 TitleInput *tuple; |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
288 |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
289 /* this isn't a cue:// uri? */ |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
290 if (strncasecmp("cue://", uri, 6)) |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
291 { |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
292 gchar *tmp = g_strdup_printf("cue://%s?0", uri); |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
293 tuple = get_tuple_uri(tmp); |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
294 g_free(tmp); |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
295 } |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
296 else |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
297 tuple = get_tuple_uri(uri); |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
298 |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
299 g_return_if_fail(tuple != NULL); |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
300 |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
301 *title = xmms_get_titlestring(xmms_get_gentitle_format(), tuple); |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
302 *length = tuple->length; |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
303 |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
304 bmp_title_input_free(tuple); |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
305 } |
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
306 |
559 | 307 static void seek(InputPlayback * data, gint time) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 { |
848 | 309 #ifdef DEBUG |
310 g_print("seek: playback = %p\n", data); | |
311 #endif | |
312 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 if (real_ip != NULL) |
559 | 314 real_ip->plugin->seek(real_ip, time); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 |
559 | 317 static void stop(InputPlayback * data) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 { |
848 | 319 #ifdef DEBUG |
320 g_print("f: stop: playback = %p\n", data); | |
321 #endif | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 if (real_ip != NULL) |
559 | 323 real_ip->plugin->stop(real_ip); |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
324 #ifdef DEBUG |
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
325 g_print("i: stop(real_ip) finished\n"); |
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
326 #endif |
809 | 327 if (data != NULL) |
328 data->playing = 0; | |
848 | 329 if (caller_ip != NULL) |
330 caller_ip->playing = 0; | |
804 | 331 |
809 | 332 g_mutex_lock(cue_mutex); |
333 watchdog_state = STOP; | |
848 | 334 g_mutex_unlock(cue_mutex); |
809 | 335 g_cond_signal(cue_cond); |
336 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 free_cue_info(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 |
51
59e759d8c176
[svn] Fixed a crash in the cue plugin when no plugin is found / the file doesn't exist
js
parents:
12
diff
changeset
|
339 if (real_ip != NULL) { |
559 | 340 real_ip->plugin->set_info = cue_ip.set_info; |
341 real_ip->plugin->output = NULL; | |
342 g_free(real_ip); | |
51
59e759d8c176
[svn] Fixed a crash in the cue plugin when no plugin is found / the file doesn't exist
js
parents:
12
diff
changeset
|
343 real_ip = NULL; |
59e759d8c176
[svn] Fixed a crash in the cue plugin when no plugin is found / the file doesn't exist
js
parents:
12
diff
changeset
|
344 } |
848 | 345 #ifdef DEBUG |
346 g_print("e: stop\n"); | |
347 #endif | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
350 // not publicly available functions. |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
351 extern void playback_stop(void); |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
352 extern void mainwin_clear_song_info(void); |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
353 |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
354 static gboolean do_stop(gpointer data) |
848 | 355 { |
356 #ifdef DEBUG | |
357 g_print("f: do_stop\n"); | |
358 #endif | |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
359 |
848 | 360 ip_data.stop = TRUE; |
361 playback_stop(); | |
362 ip_data.stop = FALSE; | |
363 | |
364 mainwin_clear_song_info(); | |
365 | |
366 #ifdef DEBUG | |
367 g_print("e: do_stop\n"); | |
368 #endif | |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
369 return FALSE; //one-shot |
848 | 370 } |
371 | |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
372 static gboolean do_setpos(gpointer data) |
848 | 373 { |
374 Playlist *playlist = playlist_get_active(); | |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
375 gint pos = playlist_get_position_nolock(playlist); |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
376 gint incr = *(gint *)data; |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
377 |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
378 pos = pos + incr; |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
379 if(pos < 0) |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
380 pos = 0; |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
381 |
848 | 382 #ifdef DEBUG |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
383 g_print("do_setpos: pos = %d\n\n", pos); |
848 | 384 #endif |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
385 /* being done from the main loop thread, does not require locks */ |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
386 playlist_set_position(playlist, (guint)pos); |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
387 |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
388 /* kick watchdog */ |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
389 g_mutex_lock(cue_mutex); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
390 watchdog_state = RUN; |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
391 g_mutex_unlock(cue_mutex); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
392 g_cond_signal(cue_cond); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
393 |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
394 return FALSE; //one-shot |
848 | 395 } |
396 | |
559 | 397 static void cue_pause(InputPlayback * data, short p) |
251 | 398 { |
399 if (real_ip != NULL) | |
559 | 400 real_ip->plugin->pause(real_ip, p); |
251 | 401 } |
402 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 static void set_info_override(gchar * unused, gint length, gint rate, gint freq, gint nch) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 gchar *title; |
363
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
406 Playlist *playlist = playlist_get_active(); |
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
407 |
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
408 g_return_if_fail(playlist != NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
410 /* annoying. */ |
363
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
411 if (playlist->position->tuple == NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
412 { |
363
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
413 gint pos = playlist_get_position(playlist); |
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
414 playlist_get_tuple(playlist, pos); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
415 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
416 |
363
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
417 title = g_strdup(playlist->position->title); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
419 cue_ip.set_info(title, length, rate, freq, nch); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 |
559 | 422 static void play_cue_uri(InputPlayback * data, gchar *uri) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 { |
809 | 424 gchar *path2 = g_strdup(uri + 6); |
425 gchar *_path = strchr(path2, '?'); | |
309 | 426 gint file_length = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 gint track = 0; |
310
86b52a87ba33
[svn] - get_song_info() in some plugins, typically wav, would crash with NULL argument.
yaz
parents:
309
diff
changeset
|
428 gchar *dummy = NULL; |
559 | 429 InputPlugin *real_ip_plugin; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
430 |
809 | 431 #ifdef DEBUG |
432 g_print("f: play_cue_uri\n"); | |
848 | 433 g_print("play_cue_uri: playback = %p\n", data); |
809 | 434 #endif |
848 | 435 |
809 | 436 /* stop watchdog thread */ |
437 g_mutex_lock(cue_mutex); | |
438 watchdog_state = STOP; | |
848 | 439 g_mutex_unlock(cue_mutex); |
809 | 440 g_cond_signal(cue_cond); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
441 |
809 | 442 if (_path != NULL && *_path == '?') |
443 { | |
444 *_path = '\0'; | |
445 _path++; | |
446 track = atoi(_path); | |
447 } | |
448 cur_cue_track = track; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 cache_cue_file(path2); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 |
1237
0d5b0f861bf0
- quick fix for link breakage to libaudid3tag.so when --prefix is specified.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1192
diff
changeset
|
451 if (cue_file == NULL || !vfs_file_test(cue_file, G_FILE_TEST_EXISTS)) |
809 | 452 return; |
241
a1e15310703e
[svn] Crash avoidance for zeroed cue sheets. By TiCPU, submitted in #audacious.
chainsaw
parents:
239
diff
changeset
|
453 |
559 | 454 real_ip_plugin = input_check_file(cue_file, FALSE); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
455 |
559 | 456 if (real_ip_plugin != NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
457 { |
809 | 458 if (real_ip) |
459 g_free(real_ip); | |
460 real_ip = g_new0(InputPlayback, 1); | |
559 | 461 real_ip->plugin = real_ip_plugin; |
462 real_ip->plugin->set_info = set_info_override; | |
463 real_ip->plugin->output = cue_ip.output; | |
464 real_ip->filename = cue_file; | |
602
20b8e735f69e
[svn] - adaptation for playback API. make cuesheet plugin pass playback->output to real_ip.
yaz
parents:
559
diff
changeset
|
465 |
20b8e735f69e
[svn] - adaptation for playback API. make cuesheet plugin pass playback->output to real_ip.
yaz
parents:
559
diff
changeset
|
466 /* need to pass playback->output to real_ip */ |
20b8e735f69e
[svn] - adaptation for playback API. make cuesheet plugin pass playback->output to real_ip.
yaz
parents:
559
diff
changeset
|
467 real_ip->output = data->output; |
20b8e735f69e
[svn] - adaptation for playback API. make cuesheet plugin pass playback->output to real_ip.
yaz
parents:
559
diff
changeset
|
468 real_ip->data = data->data; |
20b8e735f69e
[svn] - adaptation for playback API. make cuesheet plugin pass playback->output to real_ip.
yaz
parents:
559
diff
changeset
|
469 |
559 | 470 real_ip->plugin->play_file(real_ip); |
809 | 471 |
472 if(real_ip->plugin->mseek) { // seek by millisecond | |
473 #ifdef DEBUG | |
474 g_print("mseek\n"); | |
475 #endif | |
476 real_ip->plugin->mseek(real_ip, finetune_seek ? finetune_seek : cue_tracks[track].index); | |
477 } | |
478 else | |
479 real_ip->plugin->seek(real_ip, finetune_seek ? finetune_seek / 1000 : cue_tracks[track].index / 1000 + 1); | |
480 | |
860 | 481 // in some plugins, NULL as 2nd arg causes crash. |
482 real_ip->plugin->get_song_info(cue_file, &dummy, &file_length); | |
483 g_free(dummy); | |
484 cue_tracks[last_cue_track].index = file_length; | |
485 | |
809 | 486 /* kick watchdog thread */ |
859
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
487 g_usleep(TRANSITION_GUARD_TIME); |
809 | 488 g_mutex_lock(cue_mutex); |
489 watchdog_state = RUN; | |
848 | 490 g_mutex_unlock(cue_mutex); |
809 | 491 g_cond_signal(cue_cond); |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
492 #ifdef DEBUG |
848 | 493 g_print("watchdog activated\n"); |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
494 #endif |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
495 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
497 finetune_seek = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 |
809 | 499 #ifdef DEBUG |
500 g_print("e: play_cue_uri\n"); | |
501 #endif | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
504 /******************************************************* watchdog */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
505 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
506 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
507 * This is fairly hard to explain. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
508 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
509 * Basically we loop until we have reached the correct track. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
510 * Then we set a finetune adjustment to make sure we stay in the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
511 * right place. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
512 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
513 * I used to recurse here (it was prettier), but that didn't work |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
514 * as well as I was hoping. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
515 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
516 * Anyhow, yeah. The logic here isn't great, but it works, so I'm |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
517 * cool with it. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
518 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
519 * - nenolod |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
520 */ |
809 | 521 static gpointer watchdog_func(gpointer data) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
522 { |
809 | 523 gint time = 0; |
524 Playlist *playlist = NULL; | |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
525 GTimeVal sleep_time; |
809 | 526 |
527 #ifdef DEBUG | |
528 g_print("f: watchdog\n"); | |
529 #endif | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
530 |
809 | 531 while(1) { |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
532 #if 0 |
809 | 533 #if DEBUG |
848 | 534 g_print("time = %d cur = %d cidx = %d nidx = %d last = %d\n", |
535 time, cur_cue_track, | |
809 | 536 cue_tracks[cur_cue_track].index, |
848 | 537 cue_tracks[cur_cue_track+1].index, last_cue_track); |
809 | 538 #endif |
539 #endif | |
540 g_get_current_time(&sleep_time); | |
541 g_time_val_add(&sleep_time, 10000); // 10msec | |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
542 |
809 | 543 g_mutex_lock(cue_mutex); |
544 switch(watchdog_state) { | |
545 case EXIT: | |
546 #ifdef DEBUG | |
547 g_print("e: watchdog exit\n"); | |
548 #endif | |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
549 g_mutex_unlock(cue_mutex); // stop() will lock cue_mutex. |
809 | 550 stop(real_ip); // need not to care about real_ip != NULL here. |
551 g_thread_exit(NULL); | |
552 break; | |
553 case RUN: | |
554 if(!playlist) | |
555 playlist = playlist_get_active(); | |
556 g_cond_timed_wait(cue_cond, cue_mutex, &sleep_time); | |
557 break; | |
558 case STOP: | |
559 #ifdef DEBUG | |
560 g_print("watchdog deactivated\n"); | |
561 #endif | |
562 g_cond_wait(cue_cond, cue_mutex); | |
563 playlist = playlist_get_active(); | |
564 break; | |
565 } | |
566 g_mutex_unlock(cue_mutex); | |
567 | |
859
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
568 if(watchdog_state != RUN) |
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
569 continue; |
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
570 |
809 | 571 time = get_output_time(); |
848 | 572 if(time == 0) |
573 continue; | |
809 | 574 |
575 // prev track | |
576 if (time < cue_tracks[cur_cue_track].index) | |
577 { | |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
578 static gint incr = 0; |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
579 gint oldpos = cur_cue_track; |
809 | 580 #ifdef DEBUG |
581 g_print("i: watchdog prev\n"); | |
582 g_print("time = %d cur = %d cidx = %d nidx = %d\n", time, cur_cue_track, | |
583 cue_tracks[cur_cue_track].index, | |
584 cue_tracks[cur_cue_track+1].index); | |
585 #endif | |
859
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
586 while(time < cue_tracks[cur_cue_track].index) { |
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
587 cur_cue_track--; |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
588 incr = cur_cue_track - oldpos; // relative position |
859
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
589 if (time >= cue_tracks[cur_cue_track].index) |
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
590 finetune_seek = time; |
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
591 } |
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
592 |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
593 g_mutex_lock(cue_mutex); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
594 watchdog_state = STOP; |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
595 g_mutex_unlock(cue_mutex); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
596 |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
597 g_idle_add_full(G_PRIORITY_HIGH , do_setpos, &incr, NULL); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
598 continue; |
809 | 599 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
600 |
809 | 601 // next track |
861 | 602 if (cur_cue_track + 1 < last_cue_track && time > cue_tracks[cur_cue_track + 1].index) |
809 | 603 { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
604 static gint incr = 0; |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
605 gint oldpos = cur_cue_track; |
809 | 606 #ifdef DEBUG |
607 g_print("i: watchdog next\n"); | |
860 | 608 g_print("time = %d cur = %d cidx = %d nidx = %d last = %d lidx = %d\n", time, cur_cue_track, |
809 | 609 cue_tracks[cur_cue_track].index, |
859
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
610 cue_tracks[cur_cue_track+1].index, |
860 | 611 last_cue_track, cue_tracks[last_cue_track].index); |
809 | 612 #endif |
859
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
613 while(time > cue_tracks[cur_cue_track + 1].index) { |
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
614 cur_cue_track++; |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
615 incr = cur_cue_track - oldpos; // relative position |
859
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
616 if (time <= cue_tracks[cur_cue_track].index) |
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
617 finetune_seek = time; |
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
618 } |
809 | 619 |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
620 g_mutex_lock(cue_mutex); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
621 watchdog_state = STOP; |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
622 g_mutex_unlock(cue_mutex); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
623 |
848 | 624 if(cfg.stopaftersong) { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
625 g_idle_add_full(G_PRIORITY_HIGH, do_stop, (void *)real_ip, NULL); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
626 continue; |
848 | 627 } |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
628 else { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
629 g_idle_add_full(G_PRIORITY_HIGH , do_setpos, &incr, NULL); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
630 continue; |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
631 } |
809 | 632 } |
848 | 633 |
861 | 634 // last track |
848 | 635 if (cur_cue_track + 1 == last_cue_track && |
861 | 636 (cue_tracks[last_cue_track].index - time < 500 || |
637 time > cue_tracks[last_cue_track].index) ){ // may not happen. for safety. | |
859
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
638 if(!real_ip->output->buffer_playing()) { |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
639 gint pos = playlist_get_position(playlist); |
932 | 640 if (pos + 1 == playlist_get_length(playlist)) { |
848 | 641 #ifdef DEBUG |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
642 g_print("i: watchdog eof reached\n\n"); |
848 | 643 #endif |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
644 g_mutex_lock(cue_mutex); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
645 watchdog_state = STOP; |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
646 g_mutex_unlock(cue_mutex); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
647 |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
648 if(cfg.repeat) { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
649 static gint incr = 0; |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
650 incr = -pos; |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
651 g_idle_add_full(G_PRIORITY_HIGH , do_setpos, &incr, NULL); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
652 continue; |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
653 } |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
654 else { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
655 g_idle_add_full(G_PRIORITY_HIGH, do_stop, (void *)real_ip, NULL); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
656 continue; |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
657 } |
860 | 658 } |
659 else { | |
987
8f432e790cfb
[svn] - add check for cfg.stopaftersong at the end of cue.
yaz
parents:
932
diff
changeset
|
660 if(cfg.stopaftersong) { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
661 g_idle_add_full(G_PRIORITY_HIGH, do_stop, (void *)real_ip, NULL); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
662 continue; |
987
8f432e790cfb
[svn] - add check for cfg.stopaftersong at the end of cue.
yaz
parents:
932
diff
changeset
|
663 } |
901
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
664 #ifdef DEBUG |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
665 g_print("i: watchdog end of cue, advance in playlist\n\n"); |
08643d5994fe
[svn] - now do_setpos() takes relative position as the argument and works even if cuesheets are included in large playlist. may close #869.
yaz
parents:
861
diff
changeset
|
666 #endif |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
667 static gint incr = 1; |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
668 g_idle_add_full(G_PRIORITY_HIGH , do_setpos, &incr, NULL); |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
669 continue; |
860 | 670 } |
859
301d03667d2f
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
yaz
parents:
853
diff
changeset
|
671 } |
848 | 672 } |
809 | 673 } |
674 #ifdef DEBUG | |
860 | 675 g_print("e: watchdog\n"); |
809 | 676 #endif |
677 return NULL; // dummy. | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
678 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
679 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
680 /******************************************************** cuefile */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
681 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
682 static void free_cue_info(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
683 { |
356 | 684 g_free(cue_file); cue_file = NULL; |
685 g_free(cue_title); cue_title = NULL; | |
686 g_free(cue_performer); cue_performer = NULL; | |
687 g_free(cue_genre); cue_genre = NULL; | |
688 g_free(cue_year); cue_year = NULL; | |
689 g_free(cue_track); cue_track = NULL; | |
690 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
691 for (; last_cue_track > 0; last_cue_track--) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
692 g_free(cue_tracks[last_cue_track-1].performer); |
803
4a2b2677dd9b
[svn] - performer and title of each track should be NULL after freed.
yaz
parents:
602
diff
changeset
|
693 cue_tracks[last_cue_track-1].performer = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
694 g_free(cue_tracks[last_cue_track-1].title); |
803
4a2b2677dd9b
[svn] - performer and title of each track should be NULL after freed.
yaz
parents:
602
diff
changeset
|
695 cue_tracks[last_cue_track-1].title = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
696 } |
809 | 697 #ifdef DEBUG |
860 | 698 g_print("free_cue_info: last_cue_track = %d\n", last_cue_track); |
809 | 699 #endif |
700 last_cue_track = 0; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
701 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
702 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
703 static void cache_cue_file(char *f) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
704 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
705 VFSFile *file = vfs_fopen(f, "rb"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
706 gchar line[MAX_CUE_LINE_LENGTH+1]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
707 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
708 if(!file) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
709 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
710 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
711 while (TRUE) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
712 gint p; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
713 gint q; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
714 |
239
e45005422574
[svn] FD leak fix by TiCPU, submitted in #audacious.
chainsaw
parents:
86
diff
changeset
|
715 if (vfs_fgets(line, MAX_CUE_LINE_LENGTH+1, file) == NULL) { |
e45005422574
[svn] FD leak fix by TiCPU, submitted in #audacious.
chainsaw
parents:
86
diff
changeset
|
716 vfs_fclose(file); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
717 return; |
860 | 718 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
719 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
720 for (p = 0; line[p] && isspace((int) line[p]); p++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
721 if (!line[p]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
722 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
723 for (q = p; line[q] && !isspace((int) line[q]); q++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
724 if (!line[q]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
725 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
726 line[q] = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
727 for (q++; line[q] && isspace((int) line[q]); q++); |
356 | 728 if (strcasecmp(line+p, "REM") == 0) { |
729 gint r; | |
730 for (r = q; line[r] && !isspace((int) line[r]); r++); | |
731 if (!line[r]) | |
732 continue; | |
733 line[r] = '\0'; | |
734 for (r++; line[r] && isspace((int) line[r]); r++); | |
735 if(strcasecmp(line+q, "GENRE") == 0) { | |
736 fix_cue_argument(line+r); | |
737 if (last_cue_track == 0) | |
738 cue_genre = str_to_utf8(line + r); | |
739 } | |
740 if(strcasecmp(line+q, "DATE") == 0) { | |
741 gchar *tmp; | |
742 fix_cue_argument(line+r); | |
743 if (last_cue_track == 0) { | |
744 tmp = g_strdup(line + r); | |
745 if (tmp) { | |
746 cue_year = strtok(tmp, "/"); // XXX: always in the same format? | |
747 } | |
748 } | |
749 } | |
750 } | |
751 else if (strcasecmp(line+p, "PERFORMER") == 0) { | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
752 fix_cue_argument(line+q); |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
753 |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
754 if (last_cue_track == 0) |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
755 cue_performer = str_to_utf8(line + q); |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
756 else |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
757 cue_tracks[last_cue_track - 1].performer = str_to_utf8(line + q); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
758 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
759 else if (strcasecmp(line+p, "FILE") == 0) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
760 gchar *tmp = g_path_get_dirname(f); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
761 fix_cue_argument(line+q); |
356 | 762 cue_file = g_strdup_printf("%s/%s", tmp, line+q); /* XXX: yaz might need to UTF validate this?? -nenolod */ /* as far as I know, all FILEs are in plain ASCII - yaz */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
763 g_free(tmp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
764 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
765 else if (strcasecmp(line+p, "TITLE") == 0) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
766 fix_cue_argument(line+q); |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
767 if (last_cue_track == 0) |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
768 cue_title = str_to_utf8(line + q); |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
769 else |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
770 cue_tracks[last_cue_track-1].title = str_to_utf8(line + q); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
771 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
772 else if (strcasecmp(line+p, "TRACK") == 0) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
773 gint track; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
774 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
775 fix_cue_argument(line+q); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
776 for (p = q; line[p] && isdigit((int) line[p]); p++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
777 line[p] = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
778 for (; line[q] && line[q] == '0'; q++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
779 if (!line[q]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
780 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
781 track = atoi(line+q); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
782 if (track >= MAX_CUE_TRACKS) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
783 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
784 last_cue_track = track; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
785 cue_tracks[last_cue_track-1].index = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
786 cue_tracks[last_cue_track-1].performer = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
787 cue_tracks[last_cue_track-1].title = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
788 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
789 else if (strcasecmp(line+p, "INDEX") == 0) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
790 for (p = q; line[p] && !isspace((int) line[p]); p++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
791 if (!line[p]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
792 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
793 for (p++; line[p] && isspace((int) line[p]); p++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
794 for (q = p; line[q] && !isspace((int) line[q]); q++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
795 if (q-p >= 8 && line[p+2] == ':' && line[p+5] == ':') { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
796 cue_tracks[last_cue_track-1].index = |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
797 ((line[p+0]-'0')*10 + (line[p+1]-'0')) * 60000 + |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
798 ((line[p+3]-'0')*10 + (line[p+4]-'0')) * 1000 + |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
799 ((line[p+6]-'0')*10 + (line[p+7]-'0')) * 10; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
800 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
801 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
802 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
803 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
804 vfs_fclose(file); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
805 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
806 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
807 static void fix_cue_argument(char *line) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
808 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
809 if (line[0] == '"') { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
810 gchar *l2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
811 for (l2 = line+1; *l2 && *l2 != '"'; l2++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
812 *(l2-1) = *l2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
813 *(l2-1) = *l2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
814 for (; *line && *line != '"'; line++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
815 if (*line == '\\' && *(line+1)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
816 for (l2 = line+1; *l2 && *l2 != '"'; l2++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
817 *(l2-1) = *l2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
818 *(l2-1) = *l2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
819 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
820 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
821 *line = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
822 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
823 else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
824 for (; *line && *line != '\r' && *line != '\n'; line++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
825 *line = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
826 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
827 } |