Mercurial > audlegacy-plugins
annotate src/cue/watchdog.c @ 3187:360e92f3211d
alsa-ng: Apparently 24bit values are padded to 32bit, so we need to tell ALSA that.
The FMT_*24_* constants are misleading.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Fri, 19 Jun 2009 08:38:14 -0500 |
parents | 63bf9d97ce65 |
children |
rev | line source |
---|---|
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
1 #include "cuesheet.h" |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
2 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
3 gboolean |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
4 do_stop(gpointer data) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
5 { |
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
|
6 AUDDBG("f:\n"); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
7 audacious_drct_stop(); |
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
|
8 AUDDBG("e:\n"); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
9 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
10 return FALSE; /* only once */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
11 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
12 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
13 gboolean |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
14 do_setpos(gpointer data) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
15 { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
16 Playlist *playlist = aud_playlist_get_active(); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
17 gint pos = aud_playlist_get_position_nolock(playlist); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
18 gint incr = *(gint *)data; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
19 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
20 /* mpris needs state change */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
21 audacious_drct_stop(); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
22 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
23 pos = pos + incr; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
24 if(pos < 0) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
25 pos = 0; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
26 |
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
|
27 AUDDBG("pos = %d\n\n", pos); |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
28 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
29 if (!playlist) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
30 return FALSE; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
31 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
32 /* being done from the main loop thread, does not require locks */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
33 aud_playlist_set_position(playlist, (guint)pos); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
34 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
35 /* mpris needs state change */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
36 audacious_drct_play(); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
37 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
38 return FALSE; /* only once */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
39 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
40 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
41 gpointer |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
42 watchdog_func(gpointer data) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
43 { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
44 gint time = 0; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
45 Playlist *playlist = NULL; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
46 GTimeVal sleep_time; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
47 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
48 AUDDBG("enter\n"); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
49 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
50 while(1) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
51 #if 0 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
52 AUDDBG("time = %d cur = %d cidx = %d nidx = %d last = %d\n", |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
53 time, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
54 cur_cue_track, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
55 cue_tracks[cur_cue_track].index, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
56 cue_tracks[cur_cue_track+1].index, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
57 last_cue_track); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
58 #endif |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
59 g_get_current_time(&sleep_time); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
60 g_time_val_add(&sleep_time, 500000); /* interval is 0.5sec. */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
61 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
62 g_mutex_lock(cue_mutex); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
63 switch(watchdog_state) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
64 case EXIT: |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
65 AUDDBG("e: watchdog exit\n"); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
66 g_mutex_unlock(cue_mutex); /* stop() will lock cue_mutex */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
67 stop(real_ip); /* no need to care real_ip != NULL here. */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
68 g_thread_exit(NULL); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
69 break; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
70 case RUN: |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
71 if(!playlist) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
72 playlist = aud_playlist_get_active(); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
73 g_cond_timed_wait(cue_cond, cue_mutex, &sleep_time); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
74 break; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
75 case STOP: |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
76 AUDDBG("watchdog deactivated\n"); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
77 g_cond_wait(cue_cond, cue_mutex); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
78 playlist = aud_playlist_get_active(); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
79 break; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
80 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
81 g_mutex_unlock(cue_mutex); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
82 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
83 if(watchdog_state != RUN) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
84 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
85 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
86 /* get raw time */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
87 time = real_ip->output->output_time(); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
88 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
89 #if 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
|
90 AUDDBG("time = %d target_time = %lu duration = %d\n", |
2951
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
91 time, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
92 target_time, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
93 cue_tracks[cur_cue_track].duration); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
94 #endif |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
95 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
96 if(time == 0 || time <= target_time) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
97 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
98 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
99 /* next track */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
100 if(time >= cue_tracks[cur_cue_track].index + |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
101 cue_tracks[cur_cue_track].duration) |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
102 { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
103 static gint incr = 0; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
104 AUDDBG("i: watchdog next\n"); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
105 AUDDBG("time = %d cur = %d cidx = %d nidx = %d last = %d lidx = %d\n", |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
106 time, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
107 cur_cue_track, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
108 cue_tracks[cur_cue_track].index, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
109 cue_tracks[cur_cue_track+1].index, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
110 last_cue_track, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
111 cue_tracks[last_cue_track].index); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
112 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
113 incr = 1; /* is this ok? */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
114 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
115 if(aud_cfg->stopaftersong) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
116 g_idle_add_full(G_PRIORITY_HIGH, do_stop, (void *)real_ip, NULL); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
117 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
118 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
119 else { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
120 g_idle_add_full(G_PRIORITY_HIGH , do_setpos, &incr, NULL); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
121 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
122 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
123 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
124 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
125 /* last track */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
126 if (cur_cue_track + 1 == last_cue_track && |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
127 (cue_tracks[last_cue_track].index - time < 500 || |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
128 time > cue_tracks[last_cue_track].index) ){ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
129 AUDDBG("last track\n"); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
130 gint pos = aud_playlist_get_position(playlist); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
131 if (pos + 1 == aud_playlist_get_length(playlist)) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
132 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
133 AUDDBG("i: watchdog eof reached\n\n"); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
134 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
135 if(aud_cfg->repeat) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
136 static gint incr = 0; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
137 incr = -pos; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
138 g_idle_add_full(G_PRIORITY_HIGH , do_setpos, &incr, NULL); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
139 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
140 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
141 else { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
142 g_idle_add_full(G_PRIORITY_HIGH, do_stop, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
143 (void *)real_ip, NULL); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
144 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
145 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
146 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
147 else { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
148 if(aud_cfg->stopaftersong) { |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
149 g_idle_add_full(G_PRIORITY_HIGH, do_stop, |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
150 (void *)real_ip, NULL); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
151 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
152 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
153 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
154 AUDDBG("i: watchdog end of cue, advance in playlist\n\n"); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
155 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
156 static gint incr = 1; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
157 g_idle_add_full(G_PRIORITY_HIGH , do_setpos, &incr, NULL); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
158 continue; |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
159 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
160 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
161 } |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
162 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
163 AUDDBG("e: watchdog\n"); |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
164 |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
165 return NULL; /* dummy */ |
6abe60a81301
reimplemented cuesheet plugin using subtune.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
166 } |