comparison 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
comparison
equal deleted inserted replaced
65:d54fa96988b3 66:f04b33512c3d
46 static int input_opened = 0; 46 static int input_opened = 0;
47 static stream_t *input_stream; 47 static stream_t *input_stream;
48 48
49 gpointer decode_thread(void *args); 49 gpointer decode_thread(void *args);
50 static GThread *playback_thread; 50 static GThread *playback_thread;
51 static int going = 0;
51 52
52 extern void set_endian(); 53 extern void set_endian();
53 54
54 static void alac_init(void) 55 static void alac_init(void)
55 { 56 {
101 static void seek(gint time) 102 static void seek(gint time)
102 { 103 {
103 /* unimplemented */ 104 /* unimplemented */
104 } 105 }
105 106
107 static gint get_time(void)
108 {
109 if (going)
110 return get_output_time();
111 else
112 return -1;
113 }
114
106 InputPlugin alac_ip = { 115 InputPlugin alac_ip = {
107 NULL, 116 NULL,
108 NULL, 117 NULL,
109 "Apple Lossless Plugin", /* Description */ 118 "Apple Lossless Plugin", /* Description */
110 alac_init, 119 alac_init,
115 play_file, 124 play_file,
116 stop, 125 stop,
117 output_pause, 126 output_pause,
118 seek, 127 seek,
119 NULL, 128 NULL,
120 get_output_time, 129 get_time,
121 NULL, 130 NULL,
122 NULL, 131 NULL,
123 NULL, 132 NULL,
124 NULL, 133 NULL,
125 NULL, 134 NULL,
169 void GetBuffer(demux_res_t *demux_res) 178 void GetBuffer(demux_res_t *demux_res)
170 { 179 {
171 unsigned long destBufferSize = 1024*16; /* 16kb buffer = 4096 frames = 1 alac sample */ 180 unsigned long destBufferSize = 1024*16; /* 16kb buffer = 4096 frames = 1 alac sample */
172 void *pDestBuffer = malloc(destBufferSize); 181 void *pDestBuffer = malloc(destBufferSize);
173 int bytes_read = 0; 182 int bytes_read = 0;
174 int going = 1;
175 183
176 unsigned int buffer_size = 1024*128; 184 unsigned int buffer_size = 1024*128;
177 void *buffer; 185 void *buffer;
178 186
179 unsigned int i; 187 unsigned int i;
252 init_sound_converter(&demux_res); 260 init_sound_converter(&demux_res);
253 261
254 alac_ip.output->open_audio(FMT_S16_LE, demux_res.sample_rate, demux_res.num_channels); 262 alac_ip.output->open_audio(FMT_S16_LE, demux_res.sample_rate, demux_res.num_channels);
255 alac_ip.set_info((char *) args, -1, -1, demux_res.sample_rate, demux_res.num_channels); 263 alac_ip.set_info((char *) args, -1, -1, demux_res.sample_rate, demux_res.num_channels);
256 264
265 going = 1;
266
257 /* will convert the entire buffer */ 267 /* will convert the entire buffer */
258 GetBuffer(&demux_res); 268 GetBuffer(&demux_res);
259 269
270 going = 0;
271
260 stream_destroy(input_stream); 272 stream_destroy(input_stream);
261 273
262 if (input_opened) 274 if (input_opened)
263 vfs_fclose(input_file); 275 vfs_fclose(input_file);
264 276