updated on Wed Jan 25 08:34:36 UTC 2012
[aur-mirror.git] / xmms2-git-oss / startms2.patch
blob19693db344ad7ad893fb34fd909ca77fd5a2ff01
1 commit cee22c84e6be8ae4c89c333695fa5b50c63ea036
2 Author: Florian Ragwitz <rafl@debian.org>
3 Date: Sun Sep 30 00:15:57 2007 +0200
5 BUG(1637): honor startms.
7 diff --git a/src/xmms/output.c b/src/xmms/output.c
8 index 6f5933c..4f5e0b1 100644
9 --- a/src/xmms/output.c
10 +++ b/src/xmms/output.c
11 @@ -251,6 +251,7 @@ typedef struct {
12 xmms_output_t *output;
13 xmms_xform_t *chain;
14 gboolean flush;
15 + guint startms;
16 } xmms_output_song_changed_arg_t;
18 static void
19 @@ -285,6 +286,21 @@ song_changed (void *data)
20 if (arg->flush)
21 xmms_output_flush (arg->output);
23 + if (arg->startms > 0) {
24 + xmms_error_t err;
25 + xmms_error_reset (&err);
27 + XMMS_DBG ("Got startms. Trying to seek to %u.", arg->startms);
29 + arg->output->filler_state = FILLER_SEEK;
30 + arg->output->filler_seek = xmms_sample_ms_to_samples (arg->output->format, arg->startms);
31 + g_cond_signal (arg->output->filler_state_cond);
33 + if (xmms_error_iserror (&err)) {
34 + XMMS_DBG ("Failed to seek to startms");
35 + }
36 + }
38 xmms_object_emit_f (XMMS_OBJECT (arg->output),
39 XMMS_IPC_SIGNAL_OUTPUT_CURRENTID,
40 XMMS_OBJECT_CMD_ARG_UINT32,
41 @@ -404,6 +420,8 @@ xmms_output_filler (void *arg)
42 xmms_medialib_entry_t entry;
43 xmms_output_song_changed_arg_t *arg;
44 xmms_medialib_session_t *session;
45 + gchar *tmp;
46 + gint startms = 0;
48 g_mutex_unlock (output->filler_mutex);
50 @@ -435,10 +453,21 @@ xmms_output_filler (void *arg)
51 continue;
54 + if (xmms_xform_metadata_get_str (chain, "startms",&tmp)) {
55 + gchar *endptr;
57 + startms = g_ascii_strtoull (tmp, &endptr, 10);
59 + if (*endptr != '\0') {
60 + startms = 0;
61 + }
62 + }
64 arg = g_new0 (xmms_output_song_changed_arg_t, 1);
65 arg->output = output;
66 arg->chain = chain;
67 arg->flush = last_was_kill;
68 + arg->startms = startms;
69 xmms_object_ref (chain);
71 last_was_kill = FALSE;