Mercurial > audlegacy-plugins
annotate src/cue/cuesheet.c @ 1984:489e32a8e106
change some places to use set_params() instead of set_info() directly
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sun, 07 Oct 2007 14:19:19 -0500 |
parents | fa9f85cebade |
children | 9d0f5be50219 |
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 */ |
1772
bbebc130f8f5
cue: Mk2, HAVE_CONFIG_H removal, etc
William Pitcock <nenolod@atheme.org>
parents:
1762
diff
changeset
|
17 |
0
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 |
848 | 20 /* #define DEBUG 1 */ |
809 | 21 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 #include <stdio.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 #include <ctype.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 #include <audacious/plugin.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 #include <audacious/output.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 #include <audacious/playlist.h> |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
29 #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
|
30 #include <audacious/strings.h> |
356 | 31 #include <audacious/main.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 #define MAX_CUE_LINE_LENGTH 1000 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 #define MAX_CUE_TRACKS 1000 |
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 static void cache_cue_file(gchar *f); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 static void free_cue_info(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 static void fix_cue_argument(char *line); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 static gboolean is_our_file(gchar *filespec); |
559 | 40 static void play(InputPlayback *data); |
41 static void play_cue_uri(InputPlayback *data, gchar *uri); | |
42 static gint get_time(InputPlayback *data); | |
43 static void seek(InputPlayback *data, gint time); | |
44 static void stop(InputPlayback *data); | |
45 static void cue_pause(InputPlayback *data, short); | |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
46 static Tuple *get_tuple(gchar *uri); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
47 static Tuple *get_aud_tuple_uri(gchar *uri); |
809 | 48 static void cue_init(void); |
49 static void cue_cleanup(void); | |
50 static gpointer watchdog_func(gpointer data); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 |
1364
8916502b398c
make sure thread pointer to be NULL if corresponding thread doesn't exist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1363
diff
changeset
|
52 static GThread *watchdog_thread = NULL; |
8916502b398c
make sure thread pointer to be NULL if corresponding thread doesn't exist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1363
diff
changeset
|
53 static GThread *play_thread = NULL; |
8916502b398c
make sure thread pointer to be NULL if corresponding thread doesn't exist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1363
diff
changeset
|
54 static GThread *real_play_thread = NULL; |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
55 |
809 | 56 static GMutex *cue_mutex; |
57 static GCond *cue_cond; | |
58 static enum { | |
59 STOP, | |
60 RUN, | |
61 EXIT, | |
62 } watchdog_state; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
64 static GMutex *cue_block_mutex; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
65 static GCond *cue_block_cond; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
66 |
848 | 67 static InputPlayback *caller_ip = NULL; |
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; |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
78 static gint target_time = 0; |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
79 static GMutex *cue_target_time_mutex; |
356 | 80 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 static struct { |
356 | 82 gchar *title; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 gchar *performer; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 gint index; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 } cue_tracks[MAX_CUE_TRACKS]; |
356 | 86 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 static gint finetune_seek = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 |
559 | 89 static InputPlayback *real_ip = NULL; |
0
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 InputPlugin cue_ip = |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
92 { |
1615
41286bab50dc
cuesheet: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1597
diff
changeset
|
93 .description = "Cuesheet Plugin", /* description */ |
41286bab50dc
cuesheet: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1597
diff
changeset
|
94 .init = cue_init, /* init */ |
41286bab50dc
cuesheet: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1597
diff
changeset
|
95 .is_our_file = is_our_file, |
41286bab50dc
cuesheet: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1597
diff
changeset
|
96 .play_file = play, |
41286bab50dc
cuesheet: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1597
diff
changeset
|
97 .stop = stop, |
41286bab50dc
cuesheet: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1597
diff
changeset
|
98 .pause = cue_pause, |
41286bab50dc
cuesheet: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1597
diff
changeset
|
99 .seek = seek, |
41286bab50dc
cuesheet: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1597
diff
changeset
|
100 .get_time = get_time, |
41286bab50dc
cuesheet: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1597
diff
changeset
|
101 .cleanup = cue_cleanup, /* cleanup */ |
1623
1aee1ff54c8b
get_tuple should be get_song_tuple
William Pitcock <nenolod@atheme.org>
parents:
1615
diff
changeset
|
102 .get_song_tuple = get_tuple, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
103 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 |
1088 | 105 InputPlugin *cue_iplist[] = { &cue_ip, NULL }; |
106 | |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1376
diff
changeset
|
107 DECLARE_PLUGIN(cue, NULL, NULL, cue_iplist, NULL, NULL, NULL, NULL, NULL); |
1088 | 108 |
809 | 109 static void cue_init(void) |
110 { | |
111 cue_mutex = g_mutex_new(); | |
112 cue_cond = g_cond_new(); | |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
113 cue_block_mutex = g_mutex_new(); |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
114 cue_block_cond = g_cond_new(); |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
115 cue_target_time_mutex = g_mutex_new(); |
809 | 116 |
117 /* create watchdog thread */ | |
118 g_mutex_lock(cue_mutex); | |
119 watchdog_state = STOP; | |
120 g_mutex_unlock(cue_mutex); | |
121 watchdog_thread = g_thread_create(watchdog_func, NULL, TRUE, NULL); | |
122 #ifdef DEBUG | |
123 g_print("watchdog_thread = %p\n", watchdog_thread); | |
124 #endif | |
1483
e8330e6bd0ba
Register cue:// with uri_set_plugin
Christian Birchinger <joker@netswarm.net>
parents:
1473
diff
changeset
|
125 uri_set_plugin("cue://", &cue_ip); |
809 | 126 } |
127 | |
128 static void cue_cleanup(void) | |
129 { | |
130 g_mutex_lock(cue_mutex); | |
131 watchdog_state = EXIT; | |
132 g_mutex_unlock(cue_mutex); | |
848 | 133 g_cond_broadcast(cue_cond); |
809 | 134 |
135 g_thread_join(watchdog_thread); | |
136 | |
137 g_cond_free(cue_cond); | |
138 g_mutex_free(cue_mutex); | |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
139 g_cond_free(cue_block_cond); |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
140 g_mutex_free(cue_block_mutex); |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
141 g_mutex_free(cue_target_time_mutex); |
809 | 142 } |
143 | |
76
0b53b7f1959d
[svn] - too much was reverted here, only the if (!ext) return TRUE; was wrong.
nenolod
parents:
73
diff
changeset
|
144 static int is_our_file(gchar *filename) |
0
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 gchar *ext; |
86
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
147 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
148 /* is it a cue:// URI? */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
149 if (!strncasecmp(filename, "cue://", 6)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
150 return TRUE; |
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 ext = strrchr(filename, '.'); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
153 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
154 if(!ext) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 return FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
156 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 if (!strncasecmp(ext, ".cue", 4)) |
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 gint i; |
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 /* add the files, build cue urls, etc. */ |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
162 cache_cue_file(filename); //filename should be uri. |
0
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 for (i = 0; i < last_cue_track; i++) |
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 gchar _buf[65535]; |
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 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
|
169 playlist_add_url(playlist_get_active(), _buf); |
0
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
172 free_cue_info(); |
81
254cc9620517
[svn] - fix issue where cuesheet plugin owns all codecs
nenolod
parents:
76
diff
changeset
|
173 |
254cc9620517
[svn] - fix issue where cuesheet plugin owns all codecs
nenolod
parents:
76
diff
changeset
|
174 return -1; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 |
81
254cc9620517
[svn] - fix issue where cuesheet plugin owns all codecs
nenolod
parents:
76
diff
changeset
|
177 return FALSE; |
0
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 |
559 | 180 static gint get_time(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 { |
602
20b8e735f69e
[svn] - adaptation for playback API. make cuesheet plugin pass playback->output to real_ip.
yaz
parents:
559
diff
changeset
|
182 return playback->output->output_time(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
184 |
559 | 185 static void play(InputPlayback *data) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 { |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
187 gchar *uri = g_strdup(data->filename); |
848 | 188 |
189 #ifdef DEBUG | |
190 g_print("play: playback = %p\n", data); | |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
191 g_print("play: uri = %s\n", uri); |
848 | 192 #endif |
193 | |
194 caller_ip = data; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
195 /* this isn't a cue:// uri? */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
196 if (strncasecmp("cue://", uri, 6)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
197 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 gchar *tmp = g_strdup_printf("cue://%s?0", uri); |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
199 g_free(uri); |
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
200 uri = tmp; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 } |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
202 play_thread = g_thread_self(); |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
203 data->set_pb_ready(data); // it should be done in real input plugin? --yaz |
559 | 204 play_cue_uri(data, uri); |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
205 g_free(uri); uri = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
207 |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
208 static Tuple *get_tuple(gchar *uri) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
209 { |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
210 Tuple *ret; |
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 /* this isn't a cue:// uri? */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 if (strncasecmp("cue://", uri, 6)) |
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 gchar *tmp = g_strdup_printf("cue://%s?0", uri); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
216 ret = get_aud_tuple_uri(tmp); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 g_free(tmp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 return ret; |
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 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
221 return get_aud_tuple_uri(uri); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
224 static void _aud_tuple_copy_field(Tuple *tuple, Tuple *tuple2, const gint nfield, const gchar *field) |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
225 { |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
226 const gchar *str = aud_tuple_get_string(tuple, nfield, field); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
227 aud_tuple_disassociate(tuple2, nfield, field); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
228 aud_tuple_associate_string(tuple2, nfield, field, str); |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
229 } |
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
230 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
231 static Tuple *get_aud_tuple_uri(gchar *uri) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 { |
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
|
233 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
|
234 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
|
235 gint track = 0; |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
236 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
237 ProbeResult *pr; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 InputPlugin *dec; |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
239 |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
240 Tuple *phys_tuple, *out; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 if (_path != NULL && *_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 *_path = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 _path++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 track = atoi(_path); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
249 cache_cue_file(path2); //path2 should be uri. |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 |
241
a1e15310703e
[svn] Crash avoidance for zeroed cue sheets. By TiCPU, submitted in #audacious.
chainsaw
parents:
239
diff
changeset
|
251 if (cue_file == NULL) |
a1e15310703e
[svn] Crash avoidance for zeroed cue sheets. By TiCPU, submitted in #audacious.
chainsaw
parents:
239
diff
changeset
|
252 return NULL; |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
253 #ifdef DEBUG |
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
254 g_print("cue_file = %s\n", cue_file); |
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
255 #endif |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
256 pr = input_check_file(cue_file, FALSE); |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
257 if (pr == NULL) |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
258 return NULL; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
259 dec = pr->ip; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 if (dec == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
262 |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
263 if (dec->get_song_tuple) |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
264 phys_tuple = dec->get_song_tuple(cue_file); |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
265 else |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
266 phys_tuple = input_get_song_tuple(cue_file); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
267 |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
268 if(!phys_tuple) |
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
269 return NULL; |
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
270 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
271 out = aud_tuple_new(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
273 _aud_tuple_copy_field(phys_tuple, out, FIELD_FILE_PATH, NULL); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
274 _aud_tuple_copy_field(phys_tuple, out, FIELD_FILE_NAME, NULL); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
275 _aud_tuple_copy_field(phys_tuple, out, FIELD_FILE_EXT, NULL); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
276 _aud_tuple_copy_field(phys_tuple, out, FIELD_CODEC, NULL); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
277 _aud_tuple_copy_field(phys_tuple, out, FIELD_QUALITY, NULL); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
278 _aud_tuple_copy_field(phys_tuple, out, FIELD_COPYRIGHT, NULL); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
279 _aud_tuple_copy_field(phys_tuple, out, FIELD_COMMENT, NULL); |
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
|
280 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
281 aud_tuple_associate_int(out, FIELD_LENGTH, NULL, aud_tuple_get_int(phys_tuple, FIELD_LENGTH, NULL)); |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
282 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
283 aud_tuple_free(phys_tuple); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
285 aud_tuple_associate_string(out, FIELD_TITLE, NULL, cue_tracks[track].title); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
286 aud_tuple_associate_string(out, FIELD_ARTIST, NULL, cue_tracks[track].performer ? |
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
|
287 cue_tracks[track].performer : cue_performer); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
288 aud_tuple_associate_string(out, FIELD_ALBUM, NULL, cue_title); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
289 aud_tuple_associate_string(out, FIELD_GENRE, NULL, cue_genre); |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
290 if(cue_year) |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
291 aud_tuple_associate_int(out, FIELD_YEAR, NULL, atoi(cue_year)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
292 aud_tuple_associate_int(out, FIELD_TRACK_NUMBER, NULL, track + 1); |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
293 |
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
294 return out; |
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 |
559 | 297 static void seek(InputPlayback * data, gint time) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 { |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
299 g_mutex_lock(cue_target_time_mutex); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
300 target_time = time * 1000; |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
301 g_mutex_unlock(cue_target_time_mutex); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
302 |
848 | 303 #ifdef DEBUG |
304 g_print("seek: playback = %p\n", data); | |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
305 g_print("cue: seek: target_time = %d\n", target_time); |
848 | 306 #endif |
307 | |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
308 if (real_ip != NULL) { |
559 | 309 real_ip->plugin->seek(real_ip, time); |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
310 } |
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 |
559 | 313 static void stop(InputPlayback * data) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 { |
848 | 315 #ifdef DEBUG |
316 g_print("f: stop: playback = %p\n", data); | |
317 #endif | |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
318 |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
319 if(play_thread) { |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
320 if(real_play_thread) { |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
321 g_cond_signal(cue_block_cond); /* kick play_cue_uri */ |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
322 |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
323 if (real_ip != NULL) |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
324 real_ip->plugin->stop(real_ip); |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
325 #ifdef DEBUG |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
326 g_print("i: stop(real_ip) finished\n"); |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
327 #endif |
1364
8916502b398c
make sure thread pointer to be NULL if corresponding thread doesn't exist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1363
diff
changeset
|
328 real_play_thread = NULL; |
8916502b398c
make sure thread pointer to be NULL if corresponding thread doesn't exist.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1363
diff
changeset
|
329 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
330 if (data != NULL) |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
331 data->playing = 0; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
332 if (caller_ip != NULL) |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
333 caller_ip->playing = 0; |
804 | 334 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
335 g_mutex_lock(cue_mutex); |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
336 watchdog_state = STOP; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
337 g_mutex_unlock(cue_mutex); |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
338 g_cond_signal(cue_cond); |
809 | 339 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
340 free_cue_info(); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
342 if (real_ip != NULL) { |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
343 real_ip->plugin->set_info = cue_ip.set_info; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
344 real_ip->plugin->output = NULL; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
345 g_free(real_ip); |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
346 real_ip = NULL; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
347 } |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
348 } /* real_play_thread */ |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
349 |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
350 g_thread_join(play_thread); |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
351 play_thread = NULL; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
352 |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
353 } /*play_thread*/ |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
354 |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
355 |
848 | 356 #ifdef DEBUG |
357 g_print("e: stop\n"); | |
358 #endif | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
359 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
361 /* not publicly available functions. */ |
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
|
362 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
|
363 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
|
364 |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
365 static gboolean do_stop(gpointer data) |
848 | 366 { |
367 #ifdef DEBUG | |
368 g_print("f: do_stop\n"); | |
369 #endif | |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
370 |
848 | 371 ip_data.stop = TRUE; |
372 playback_stop(); | |
373 ip_data.stop = FALSE; | |
374 | |
375 mainwin_clear_song_info(); | |
376 | |
377 #ifdef DEBUG | |
378 g_print("e: do_stop\n"); | |
379 #endif | |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
380 return FALSE; //one-shot |
848 | 381 } |
382 | |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
383 static gboolean do_setpos(gpointer data) |
848 | 384 { |
385 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
|
386 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
|
387 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
|
388 |
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
|
389 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
|
390 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
|
391 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
|
392 |
848 | 393 #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
|
394 g_print("do_setpos: pos = %d\n\n", pos); |
848 | 395 #endif |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
396 |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
397 if (!playlist) |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
398 return FALSE; |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
399 |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
400 /* 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
|
401 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
|
402 |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
403 return FALSE; //one-shot |
848 | 404 } |
405 | |
559 | 406 static void cue_pause(InputPlayback * data, short p) |
251 | 407 { |
408 if (real_ip != NULL) | |
559 | 409 real_ip->plugin->pause(real_ip, p); |
251 | 410 } |
411 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
412 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
|
413 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 gchar *title; |
363
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
415 Playlist *playlist = playlist_get_active(); |
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
416 |
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
417 g_return_if_fail(playlist != NULL); |
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 /* annoying. */ |
363
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
420 if (playlist->position->tuple == NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 { |
363
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
422 gint pos = playlist_get_position(playlist); |
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
423 playlist_get_tuple(playlist, pos); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 |
363
958855dae693
[svn] - fix other plugins dependant on the playlist framework
nenolod
parents:
357
diff
changeset
|
426 title = g_strdup(playlist->position->title); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
428 cue_ip.set_info(title, length, rate, freq, nch); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
429 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
430 |
559 | 431 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
|
432 { |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
433 gchar *path2 = g_strdup(uri + 6); // "cue://" is stripped. |
809 | 434 gchar *_path = strchr(path2, '?'); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
435 gint track = 0; |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
436 ProbeResult *pr; |
559 | 437 InputPlugin *real_ip_plugin; |
1737
b729c7a72c20
- remove get_song_info interface.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1692
diff
changeset
|
438 Tuple *tuple = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
439 |
809 | 440 #ifdef DEBUG |
441 g_print("f: play_cue_uri\n"); | |
848 | 442 g_print("play_cue_uri: playback = %p\n", data); |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
443 g_print("play_cue_uri: path2 = %s\n", path2); |
809 | 444 #endif |
848 | 445 |
809 | 446 /* stop watchdog thread */ |
447 g_mutex_lock(cue_mutex); | |
448 watchdog_state = STOP; | |
848 | 449 g_mutex_unlock(cue_mutex); |
809 | 450 g_cond_signal(cue_cond); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 |
809 | 452 if (_path != NULL && *_path == '?') |
453 { | |
454 *_path = '\0'; | |
455 _path++; | |
456 track = atoi(_path); | |
457 } | |
458 cur_cue_track = track; | |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
459 cache_cue_file(path2); //path2 should be uri. |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
460 |
1978 | 461 if (cue_file == NULL || !aud_vfs_file_test(cue_file, G_FILE_TEST_EXISTS)) |
809 | 462 return; |
241
a1e15310703e
[svn] Crash avoidance for zeroed cue sheets. By TiCPU, submitted in #audacious.
chainsaw
parents:
239
diff
changeset
|
463 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
464 pr = input_check_file(cue_file, FALSE); |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
465 if (pr == NULL) |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
466 return; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
467 |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
468 real_ip_plugin = pr->ip; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 |
559 | 470 if (real_ip_plugin != NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 { |
809 | 472 if (real_ip) |
473 g_free(real_ip); | |
474 real_ip = g_new0(InputPlayback, 1); | |
559 | 475 real_ip->plugin = real_ip_plugin; |
476 real_ip->plugin->set_info = set_info_override; | |
477 real_ip->plugin->output = cue_ip.output; | |
478 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
|
479 |
20b8e735f69e
[svn] - adaptation for playback API. make cuesheet plugin pass playback->output to real_ip.
yaz
parents:
559
diff
changeset
|
480 /* 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
|
481 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
|
482 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
|
483 |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
484 /* we have to copy set_pb_ready things too. */ |
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
485 real_ip->pb_ready_mutex = data->pb_ready_mutex; |
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
486 real_ip->pb_ready_cond = data->pb_ready_cond; |
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
487 real_ip->pb_ready_val = data->pb_ready_val; |
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
488 real_ip->set_pb_ready = data->set_pb_ready; |
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
489 |
1984
489e32a8e106
change some places to use set_params() instead of set_info() directly
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
490 real_ip->pb_change_mutex = data->pb_change_mutex; |
489e32a8e106
change some places to use set_params() instead of set_info() directly
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
491 real_ip->pb_change_cond = data->pb_change_cond; |
489e32a8e106
change some places to use set_params() instead of set_info() directly
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
492 real_ip->set_pb_change = data->set_pb_change; |
489e32a8e106
change some places to use set_params() instead of set_info() directly
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
493 |
489e32a8e106
change some places to use set_params() instead of set_info() directly
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
494 real_ip->set_params = data->set_params; |
489e32a8e106
change some places to use set_params() instead of set_info() directly
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
495 real_ip->set_title = data->set_title; |
489e32a8e106
change some places to use set_params() instead of set_info() directly
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
496 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
497 real_play_thread = g_thread_create((GThreadFunc)(real_ip->plugin->play_file), (gpointer)real_ip, TRUE, NULL); |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
498 g_usleep(50000); // wait for 50msec while real input plugin is initializing. |
809 | 499 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
500 if(real_ip->plugin->mseek) { |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
501 #ifdef DEBUG |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
502 g_print("mseek\n"); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
503 #endif |
809 | 504 real_ip->plugin->mseek(real_ip, finetune_seek ? finetune_seek : cue_tracks[track].index); |
505 } | |
506 else | |
507 real_ip->plugin->seek(real_ip, finetune_seek ? finetune_seek / 1000 : cue_tracks[track].index / 1000 + 1); | |
508 | |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
509 g_mutex_lock(cue_target_time_mutex); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
510 target_time = finetune_seek ? finetune_seek : cue_tracks[track].index; |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
511 g_mutex_unlock(cue_target_time_mutex); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
512 #ifdef DEBUG |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
513 g_print("cue: play_cue_uri: target_time = %d\n", target_time); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
514 #endif |
1737
b729c7a72c20
- remove get_song_info interface.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1692
diff
changeset
|
515 |
b729c7a72c20
- remove get_song_info interface.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1692
diff
changeset
|
516 tuple = real_ip->plugin->get_song_tuple(cue_file); |
b729c7a72c20
- remove get_song_info interface.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1692
diff
changeset
|
517 if(tuple) { |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
518 cue_tracks[last_cue_track].index = aud_tuple_get_int(tuple, FIELD_LENGTH, NULL); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
519 aud_tuple_free(tuple); tuple = NULL; |
1737
b729c7a72c20
- remove get_song_info interface.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1692
diff
changeset
|
520 } |
860 | 521 |
809 | 522 /* kick watchdog thread */ |
523 g_mutex_lock(cue_mutex); | |
524 watchdog_state = RUN; | |
848 | 525 g_mutex_unlock(cue_mutex); |
809 | 526 g_cond_signal(cue_cond); |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
527 #ifdef DEBUG |
848 | 528 g_print("watchdog activated\n"); |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
529 #endif |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
530 finetune_seek = 0; |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
531 if(real_play_thread) { |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
532 g_mutex_lock(cue_block_mutex); |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
533 g_cond_wait(cue_block_cond, cue_block_mutex); // block until stop() is called. |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
534 g_mutex_unlock(cue_block_mutex); |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
535 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
536 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
537 |
809 | 538 #ifdef DEBUG |
539 g_print("e: play_cue_uri\n"); | |
540 #endif | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
541 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
542 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
543 /******************************************************* watchdog */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
544 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
545 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
546 * This is fairly hard to explain. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
547 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
548 * 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
|
549 * 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
|
550 * right place. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
551 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
552 * 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
|
553 * as well as I was hoping. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
554 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
555 * 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
|
556 * cool with it. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
557 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
558 * - nenolod |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
559 */ |
809 | 560 static gpointer watchdog_func(gpointer data) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
561 { |
809 | 562 gint time = 0; |
563 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
|
564 GTimeVal sleep_time; |
809 | 565 |
566 #ifdef DEBUG | |
567 g_print("f: watchdog\n"); | |
568 #endif | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
569 |
809 | 570 while(1) { |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
571 #if 0 |
809 | 572 #if DEBUG |
848 | 573 g_print("time = %d cur = %d cidx = %d nidx = %d last = %d\n", |
574 time, cur_cue_track, | |
809 | 575 cue_tracks[cur_cue_track].index, |
848 | 576 cue_tracks[cur_cue_track+1].index, last_cue_track); |
809 | 577 #endif |
578 #endif | |
579 g_get_current_time(&sleep_time); | |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
580 g_time_val_add(&sleep_time, 10000); // interval is 10msec. |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
581 |
809 | 582 g_mutex_lock(cue_mutex); |
583 switch(watchdog_state) { | |
584 case EXIT: | |
585 #ifdef DEBUG | |
586 g_print("e: watchdog exit\n"); | |
587 #endif | |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
588 g_mutex_unlock(cue_mutex); // stop() will lock cue_mutex. |
809 | 589 stop(real_ip); // need not to care about real_ip != NULL here. |
590 g_thread_exit(NULL); | |
591 break; | |
592 case RUN: | |
593 if(!playlist) | |
594 playlist = playlist_get_active(); | |
595 g_cond_timed_wait(cue_cond, cue_mutex, &sleep_time); | |
596 break; | |
597 case STOP: | |
598 #ifdef DEBUG | |
599 g_print("watchdog deactivated\n"); | |
600 #endif | |
601 g_cond_wait(cue_cond, cue_mutex); | |
602 playlist = playlist_get_active(); | |
603 break; | |
604 } | |
605 g_mutex_unlock(cue_mutex); | |
606 | |
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
|
607 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
|
608 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
|
609 |
809 | 610 time = get_output_time(); |
1365
8702f72b3382
- reduce guard time in initiating play to avoid stuttering start.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1364
diff
changeset
|
611 #if 0 |
8702f72b3382
- reduce guard time in initiating play to avoid stuttering start.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1364
diff
changeset
|
612 #ifdef DEBUG |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
613 g_print("time = %d target_time = %d\n", time, target_time); |
1365
8702f72b3382
- reduce guard time in initiating play to avoid stuttering start.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1364
diff
changeset
|
614 #endif |
8702f72b3382
- reduce guard time in initiating play to avoid stuttering start.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1364
diff
changeset
|
615 #endif |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
616 if(time == 0 || time <= target_time) |
848 | 617 continue; |
809 | 618 |
619 // prev track | |
620 if (time < cue_tracks[cur_cue_track].index) | |
621 { | |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
622 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
|
623 gint oldpos = cur_cue_track; |
809 | 624 #ifdef DEBUG |
625 g_print("i: watchdog prev\n"); | |
626 g_print("time = %d cur = %d cidx = %d nidx = %d\n", time, cur_cue_track, | |
627 cue_tracks[cur_cue_track].index, | |
628 cue_tracks[cur_cue_track+1].index); | |
629 #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
|
630 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
|
631 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
|
632 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
|
633 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
|
634 finetune_seek = time; |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
635 #ifdef DEBUG |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
636 g_print("cue: prev_track: time = %d cue_tracks[cur_cue_track].index = %d\n", |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
637 time, cue_tracks[cur_cue_track].index); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
638 g_print("cue: prev_track: finetune_seek = %d\n", finetune_seek); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
639 #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
|
640 } |
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
|
641 |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
642 g_mutex_lock(cue_target_time_mutex); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
643 target_time = finetune_seek ? finetune_seek : cue_tracks[cur_cue_track].index; |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
644 g_mutex_unlock(cue_target_time_mutex); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
645 #ifdef DEBUG |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
646 g_print("cue: prev_track: target_time = %d\n", target_time); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
647 #endif |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
648 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
|
649 continue; |
809 | 650 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
651 |
809 | 652 // next track |
861 | 653 if (cur_cue_track + 1 < last_cue_track && time > cue_tracks[cur_cue_track + 1].index) |
809 | 654 { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
655 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
|
656 gint oldpos = cur_cue_track; |
809 | 657 #ifdef DEBUG |
658 g_print("i: watchdog next\n"); | |
860 | 659 g_print("time = %d cur = %d cidx = %d nidx = %d last = %d lidx = %d\n", time, cur_cue_track, |
809 | 660 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
|
661 cue_tracks[cur_cue_track+1].index, |
860 | 662 last_cue_track, cue_tracks[last_cue_track].index); |
809 | 663 #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
|
664 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
|
665 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
|
666 incr = cur_cue_track - oldpos; // relative position |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
667 if (time >= 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
|
668 finetune_seek = time; |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
669 #ifdef DEBUG |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
670 g_print("cue: next_track: time = %d cue_tracks[cur_cue_track].index = %d\n", |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
671 time, cue_tracks[cur_cue_track].index); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
672 g_print("cue: next_track: finetune_seek = %d\n", finetune_seek); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
673 #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
|
674 } |
809 | 675 |
1376
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
676 g_mutex_lock(cue_target_time_mutex); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
677 target_time = finetune_seek ? finetune_seek : cue_tracks[cur_cue_track].index; |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
678 g_mutex_unlock(cue_target_time_mutex); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
679 #ifdef DEBUG |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
680 g_print("cue: next_track: target_time = %d\n", target_time); |
3a2a91d80818
- introduce target_time and simplify the flow of the watchdog thread. TRANSITION_GUARD_TIME is no longer needed.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1365
diff
changeset
|
681 #endif |
848 | 682 if(cfg.stopaftersong) { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
683 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
|
684 continue; |
848 | 685 } |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
686 else { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
687 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
|
688 continue; |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
689 } |
809 | 690 } |
848 | 691 |
861 | 692 // last track |
848 | 693 if (cur_cue_track + 1 == last_cue_track && |
861 | 694 (cue_tracks[last_cue_track].index - time < 500 || |
695 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
|
696 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
|
697 gint pos = playlist_get_position(playlist); |
932 | 698 if (pos + 1 == playlist_get_length(playlist)) { |
848 | 699 #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
|
700 g_print("i: watchdog eof reached\n\n"); |
848 | 701 #endif |
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
|
702 if(cfg.repeat) { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
703 static gint incr = 0; |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
704 incr = -pos; |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
705 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
|
706 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
|
707 } |
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
|
708 else { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
709 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
|
710 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
|
711 } |
860 | 712 } |
713 else { | |
987
8f432e790cfb
[svn] - add check for cfg.stopaftersong at the end of cue.
yaz
parents:
932
diff
changeset
|
714 if(cfg.stopaftersong) { |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
715 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
|
716 continue; |
987
8f432e790cfb
[svn] - add check for cfg.stopaftersong at the end of cue.
yaz
parents:
932
diff
changeset
|
717 } |
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
|
718 #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
|
719 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
|
720 #endif |
1274
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
721 static gint incr = 1; |
bcf6dc9564f4
- eliminate gdk_threads_*() based on giacomo's suggestion.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1267
diff
changeset
|
722 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
|
723 continue; |
860 | 724 } |
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
|
725 } |
848 | 726 } |
809 | 727 } |
728 #ifdef DEBUG | |
860 | 729 g_print("e: watchdog\n"); |
809 | 730 #endif |
731 return NULL; // dummy. | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
732 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
733 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
734 /******************************************************** cuefile */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
735 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
736 static void free_cue_info(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
737 { |
356 | 738 g_free(cue_file); cue_file = NULL; |
739 g_free(cue_title); cue_title = NULL; | |
740 g_free(cue_performer); cue_performer = NULL; | |
741 g_free(cue_genre); cue_genre = NULL; | |
742 g_free(cue_year); cue_year = NULL; | |
743 g_free(cue_track); cue_track = NULL; | |
744 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
745 for (; last_cue_track > 0; last_cue_track--) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
746 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
|
747 cue_tracks[last_cue_track-1].performer = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
748 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
|
749 cue_tracks[last_cue_track-1].title = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
750 } |
809 | 751 #ifdef DEBUG |
860 | 752 g_print("free_cue_info: last_cue_track = %d\n", last_cue_track); |
809 | 753 #endif |
754 last_cue_track = 0; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
755 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
756 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
757 static void cache_cue_file(char *f) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
758 { |
1978 | 759 VFSFile *file = aud_vfs_fopen(f, "rb"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
760 gchar line[MAX_CUE_LINE_LENGTH+1]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
761 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
762 if(!file) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
763 return; |
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 while (TRUE) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
766 gint p; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
767 gint q; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
768 |
1978 | 769 if (aud_vfs_fgets(line, MAX_CUE_LINE_LENGTH+1, file) == NULL) { |
770 aud_vfs_fclose(file); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
771 return; |
860 | 772 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
773 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
774 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
|
775 if (!line[p]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
776 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
777 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
|
778 if (!line[q]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
779 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
780 line[q] = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
781 for (q++; line[q] && isspace((int) line[q]); q++); |
356 | 782 if (strcasecmp(line+p, "REM") == 0) { |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
783 for (p = q; line[p] && !isspace((int) line[p]); p++); |
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
784 if (!line[p]) |
356 | 785 continue; |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
786 line[p] = '\0'; |
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
787 for (p++; line[p] && isspace((int) line[p]); p++); |
356 | 788 if(strcasecmp(line+q, "GENRE") == 0) { |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
789 fix_cue_argument(line+p); |
356 | 790 if (last_cue_track == 0) |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
791 cue_genre = str_to_utf8(line + p); |
356 | 792 } |
793 if(strcasecmp(line+q, "DATE") == 0) { | |
794 gchar *tmp; | |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
795 fix_cue_argument(line+p); |
356 | 796 if (last_cue_track == 0) { |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
797 tmp = g_strdup(line + p); |
356 | 798 if (tmp) { |
799 cue_year = strtok(tmp, "/"); // XXX: always in the same format? | |
800 } | |
801 } | |
802 } | |
803 } | |
804 else if (strcasecmp(line+p, "PERFORMER") == 0) { | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
805 fix_cue_argument(line+q); |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
806 |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
807 if (last_cue_track == 0) |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
808 cue_performer = str_to_utf8(line + q); |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
809 else |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
810 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
|
811 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
812 else if (strcasecmp(line+p, "FILE") == 0) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
813 gchar *tmp = g_path_get_dirname(f); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
814 fix_cue_argument(line+q); |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
815 cue_file = g_strdup_printf("%s/%s", tmp, line+q); //XXX need to check encoding? |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
816 g_free(tmp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
817 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
818 else if (strcasecmp(line+p, "TITLE") == 0) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
819 fix_cue_argument(line+q); |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
820 if (last_cue_track == 0) |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
821 cue_title = str_to_utf8(line + q); |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
822 else |
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
823 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
|
824 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
825 else if (strcasecmp(line+p, "TRACK") == 0) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
826 gint track; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
827 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
828 fix_cue_argument(line+q); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
829 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
|
830 line[p] = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
831 for (; line[q] && line[q] == '0'; q++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
832 if (!line[q]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
833 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
834 track = atoi(line+q); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
835 if (track >= MAX_CUE_TRACKS) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
836 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
837 last_cue_track = track; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
838 cue_tracks[last_cue_track-1].index = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
839 cue_tracks[last_cue_track-1].performer = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
840 cue_tracks[last_cue_track-1].title = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
841 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
842 else if (strcasecmp(line+p, "INDEX") == 0) { |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
843 gint min, sec, frac; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
844 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
|
845 if (!line[p]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
846 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
847 for (p++; line[p] && isspace((int) line[p]); p++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
848 for (q = p; line[q] && !isspace((int) line[q]); q++); |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
849 |
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
850 if(sscanf(line+p, "%d:%d:%d", &min, &sec, &frac) == 3) { |
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
851 // printf("%3d:%02d:%02d\n", min, sec, frac); |
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
852 cue_tracks[last_cue_track-1].index = min * 60000 + sec * 1000 + frac * 10; |
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
853 } |
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
854 } |
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
855 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
856 |
1978 | 857 aud_vfs_fclose(file); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
858 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
859 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
860 static void fix_cue_argument(char *line) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
861 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
862 if (line[0] == '"') { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
863 gchar *l2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
864 for (l2 = line+1; *l2 && *l2 != '"'; l2++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
865 *(l2-1) = *l2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
866 *(l2-1) = *l2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
867 for (; *line && *line != '"'; line++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
868 if (*line == '\\' && *(line+1)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
869 for (l2 = line+1; *l2 && *l2 != '"'; l2++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
870 *(l2-1) = *l2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
871 *(l2-1) = *l2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
872 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
873 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
874 *line = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
875 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
876 else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
877 for (; *line && *line != '\r' && *line != '\n'; line++); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
878 *line = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
879 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
880 } |