comparison src/alac/plugin.c @ 91:6e1002ea4ded trunk

[svn] - some seek code (can't be implemented right now though) - change `return 1' to `return NULL' in decode_thread().
author nenolod
date Thu, 12 Oct 2006 09:05:01 -0700
parents 86ce11c6b8c3
children acb93b546742
comparison
equal deleted inserted replaced
90:77e8e032601b 91:6e1002ea4ded
47 static int input_opened = 0; 47 static int input_opened = 0;
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 static int going = 0;
52 static int seek_to = -1;
52 53
53 extern void set_endian(); 54 extern void set_endian();
54 55
55 static gchar * 56 static gchar *
56 extname(const char *filename) 57 extname(const char *filename)
187 output_close_audio(); 188 output_close_audio();
188 } 189 }
189 190
190 static void seek(gint time) 191 static void seek(gint time)
191 { 192 {
192 /* unimplemented */ 193 seek_to = time;
193 } 194 }
194 195
195 static gint get_time(void) 196 static gint get_time(void)
196 { 197 {
197 if (going) 198 if (going)
274 { 275 {
275 uint32_t sample_duration; 276 uint32_t sample_duration;
276 uint32_t sample_byte_size; 277 uint32_t sample_byte_size;
277 278
278 int outputBytes; 279 int outputBytes;
280
281 #if 0
282 /* XXX: Horribly inaccurate seek. -nenolod */
283 if (seek_to != -1)
284 {
285 gulong duration =
286 (demux_res->num_sample_byte_sizes * (float)((1024 * demux_res->sample_size) - 1.0) /
287 (float)(demux_res->sample_rate / 251));
288
289 i = (duration - seek_to) / demux_res->num_sample_byte_sizes;
290
291 g_print("seek to ALAC frame: %d\n", i);
292
293 seek_to = -1;
294 }
295 #endif
279 296
280 /* just get one sample for now */ 297 /* just get one sample for now */
281 if (!get_sample_info(demux_res, i, 298 if (!get_sample_info(demux_res, i,
282 &sample_duration, &sample_byte_size)) 299 &sample_duration, &sample_byte_size))
283 return; 300 return;
318 335
319 input_file = vfs_fopen((char *) args, "rb"); 336 input_file = vfs_fopen((char *) args, "rb");
320 input_stream = stream_create_file(input_file, 1); 337 input_stream = stream_create_file(input_file, 1);
321 338
322 if (!input_stream) 339 if (!input_stream)
323 return 1; 340 return NULL;
324 341
325 /* if qtmovie_read returns successfully, the stream is up to 342 /* if qtmovie_read returns successfully, the stream is up to
326 * the movie data, which can be used directly by the decoder */ 343 * the movie data, which can be used directly by the decoder */
327 if (!qtmovie_read(input_stream, &demux_res)) 344 if (!qtmovie_read(input_stream, &demux_res))
328 return 1; 345 return NULL;
329 346
330 demux_res.stream = input_stream; 347 demux_res.stream = input_stream;
331 348
332 /* Get the titlestring ready. */ 349 /* Get the titlestring ready. */
333 ti = build_tuple_from_demux(&demux_res, (char *) args); 350 ti = build_tuple_from_demux(&demux_res, (char *) args);