37 static pthread_mutex_t
mutex = PTHREAD_MUTEX_INITIALIZER;
56 pthread_mutex_lock (&
mutex);
60 pthread_mutex_unlock (&
mutex);
67 while ((next = g_queue_peek_head (&
vis_list)))
79 vis_node = g_queue_pop_head (&
vis_list);
82 pthread_mutex_unlock (&
mutex);
95 pthread_mutex_lock (&
mutex);
97 pthread_mutex_unlock (&
mutex);
121 pthread_mutex_lock (&
mutex);
123 pthread_mutex_unlock (&
mutex);
152 pthread_mutex_lock (&
mutex);
154 pthread_mutex_unlock (&
mutex);
160 pthread_mutex_lock (&
mutex);
169 if (current_node && current_node->
channels != channels)
181 int node_time = time;
191 if ((last = g_queue_peek_tail (&
vis_list)))
194 at = channels * (
int) ((int64_t) (node_time - time) * rate / 1000);
201 current_node = g_malloc (
sizeof (
VisNode));
202 current_node->
time = node_time;
203 current_node->
data = g_malloc (
sizeof (
float) * channels * 512);
214 memcpy (current_node->
data + channels *
current_frames, data + at, sizeof (
float) * copy);
217 if (current_frames < 512)
220 g_queue_push_tail (&
vis_list, current_node);
225 pthread_mutex_unlock (&
mutex);
230 pthread_mutex_lock (&
mutex);
233 pthread_mutex_unlock (&
mutex);