Mercurial > audlegacy-plugins
comparison src/wav/wav-sndfile.c @ 2292:61548eb4f676
first changes to make sndfile compatible with VFS
author | mf0102 <0102@gmx.at> |
---|---|
date | Thu, 10 Jan 2008 19:49:26 +0100 |
parents | 0f8450380020 |
children | 4816e35abc02 |
comparison
equal
deleted
inserted
replaced
2291:1457b35713d9 | 2292:61548eb4f676 |
---|---|
54 static GMutex *decode_mutex; | 54 static GMutex *decode_mutex; |
55 static GCond *decode_cond; | 55 static GCond *decode_cond; |
56 | 56 |
57 | 57 |
58 | 58 |
59 | |
60 static sf_count_t sf_get_filelen (void *user_data) | |
61 { | |
62 return aud_vfs_fsize (user_data); | |
63 } | |
64 static sf_count_t sf_vseek (sf_count_t offset, int whence, void *user_data) | |
65 { | |
66 return aud_vfs_fseek(user_data, offset, whence); | |
67 } | |
68 static sf_count_t sf_vread (void *ptr, sf_count_t count, void *user_data) | |
69 { | |
70 return vfs_fread(ptr, 1, count, user_data); | |
71 } | |
72 static sf_count_t sf_vwrite (const void *ptr, sf_count_t count, void *user_data) | |
73 { | |
74 return vfs_fwrite(ptr, 1, count, user_data); | |
75 } | |
76 static sf_count_t sf_tell (void *user_data) | |
77 { | |
78 return vfs_ftell(user_data); | |
79 } | |
80 static SF_VIRTUAL_IO sf_virtual_io = | |
81 { | |
82 sf_get_filelen, | |
83 sf_vseek, | |
84 sf_vread, | |
85 sf_vwrite, | |
86 sf_tell | |
87 }; | |
88 | |
89 | |
59 static void | 90 static void |
60 plugin_init (void) | 91 plugin_init (void) |
61 { | 92 { |
62 seek_time = -1; | 93 seek_time = -1; |
63 | 94 |
503 Tuple *ti = aud_tuple_new_from_filename(filename); | 534 Tuple *ti = aud_tuple_new_from_filename(filename); |
504 fill_song_tuple(filename, ti); | 535 fill_song_tuple(filename, ti); |
505 return ti; | 536 return ti; |
506 } | 537 } |
507 | 538 |
508 /*static int is_our_file_from_vfs(char *filename, VFSFile *fin) | 539 static int is_our_file_from_vfs(char *filename, VFSFile *fin) |
509 { | 540 { |
510 }*/ | 541 SNDFILE *tmp_sndfile; |
542 SF_INFO tmp_sfinfo; | |
543 | |
544 /* Have to open the file to see if libsndfile can handle it. */ | |
545 tmp_sndfile = sf_open_virtual (&sf_virtual_io, SFM_READ, &tmp_sfinfo, fin); | |
546 | |
547 if (!tmp_sndfile) | |
548 return FALSE; | |
549 | |
550 /* It can so close file and return TRUE. */ | |
551 sf_close (tmp_sndfile); | |
552 tmp_sndfile = NULL; | |
553 | |
554 return TRUE; | |
555 } | |
511 | 556 |
512 static void wav_about(void) | 557 static void wav_about(void) |
513 { | 558 { |
514 static GtkWidget *box; | 559 static GtkWidget *box; |
515 if (!box) | 560 if (!box) |