Mercurial > audlegacy-plugins
annotate src/cue/cuesheet.c @ 3138:8e26022bb814
aac: handle premature EOF on shoutcast streams more gracefully.
in combination with the neon work, we no longer have a problem. (closes #57)
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Thu, 07 May 2009 11:14:36 -0500 |
parents | 75cd491339c9 |
children |
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>. |
2147 | 5 * Jonathan Schleifer <js-audacious@webkeks.org> (few 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 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
18 #include "cuesheet.h" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 |
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
|
20 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
|
21 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
|
22 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
|
23 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
24 GMutex *cue_mutex; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
25 GCond *cue_cond; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
27 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
|
28 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
|
29 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
30 InputPlayback *caller_ip = NULL; |
848 | 31 |
356 | 32 static gchar *cue_file = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 static gchar *cue_title = NULL; |
356 | 34 static gchar *cue_performer = NULL; |
35 static gchar *cue_genre = NULL; | |
36 static gchar *cue_year = NULL; | |
37 static gchar *cue_track = NULL; | |
38 | |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
39 gint last_cue_track = 0; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
40 gint cur_cue_track = 0; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
41 gulong target_time = 0; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
42 GMutex *cue_target_time_mutex; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
43 static gint full_length = 0; |
356 | 44 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
45 cue_tracks_t cue_tracks[MAX_CUE_TRACKS]; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
46 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
47 watchdog_state_t watchdog_state; |
356 | 48 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
49 gint finetune_seek = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
51 InputPlayback *real_ip = NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
52 static gchar *cue_fmts[] = {"cue", NULL}; |
2505
590c9610f968
Fixed cue-sheet plugin to have the vfs extensions support.
Matti Hamalainen <ccr@tnsp.org>
parents:
2496
diff
changeset
|
53 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 InputPlugin cue_ip = |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 { |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
56 .description = "Cuesheet2 Plugin", /* description */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
57 .init = cue_init, /* init */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
58 .play_file = play, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
59 .stop = stop, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
60 .pause = cue_pause, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
61 .seek = seek, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
62 .mseek = mseek, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
63 .get_time = get_time, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
64 .cleanup = cue_cleanup, /* cleanup */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
65 .get_song_tuple = get_song_tuple, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
66 .vfs_extensions = cue_fmts, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
67 .is_our_file = is_our_file, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
68 .probe_for_tuple = probe_for_tuple, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
69 .have_subtune = TRUE |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 |
1088 | 72 InputPlugin *cue_iplist[] = { &cue_ip, NULL }; |
73 | |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1376
diff
changeset
|
74 DECLARE_PLUGIN(cue, NULL, NULL, cue_iplist, NULL, NULL, NULL, NULL, NULL); |
1088 | 75 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
76 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
77 cue_init(void) |
809 | 78 { |
79 cue_mutex = g_mutex_new(); | |
80 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
|
81 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
|
82 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
|
83 cue_target_time_mutex = g_mutex_new(); |
809 | 84 |
85 /* create watchdog thread */ | |
86 g_mutex_lock(cue_mutex); | |
87 watchdog_state = STOP; | |
88 g_mutex_unlock(cue_mutex); | |
89 watchdog_thread = g_thread_create(watchdog_func, NULL, TRUE, NULL); | |
2396
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
90 AUDDBG("watchdog_thread = %p\n", watchdog_thread); |
809 | 91 } |
92 | |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
93 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
94 cue_cleanup(void) |
809 | 95 { |
96 g_mutex_lock(cue_mutex); | |
97 watchdog_state = EXIT; | |
98 g_mutex_unlock(cue_mutex); | |
848 | 99 g_cond_broadcast(cue_cond); |
809 | 100 |
101 g_thread_join(watchdog_thread); | |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
102 |
809 | 103 g_cond_free(cue_cond); |
104 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
|
105 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
|
106 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
|
107 g_mutex_free(cue_target_time_mutex); |
809 | 108 } |
109 | |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
110 Tuple * |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
111 probe_for_tuple(gchar *uri, VFSFile *fd) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
112 { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
113 Tuple *tuple = NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
114 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
115 AUDDBG("uri=%s\n",uri); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
116 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
117 if(!is_our_file(uri)) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
118 return NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
119 |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
120 /* invalidate cache */ |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
121 free_cue_info(); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
122 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
123 /* cache cue info */ |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
124 cache_cue_file(uri); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
125 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
126 /* Get subtune information */ |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
127 tuple = get_song_tuple(uri); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
128 return tuple; |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
129 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
130 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
131 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
132 int |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
133 is_our_file(gchar *filename) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
134 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
135 gchar *ext; |
86
60cf31332daa
[svn] - some improvements to the cuesheet plugin, not totally there yet ;)
nenolod
parents:
81
diff
changeset
|
136 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
137 ext = strrchr(filename, '.'); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
138 if(!ext) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
139 return FALSE; |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
140 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
141 if (!strncasecmp(ext, ".cue", 4)) |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
142 return TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
143 |
81
254cc9620517
[svn] - fix issue where cuesheet plugin owns all codecs
nenolod
parents:
76
diff
changeset
|
144 return FALSE; |
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 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
147 gint |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
148 get_time(InputPlayback *playback) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
149 { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
150 gint raw_time = playback->output->output_time(); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
151 gint cooked_time; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
152 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
153 /* translate actual time into subtune time */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
154 cooked_time = raw_time - cue_tracks[cur_cue_track].index; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
155 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
156 /* return raw_time; */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
157 return cooked_time; /* visualization will be missing. --yaz */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
158 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
159 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
160 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
161 play(InputPlayback *data) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
162 { |
1557
c8c725957643
make cuesheet plugin work again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1510
diff
changeset
|
163 gchar *uri = g_strdup(data->filename); |
848 | 164 |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
165 AUDDBG("playback = %p uri = %s\n", data, uri); |
848 | 166 |
167 caller_ip = data; | |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
168 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
169 play_thread = g_thread_self(); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
170 data->set_pb_ready(data); /* it should be done in real |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
171 input plugin? --yaz */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
172 play_cue_uri(data, uri); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
173 g_free(uri); uri = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
176 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
177 _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
|
178 { |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
179 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
|
180 aud_tuple_disassociate(tuple2, nfield, field); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
181 aud_tuple_associate_string(tuple2, nfield, field, str); |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
182 } |
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
183 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
184 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
185 /* this function will be called back for subtune-info in adding to |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
186 * playlist. */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
187 Tuple * |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
188 get_song_tuple(gchar *uri) /* *.cue or *.cue?1- */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
189 { |
3046
75cd491339c9
ported icecast plugin,
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2952
diff
changeset
|
190 Tuple *phys_tuple = NULL, *out; |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
191 ProbeResult *pr = NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
192 InputPlugin *dec = 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
|
193 gint track = 0; |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
194 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
195 /* check subtune */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
196 gchar *path2 = g_strdup(uri); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
197 gchar *_path = strchr(path2, '?'); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
199 /* subtune specifed */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
200 if (_path != NULL && *_path == '?') { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
201 *_path = '\0'; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
202 _path++; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
203 track = atoi(_path) - 1; /* subtune number */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
204 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
205 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
206 /* parse file of uri and find actual file to play */ |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
207 if(!cue_file) |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
208 cache_cue_file(path2); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
209 g_free(path2); |
2396
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
210 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
211 /* obtain probe result for actual file */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
212 pr = aud_input_check_file(cue_file, FALSE); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
213 if (pr == NULL) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
214 return NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
215 dec = pr->ip; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
216 if (dec == NULL) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
217 return NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
219 /* get tuple for actual file */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
220 if (dec->get_song_tuple) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
221 phys_tuple = dec->get_song_tuple(cue_file); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
223 if(!phys_tuple) |
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
224 return NULL; |
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
225 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
226 /* build tuple to be returned */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
227 gchar *realfn = g_filename_from_uri(cue_file, NULL, NULL); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
228 if(!realfn) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
229 return NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
231 gchar *ext = strrchr(realfn, '.'); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
232 ext++; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
233 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
234 /* copy physical tuple */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
235 out = aud_tuple_new(); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
236 _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
|
237 _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
|
238 _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
|
239 _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
|
240 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
241 full_length = 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
|
242 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
243 aud_tuple_free(phys_tuple); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
245 /* make path related parts */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
246 aud_tuple_associate_string(out, FIELD_FILE_PATH, NULL, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
247 g_path_get_dirname(realfn)); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
248 aud_tuple_associate_string(out, FIELD_FILE_NAME, NULL, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
249 g_path_get_basename(realfn)); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
250 aud_tuple_associate_string(out, FIELD_FILE_EXT, NULL, ext); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
251 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
252 /* set subtune information */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
253 out->nsubtunes = last_cue_track; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
254 out->subtunes = NULL; /* ok? */ |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
255 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
256 /* subtune specified */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
257 if(_path) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
258 aud_tuple_associate_string(out, FIELD_TITLE, NULL, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
259 cue_tracks[track].title); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
260 aud_tuple_associate_string(out, FIELD_ARTIST, NULL, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
261 cue_tracks[track].performer ? |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
262 cue_tracks[track].performer : cue_performer); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
263 aud_tuple_associate_string(out, FIELD_ALBUM, NULL, cue_title); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
264 aud_tuple_associate_string(out, FIELD_GENRE, NULL, cue_genre); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
265 if(cue_year) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
266 aud_tuple_associate_int(out, FIELD_YEAR, NULL, atoi(cue_year)); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
267 aud_tuple_associate_int(out, FIELD_TRACK_NUMBER, NULL, track+1); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
268 aud_tuple_associate_int(out, FIELD_LENGTH, NULL, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
269 cue_tracks[track].duration); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
270 } |
1422
35c8b1faf27b
update to new API
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
271 return out; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
274 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
275 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
276 mseek(InputPlayback *input, gulong time) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 { |
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
|
278 g_mutex_lock(cue_target_time_mutex); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
279 target_time = time + cue_tracks[cur_cue_track].index; |
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
|
280 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
|
281 |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
282 AUDDBG("cur_cue_track=%d target_time = %lu\n", cur_cue_track, target_time); |
848 | 283 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
284 if (real_ip != NULL) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
285 if(real_ip->plugin->mseek) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
286 real_ip->plugin->mseek(real_ip, target_time); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
287 else |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
288 real_ip->plugin->seek(real_ip, target_time/1000); |
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
|
289 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
292 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
293 seek(InputPlayback *input, gint time) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
294 { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
295 gulong millisecond = time * 1000; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
296 mseek(input, millisecond); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
297 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
298 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
299 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
300 stop(InputPlayback * data) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 { |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
302 AUDDBG("f: playback = %p\n", data); |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
303 |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
304 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
|
305 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
|
306 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
|
307 |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
308 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
|
309 real_ip->plugin->stop(real_ip); |
2396
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
310 |
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
311 AUDDBG("i: stop(real_ip) finished\n"); |
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
312 |
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
|
313 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
|
314 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
315 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
|
316 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
|
317 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
|
318 caller_ip->playing = 0; |
804 | 319 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
320 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
|
321 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
|
322 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
|
323 g_cond_signal(cue_cond); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
325 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
|
326 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
|
327 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
|
328 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
|
329 } |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
330 } /* 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
|
331 |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
332 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
|
333 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
|
334 |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
335 } /*play_thread*/ |
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
336 |
2396
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
337 AUDDBG("e: stop\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
340 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
341 cue_pause(InputPlayback * data, short p) |
848 | 342 { |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
343 if (real_ip != NULL) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
344 real_ip->plugin->pause(real_ip, p); |
848 | 345 } |
346 | |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
347 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
348 set_info_override(gchar * unused, gint length, gint rate, gint freq, gint nch) |
251 | 349 { |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
350 gchar *title; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
351 Playlist *playlist = aud_playlist_get_active(); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
352 gint cur_len; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
353 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
354 g_return_if_fail(playlist != NULL); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
355 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
356 /* annoying.. */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
357 if (playlist->position->tuple == NULL) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
358 { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
359 gint pos = aud_playlist_get_position(playlist); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
360 aud_playlist_get_tuple(playlist, pos); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
361 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
362 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
363 title = g_strdup(playlist->position->title); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
364 cur_len = cue_tracks[cur_cue_track].duration; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
365 cue_ip.set_info(title, cur_len, rate, freq, nch); |
251 | 366 } |
367 | |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
368 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
369 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
370 play_cue_uri(InputPlayback * data, gchar *uri) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
371 { |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
372 gchar *path2 = g_strdup(uri); /* file:// */ |
809 | 373 gchar *_path = strchr(path2, '?'); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
374 gint track = 0; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
375 ProbeResult *pr; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
376 InputPlugin *real_ip_plugin; |
1737
b729c7a72c20
- remove get_song_info interface.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1692
diff
changeset
|
377 Tuple *tuple = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
379 AUDDBG("playback = %p path2 = %s\n", data, path2); |
848 | 380 |
809 | 381 /* stop watchdog thread */ |
382 g_mutex_lock(cue_mutex); | |
383 watchdog_state = STOP; | |
848 | 384 g_mutex_unlock(cue_mutex); |
809 | 385 g_cond_signal(cue_cond); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
386 |
809 | 387 if (_path != NULL && *_path == '?') |
388 { | |
389 *_path = '\0'; | |
390 _path++; | |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
391 track = atoi(_path) - 1; |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
392 AUDDBG("track = %d\n", track); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
393 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
394 cur_cue_track = track; |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
395 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
396 if(!cue_file) |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
397 cache_cue_file(path2); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
398 g_free(path2); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 |
1978 | 400 if (cue_file == NULL || !aud_vfs_file_test(cue_file, G_FILE_TEST_EXISTS)) |
809 | 401 return; |
241
a1e15310703e
[svn] Crash avoidance for zeroed cue sheets. By TiCPU, submitted in #audacious.
chainsaw
parents:
239
diff
changeset
|
402 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
403 pr = aud_input_check_file(cue_file, FALSE); /* find actual input plugin */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
404 if (pr == NULL) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
405 return; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
406 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
407 real_ip_plugin = pr->ip; |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
408 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
409 if (real_ip_plugin != NULL) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
410 { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
411 if (real_ip) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
412 g_free(real_ip); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
413 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
414 /* duplicate original playback and modify */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
415 real_ip = (InputPlayback *)g_memdup(data, sizeof(InputPlayback)); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
416 real_ip->plugin = real_ip_plugin; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
417 real_ip->plugin->set_info = set_info_override; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
418 real_ip->filename = cue_file; |
1999
3afd18361a10
change the way of duplicating original playback.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1997
diff
changeset
|
419 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
420 data->playing = 1; |
602
20b8e735f69e
[svn] - adaptation for playback API. make cuesheet plugin pass playback->output to real_ip.
yaz
parents:
559
diff
changeset
|
421 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
422 real_play_thread = |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
423 g_thread_create((GThreadFunc)(real_ip->plugin->play_file), |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
424 (gpointer)real_ip, TRUE, NULL); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
425 g_usleep(50000); /* wait for 50msec while real input plugin |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
426 is initializing. */ |
2162 | 427 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
428 if(real_ip->plugin->mseek) { |
2396
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
429 AUDDBG("mseek\n"); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
430 real_ip->plugin->mseek(real_ip, finetune_seek ? |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
431 finetune_seek : cue_tracks[track].index); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
432 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
433 else |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
434 real_ip->plugin->seek(real_ip, finetune_seek ? |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
435 finetune_seek / 1000 : |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
436 cue_tracks[track].index / 1000 + 1); |
809 | 437 |
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
|
438 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
|
439 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
|
440 g_mutex_unlock(cue_target_time_mutex); |
2396
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
441 |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
442 AUDDBG("target_time = %lu\n", target_time); |
1737
b729c7a72c20
- remove get_song_info interface.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1692
diff
changeset
|
443 |
b729c7a72c20
- remove get_song_info interface.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1692
diff
changeset
|
444 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
|
445 if(tuple) { |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
446 cue_tracks[last_cue_track].index = |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
447 aud_tuple_get_int(tuple, FIELD_LENGTH, NULL); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1961
diff
changeset
|
448 aud_tuple_free(tuple); tuple = NULL; |
1737
b729c7a72c20
- remove get_song_info interface.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1692
diff
changeset
|
449 } |
860 | 450 |
809 | 451 /* kick watchdog thread */ |
452 g_mutex_lock(cue_mutex); | |
453 watchdog_state = RUN; | |
848 | 454 g_mutex_unlock(cue_mutex); |
809 | 455 g_cond_signal(cue_cond); |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
456 AUDDBG("watchdog activated\n"); |
2396
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
457 |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
458 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
|
459 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
|
460 g_mutex_lock(cue_block_mutex); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
461 /* block until stop() is called. */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
462 g_cond_wait(cue_block_cond, cue_block_mutex); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
463 g_mutex_unlock(cue_block_mutex); |
1363
da987606127e
first attempt to adapt cuesheet to the new threading model.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1274
diff
changeset
|
464 } |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
465 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 |
2396
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
467 AUDDBG("e: play_cue_uri\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
468 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
470 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
471 /******************************************************** cuefile */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
473 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
474 free_cue_info(void) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 { |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
476 g_free(cue_file); cue_file = NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
477 g_free(cue_title); cue_title = NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
478 g_free(cue_performer); cue_performer = NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
479 g_free(cue_genre); cue_genre = NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
480 g_free(cue_year); cue_year = NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
481 g_free(cue_track); cue_track = NULL; |
308
1bf162c7b4b9
[svn] - cuesheet plugin improvements via hiro @ audacious boards
nenolod
parents:
251
diff
changeset
|
482 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
483 for (; last_cue_track > 0; last_cue_track--) { |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
484 g_free(cue_tracks[last_cue_track-1].title); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
485 cue_tracks[last_cue_track-1].title = NULL; |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
486 g_free(cue_tracks[last_cue_track-1].performer); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
487 cue_tracks[last_cue_track-1].performer = NULL; |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
488 cue_tracks[last_cue_track-1].index = 0; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
489 cue_tracks[last_cue_track-1].index00 = 0; |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
490 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
491 AUDDBG("free_cue_info: last_cue_track = %d\n", last_cue_track); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
492 last_cue_track = 0; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
493 } |
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
|
494 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
495 void |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
496 get_full_length(gchar *cue_file) |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
497 { |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
498 Tuple *phys_tuple = NULL; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
499 ProbeResult *pr = NULL; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
500 InputPlugin *dec = NULL; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
501 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
502 /* obtain probe result for actual file */ |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
503 pr = aud_input_check_file(cue_file, FALSE); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
504 if (pr == NULL) |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
505 return; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
506 dec = pr->ip; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
507 if (dec == NULL) |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
508 return; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
509 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
510 /* get tuple for actual file */ |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
511 if (dec->get_song_tuple) |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
512 phys_tuple = dec->get_song_tuple(cue_file); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
513 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
514 full_length = aud_tuple_get_int(phys_tuple, FIELD_LENGTH, NULL); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
515 aud_tuple_free(phys_tuple); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
516 } |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
517 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
518 void |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
519 cache_cue_file(char *f) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
520 { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
521 VFSFile *file = aud_vfs_fopen(f, "rb"); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
522 gchar line[MAX_CUE_LINE_LENGTH+1]; |
809 | 523 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
524 if(!file) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
525 return; |
2396
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
526 |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
527 while (1) { |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
528 gint p, q; |
2396
0504110c694b
replaced g_print with AUDDBG
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2316
diff
changeset
|
529 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
530 if (aud_vfs_fgets(line, MAX_CUE_LINE_LENGTH+1, file) == NULL) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
531 aud_vfs_fclose(file); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
532 cue_tracks[last_cue_track-1].duration = |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
533 full_length - cue_tracks[last_cue_track-1].index; |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
534 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
535 AUDDBG("last_cue_track = %d full_length = %d duration=%d\n", |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
536 last_cue_track, |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
537 full_length, |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
538 cue_tracks[last_cue_track-1].duration); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
539 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
540 return; |
809 | 541 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
542 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
543 for (p = 0; line[p] && isspace((int) line[p]); p++); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
544 if (!line[p]) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
545 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
546 for (q = p; line[q] && !isspace((int) line[q]); q++); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
547 if (!line[q]) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
548 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
549 line[q] = '\0'; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
550 for (q++; line[q] && isspace((int) line[q]); q++); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
551 if (strcasecmp(line+p, "REM") == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
552 for (p = q; line[p] && !isspace((int) line[p]); p++); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
553 if (!line[p]) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
554 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
555 line[p] = '\0'; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
556 for (p++; line[p] && isspace((int) line[p]); p++); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
557 if(strcasecmp(line+q, "GENRE") == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
558 fix_cue_argument(line+p); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
559 if (last_cue_track == 0) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
560 cue_genre = aud_str_to_utf8(line + p); |
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
|
561 } |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
562 if(strcasecmp(line+q, "DATE") == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
563 gchar *tmp; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
564 fix_cue_argument(line+p); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
565 if (last_cue_track == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
566 tmp = g_strdup(line + p); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
567 if (tmp) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
568 cue_year = strtok(tmp, "/"); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
569 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
570 } |
853
def1af87ae1f
[svn] - add 1sec guard time after issue of playlist_prev/next.
yaz
parents:
848
diff
changeset
|
571 } |
809 | 572 } |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
573 else if (strcasecmp(line+p, "PERFORMER") == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
574 fix_cue_argument(line+q); |
848 | 575 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
576 if (last_cue_track == 0) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
577 cue_performer = aud_str_to_utf8(line + q); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
578 else |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
579 cue_tracks[last_cue_track - 1].performer = |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
580 aud_str_to_utf8(line + q); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
581 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
582 else if (strcasecmp(line+p, "FILE") == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
583 gchar *tmp = g_path_get_dirname(f); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
584 fix_cue_argument(line+q); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
585 cue_file = g_strdup_printf("%s/%s", tmp, line+q); |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
586 get_full_length(cue_file); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
587 g_free(tmp); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
588 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
589 else if (strcasecmp(line+p, "TITLE") == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
590 fix_cue_argument(line+q); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
591 if (last_cue_track == 0) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
592 cue_title = aud_str_to_utf8(line + q); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
593 else |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
594 cue_tracks[last_cue_track-1].title = |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
595 aud_str_to_utf8(line + q); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
596 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
597 else if (strcasecmp(line+p, "TRACK") == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
598 gint track; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
599 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
600 fix_cue_argument(line+q); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
601 for (p = q; line[p] && isdigit((int) line[p]); p++); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
602 line[p] = '\0'; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
603 for (; line[q] && line[q] == '0'; q++); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
604 if (!line[q]) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
605 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
606 track = atoi(line+q); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
607 if (track >= MAX_CUE_TRACKS) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
608 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
609 last_cue_track = track; |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
610 cue_tracks[last_cue_track-1].title = NULL; |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
611 cue_tracks[last_cue_track-1].performer = NULL; |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
612 cue_tracks[last_cue_track-1].index = 0; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
613 cue_tracks[last_cue_track-1].index00 = 0; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
614 cue_tracks[last_cue_track-1].duration = 0; |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
615 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
616 else if (strcasecmp(line+p, "INDEX") == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
617 gint min, sec, frac; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
618 for (p = q; line[p] && !isspace((int) line[p]); p++); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
619 if (!line[p]) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
620 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
621 line[p] = '\0'; |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
622 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
623 for (p++; line[p] && isspace((int) line[p]); p++); |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
624 /* start */ |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
625 if(strcasecmp(line+q, "01") == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
626 fix_cue_argument(line+p); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
627 if(sscanf(line+p, "%d:%d:%d", &min, &sec, &frac) == 3) { |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
628 gint index01 = |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
629 min * 60000 + sec * 1000 + frac * 1000 / 75; |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
630 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
631 cue_tracks[last_cue_track-1].index = index01; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
632 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
633 if(last_cue_track-2 >= 0) { |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
634 gint index00 = cue_tracks[last_cue_track-1].index00; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
635 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
636 if(index00 > 0) { |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
637 cue_tracks[last_cue_track-2].duration = |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
638 index00 - cue_tracks[last_cue_track-2].index; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
639 } |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
640 else { |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
641 cue_tracks[last_cue_track-2].duration = |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
642 index01 - cue_tracks[last_cue_track-2].index; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
643 } |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
644 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
645 AUDDBG("duration=%d\n", |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
646 cue_tracks[last_cue_track-2].duration); |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
647 } |
860 | 648 } |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
649 } |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
650 /* pregap */ |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
651 else if(strcasecmp(line+q, "00") == 0) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
652 if(sscanf(line+p, "%d:%d:%d", &min, &sec, &frac) == 3) { |
2952
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
653 gint index00 = |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
654 min * 60000 + sec * 1000 + frac * 1000 / 75; |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
655 |
63bf9d97ce65
- now cuesheet plugin calculates duration of subtune correctly even if pregap information is not available.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2951
diff
changeset
|
656 cue_tracks[last_cue_track-2].index00 = index00; |
860 | 657 } |
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
|
658 } |
848 | 659 } |
809 | 660 } |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
661 aud_vfs_fclose(file); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
662 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
663 |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
664 void |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
665 fix_cue_argument(char *line) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
666 { |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
667 if (line[0] == '"') { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
668 gchar *l2; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
669 for (l2 = line+1; *l2 && *l2 != '"'; l2++) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
670 *(l2-1) = *l2; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
671 *(l2-1) = *l2; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
672 for (; *line && *line != '"'; line++) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
673 if (*line == '\\' && *(line+1)) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
674 for (l2 = line+1; *l2 && *l2 != '"'; l2++) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
675 *(l2-1) = *l2; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
676 *(l2-1) = *l2; |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
677 } |
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
678 } |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
679 *line = '\0'; |
1762
cf97a7767faa
now cuesheet can handle INDEX more than 99 minutes.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1737
diff
changeset
|
680 } |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
681 else { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
682 for (; *line && *line != '\r' && *line != '\n'; line++); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
683 *line = '\0'; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2710
diff
changeset
|
684 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
685 } |