diff src/alac/plugin.c @ 66:f04b33512c3d trunk

[svn] - get_time() implementation
author nenolod
date Sat, 30 Sep 2006 22:44:36 -0700
parents 72ad216a01ac
children 41e2dc106f4e
line wrap: on
line diff
--- a/src/alac/plugin.c	Sat Sep 30 22:05:07 2006 -0700
+++ b/src/alac/plugin.c	Sat Sep 30 22:44:36 2006 -0700
@@ -48,6 +48,7 @@
 
 gpointer decode_thread(void *args);
 static GThread *playback_thread;
+static int going = 0;
 
 extern void set_endian();
 
@@ -103,6 +104,14 @@
 	/* unimplemented */
 }
 
+static gint get_time(void)
+{
+    if (going)
+	return get_output_time();
+    else
+	return -1;
+}
+
 InputPlugin alac_ip = {
     NULL,
     NULL,
@@ -117,7 +126,7 @@
     output_pause,
     seek,
     NULL,
-    get_output_time,
+    get_time,
     NULL,
     NULL,
     NULL,
@@ -171,7 +180,6 @@
     unsigned long destBufferSize = 1024*16; /* 16kb buffer = 4096 frames = 1 alac sample */
     void *pDestBuffer = malloc(destBufferSize);
     int bytes_read = 0;
-    int going = 1;
 
     unsigned int buffer_size = 1024*128;
     void *buffer;
@@ -254,9 +262,13 @@
     alac_ip.output->open_audio(FMT_S16_LE, demux_res.sample_rate, demux_res.num_channels);
     alac_ip.set_info((char *) args, -1, -1, demux_res.sample_rate, demux_res.num_channels);
 
+    going = 1;
+
     /* will convert the entire buffer */
     GetBuffer(&demux_res);
 
+    going = 0;
+
     stream_destroy(input_stream);
 
     if (input_opened)