Mercurial > audlegacy-plugins
annotate src/sndfile/plugin.c @ 2544:97d0ed3b2631
Mark common fields and input-plugin specific fields via comments.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 30 Apr 2008 04:59:30 +0300 |
parents | 41c619e96a17 |
children | f6efe94f2793 |
rev | line source |
---|---|
2303
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
1 /* Audacious - Cross-platform multimedia player |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
2 * Copyright (C) 2005 Audacious development team. |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
3 * |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
4 * Based on the xmms_sndfile input plugin: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
5 * Copyright (C) 2000, 2002 Erik de Castro Lopo |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
6 * |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
7 * This program is free software; you can redistribute it and/or modify |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
8 * it under the terms of the GNU General Public License as published by |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
9 * the Free Software Foundation; either version 2 of the License, or |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
10 * (at your option) any later version. |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
11 * |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
15 * GNU General Public License for more details. |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
16 * |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
18 * along with this program; if not, write to the Free Software |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
20 */ |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
21 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
22 /* |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
23 * Rewritten 17-Feb-2007 (nenolod): |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
24 * - now uses conditional variables to ensure that sndfile mutex is |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
25 * entirely protected. |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
26 * - pausing works now |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
27 * - fixed some potential race conditions when dealing with NFS. |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
28 * - TITLE_LEN removed |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
29 */ |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
30 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
31 #include "config.h" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
32 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
33 #include <glib.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
34 #include <string.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
35 #include <math.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
36 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
37 #include <audacious/plugin.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
38 #include <audacious/util.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
39 #include <audacious/i18n.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
40 #include <audacious/output.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
41 #include "plugin.h" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
42 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
43 #include <sndfile.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
44 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
45 static SNDFILE *sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
46 static SF_INFO sfinfo; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
47 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
48 static int song_length; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
49 static int bit_rate = 0; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
50 static glong seek_time = -1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
51 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
52 static GThread *decode_thread; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
53 static GMutex *decode_mutex; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
54 static GCond *decode_cond; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
55 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
56 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
57 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
58 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
59 static sf_count_t sf_get_filelen (void *user_data) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
60 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
61 return aud_vfs_fsize (user_data); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
62 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
63 static sf_count_t sf_vseek (sf_count_t offset, int whence, void *user_data) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
64 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
65 return aud_vfs_fseek(user_data, offset, whence); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
66 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
67 static sf_count_t sf_vread (void *ptr, sf_count_t count, void *user_data) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
68 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
69 return aud_vfs_fread(ptr, 1, count, user_data); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
70 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
71 static sf_count_t sf_vwrite (const void *ptr, sf_count_t count, void *user_data) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
72 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
73 return aud_vfs_fwrite(ptr, 1, count, user_data); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
74 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
75 static sf_count_t sf_tell (void *user_data) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
76 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
77 return aud_vfs_ftell(user_data); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
78 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
79 static SF_VIRTUAL_IO sf_virtual_io = |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
80 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
81 sf_get_filelen, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
82 sf_vseek, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
83 sf_vread, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
84 sf_vwrite, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
85 sf_tell |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
86 }; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
87 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
88 static SNDFILE * |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
89 open_sndfile_from_uri(gchar *filename, VFSFile *vfsfile, SF_INFO *tmp_sfinfo) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
90 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
91 SNDFILE *snd_file = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
92 vfsfile = aud_vfs_fopen(filename, "rb"); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
93 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
94 if (vfsfile == NULL) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
95 return NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
96 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
97 snd_file = sf_open_virtual (&sf_virtual_io, SFM_READ, tmp_sfinfo, vfsfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
98 if (snd_file == NULL) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
99 aud_vfs_fclose(vfsfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
100 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
101 return snd_file; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
102 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
103 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
104 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
105 close_sndfile(SNDFILE *snd_file, VFSFile *vfsfile) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
106 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
107 sf_close(snd_file); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
108 aud_vfs_fclose(vfsfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
109 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
110 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
111 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
112 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
113 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
114 plugin_init (void) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
115 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
116 seek_time = -1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
117 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
118 decode_mutex = g_mutex_new(); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
119 decode_cond = g_cond_new(); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
120 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
121 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
122 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
123 plugin_cleanup (void) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
124 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
125 g_cond_free(decode_cond); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
126 g_mutex_free(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
127 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
128 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
129 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
130 fill_song_tuple (char *filename, Tuple *ti) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
131 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
132 VFSFile *vfsfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
133 SNDFILE *tmp_sndfile; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
134 SF_INFO tmp_sfinfo; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
135 unsigned int lossy = 0; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
136 gchar *codec = NULL, *format, *subformat = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
137 GString *codec_gs = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
138 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
139 tmp_sndfile = open_sndfile_from_uri(filename, vfsfile, &tmp_sfinfo); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
140 if ( sf_get_string(tmp_sndfile, SF_STR_TITLE) == NULL) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
141 aud_tuple_associate_string(ti, FIELD_TITLE, NULL, g_path_get_basename(filename)); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
142 else |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
143 aud_tuple_associate_string(ti, FIELD_TITLE, NULL, sf_get_string(tmp_sndfile, SF_STR_TITLE)); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
144 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
145 aud_tuple_associate_string(ti, FIELD_ARTIST, NULL, sf_get_string(tmp_sndfile, SF_STR_ARTIST)); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
146 aud_tuple_associate_string(ti, FIELD_COMMENT, NULL, sf_get_string(tmp_sndfile, SF_STR_COMMENT)); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
147 aud_tuple_associate_string(ti, FIELD_DATE, NULL, sf_get_string(tmp_sndfile, SF_STR_DATE)); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
148 aud_tuple_associate_string(ti, -1, "software", sf_get_string(tmp_sndfile, SF_STR_SOFTWARE)); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
149 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
150 if (!tmp_sndfile) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
151 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
152 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
153 close_sndfile (tmp_sndfile, vfsfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
154 tmp_sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
155 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
156 if (tmp_sfinfo.samplerate > 0) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
157 aud_tuple_associate_int(ti, FIELD_LENGTH, NULL, (int) ceil (1000.0 * tmp_sfinfo.frames / tmp_sfinfo.samplerate)); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
158 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
159 switch (tmp_sfinfo.format & SF_FORMAT_TYPEMASK) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
160 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
161 case SF_FORMAT_WAV: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
162 case SF_FORMAT_WAVEX: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
163 format = "Microsoft WAV"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
164 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
165 case SF_FORMAT_AIFF: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
166 format = "Apple/SGI AIFF"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
167 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
168 case SF_FORMAT_AU: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
169 format = "Sun/NeXT AU"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
170 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
171 case SF_FORMAT_RAW: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
172 format = "Raw PCM data"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
173 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
174 case SF_FORMAT_PAF: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
175 format = "Ensoniq PARIS"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
176 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
177 case SF_FORMAT_SVX: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
178 format = "Amiga IFF / SVX8 / SV16"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
179 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
180 case SF_FORMAT_NIST: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
181 format = "Sphere NIST"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
182 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
183 case SF_FORMAT_VOC: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
184 format = "Creative VOC"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
185 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
186 case SF_FORMAT_IRCAM: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
187 format = "Berkeley/IRCAM/CARL"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
188 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
189 case SF_FORMAT_W64: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
190 format = "Sonic Foundry's 64 bit RIFF/WAV"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
191 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
192 case SF_FORMAT_MAT4: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
193 format = "Matlab (tm) V4.2 / GNU Octave 2.0"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
194 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
195 case SF_FORMAT_MAT5: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
196 format = "Matlab (tm) V5.0 / GNU Octave 2.1"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
197 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
198 case SF_FORMAT_PVF: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
199 format = "Portable Voice Format"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
200 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
201 case SF_FORMAT_XI: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
202 format = "Fasttracker 2 Extended Instrument"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
203 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
204 case SF_FORMAT_HTK: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
205 format = "HMM Tool Kit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
206 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
207 case SF_FORMAT_SDS: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
208 format = "Midi Sample Dump Standard"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
209 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
210 case SF_FORMAT_AVR: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
211 format = "Audio Visual Research"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
212 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
213 case SF_FORMAT_SD2: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
214 format = "Sound Designer 2"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
215 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
216 case SF_FORMAT_FLAC: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
217 format = "Free Lossless Audio Codec"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
218 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
219 case SF_FORMAT_CAF: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
220 format = "Core Audio File"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
221 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
222 default: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
223 format = "unknown sndfile"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
224 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
225 switch (tmp_sfinfo.format & SF_FORMAT_SUBMASK) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
226 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
227 case SF_FORMAT_PCM_S8: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
228 subformat = "signed 8 bit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
229 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
230 case SF_FORMAT_PCM_16: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
231 subformat = "signed 16 bit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
232 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
233 case SF_FORMAT_PCM_24: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
234 subformat = "signed 24 bit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
235 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
236 case SF_FORMAT_PCM_32: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
237 subformat = "signed 32 bit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
238 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
239 case SF_FORMAT_PCM_U8: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
240 subformat = "unsigned 8 bit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
241 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
242 case SF_FORMAT_FLOAT: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
243 subformat = "32 bit float"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
244 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
245 case SF_FORMAT_DOUBLE: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
246 subformat = "64 bit float"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
247 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
248 case SF_FORMAT_ULAW: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
249 subformat = "U-Law"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
250 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
251 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
252 case SF_FORMAT_ALAW: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
253 subformat = "A-Law"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
254 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
255 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
256 case SF_FORMAT_IMA_ADPCM: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
257 subformat = "IMA ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
258 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
259 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
260 case SF_FORMAT_MS_ADPCM: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
261 subformat = "MS ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
262 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
263 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
264 case SF_FORMAT_GSM610: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
265 subformat = "GSM 6.10"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
266 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
267 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
268 case SF_FORMAT_VOX_ADPCM: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
269 subformat = "Oki Dialogic ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
270 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
271 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
272 case SF_FORMAT_G721_32: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
273 subformat = "32kbs G721 ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
274 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
275 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
276 case SF_FORMAT_G723_24: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
277 subformat = "24kbs G723 ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
278 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
279 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
280 case SF_FORMAT_G723_40: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
281 subformat = "40kbs G723 ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
282 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
283 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
284 case SF_FORMAT_DWVW_12: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
285 subformat = "12 bit Delta Width Variable Word"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
286 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
287 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
288 case SF_FORMAT_DWVW_16: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
289 subformat = "16 bit Delta Width Variable Word"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
290 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
291 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
292 case SF_FORMAT_DWVW_24: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
293 subformat = "24 bit Delta Width Variable Word"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
294 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
295 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
296 case SF_FORMAT_DWVW_N: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
297 subformat = "N bit Delta Width Variable Word"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
298 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
299 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
300 case SF_FORMAT_DPCM_8: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
301 subformat = "8 bit differential PCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
302 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
303 case SF_FORMAT_DPCM_16: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
304 subformat = "16 bit differential PCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
305 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
306 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
307 codec_gs = g_string_new(""); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
308 if (subformat != NULL) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
309 g_string_append_printf(codec_gs, "%s (%s)", format, subformat); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
310 else |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
311 g_string_append_printf(codec_gs, "%s", format); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
312 codec = g_strdup(codec_gs->str); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
313 g_string_free(codec_gs, TRUE); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
314 aud_tuple_associate_string(ti, FIELD_CODEC, NULL, codec); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
315 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
316 if (lossy != 0) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
317 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "lossy"); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
318 else |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
319 aud_tuple_associate_string(ti, FIELD_QUALITY, NULL, "lossless"); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
320 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
321 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
322 static gchar *get_title(char *filename) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
323 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
324 Tuple *tuple; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
325 gchar *title; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
326 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
327 tuple = aud_tuple_new_from_filename(filename); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
328 fill_song_tuple(filename, tuple); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
329 title = aud_tuple_formatter_make_title_string(tuple, aud_get_gentitle_format()); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
330 if (*title == '\0') |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
331 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
332 g_free(title); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
333 title = g_strdup(aud_tuple_get_string(tuple, FIELD_FILE_NAME, NULL)); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
334 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
335 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
336 aud_tuple_free(tuple); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
337 return title; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
338 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
339 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
340 static int |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
341 is_our_file (char *filename) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
342 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
343 VFSFile *vfsfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
344 SNDFILE *tmp_sndfile; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
345 SF_INFO tmp_sfinfo; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
346 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
347 /* Have to open the file to see if libsndfile can handle it. */ |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
348 tmp_sndfile = open_sndfile_from_uri(filename, vfsfile, &tmp_sfinfo); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
349 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
350 if (!tmp_sndfile) { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
351 return FALSE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
352 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
353 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
354 /* It can so close file and return TRUE. */ |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
355 close_sndfile (tmp_sndfile, vfsfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
356 tmp_sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
357 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
358 return TRUE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
359 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
360 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
361 static gpointer |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
362 play_loop (gpointer arg) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
363 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
364 static short buffer [BUFFER_SIZE]; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
365 int samples; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
366 InputPlayback *playback = arg; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
367 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
368 for (;;) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
369 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
370 GTimeVal sleeptime; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
371 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
372 /* sf_read_short will return 0 for all reads at EOF. */ |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
373 samples = sf_read_short (sndfile, buffer, BUFFER_SIZE); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
374 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
375 if (samples > 0 && playback->playing == TRUE) { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
376 while ((playback->output->buffer_free () < samples) && |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
377 playback->playing == TRUE) { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
378 g_get_current_time(&sleeptime); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
379 g_time_val_add(&sleeptime, 500000); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
380 g_mutex_lock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
381 g_cond_timed_wait(decode_cond, decode_mutex, &sleeptime); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
382 g_mutex_unlock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
383 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
384 if (playback->playing == FALSE) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
385 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
386 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
387 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
388 playback->pass_audio(playback, FMT_S16_NE, sfinfo.channels, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
389 samples * sizeof (short), buffer, &playback->playing); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
390 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
391 else { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
392 while(playback->output->buffer_playing()) { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
393 g_get_current_time(&sleeptime); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
394 g_time_val_add(&sleeptime, 500000); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
395 g_mutex_lock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
396 g_cond_timed_wait(decode_cond, decode_mutex, &sleeptime); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
397 g_mutex_unlock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
398 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
399 if(playback->playing == FALSE) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
400 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
401 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
402 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
403 playback->eof = TRUE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
404 playback->playing = FALSE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
405 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
406 g_mutex_unlock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
407 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
408 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
409 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
410 /* Do seek if seek_time is valid. */ |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
411 if (seek_time >= 0) { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
412 sf_seek (sndfile, (sf_count_t)((gint64)seek_time * (gint64)sfinfo.samplerate / 1000L), |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
413 SEEK_SET); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
414 playback->output->flush (seek_time); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
415 seek_time = -1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
416 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
417 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
418 if (playback->playing == FALSE) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
419 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
420 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
421 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
422 sf_close (sndfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
423 sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
424 seek_time = -1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
425 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
426 playback->output->close_audio(); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
427 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
428 return NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
429 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
430 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
431 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
432 play_start (InputPlayback *playback) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
433 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
434 VFSFile *vfsfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
435 int pcmbitwidth; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
436 gchar *song_title; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
437 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
438 if (sndfile) /* already opened */ |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
439 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
440 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
441 pcmbitwidth = 32; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
442 song_title = get_title(playback->filename); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
443 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
444 sndfile = open_sndfile_from_uri(playback->filename, vfsfile, &sfinfo); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
445 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
446 if (!sndfile) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
447 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
448 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
449 bit_rate = sfinfo.samplerate * pcmbitwidth; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
450 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
451 if (sfinfo.samplerate > 0) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
452 song_length = (int) ceil (1000.0 * sfinfo.frames / sfinfo.samplerate); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
453 else |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
454 song_length = 0; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
455 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
456 if (! playback->output->open_audio (FMT_S16_NE, sfinfo.samplerate, sfinfo.channels)) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
457 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
458 close_sndfile (sndfile, vfsfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
459 sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
460 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
461 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
462 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
463 playback->set_params(playback, song_title, song_length, bit_rate, sfinfo.samplerate, sfinfo.channels); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
464 g_free (song_title); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
465 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
466 playback->playing = TRUE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
467 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
468 decode_thread = g_thread_self(); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
469 playback->set_pb_ready(playback); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
470 play_loop(playback); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
471 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
472 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
473 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
474 play_pause (InputPlayback *playback, gshort p) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
475 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
476 playback->output->pause(p); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
477 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
478 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
479 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
480 play_stop (InputPlayback *playback) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
481 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
482 if (decode_thread == NULL) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
483 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
484 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
485 g_mutex_lock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
486 playback->playing = FALSE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
487 g_mutex_unlock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
488 g_cond_signal(decode_cond); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
489 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
490 g_thread_join (decode_thread); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
491 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
492 sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
493 decode_thread = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
494 seek_time = -1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
495 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
496 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
497 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
498 file_mseek (InputPlayback *playback, gulong millisecond) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
499 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
500 if (! sfinfo.seekable) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
501 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
502 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
503 seek_time = (glong)millisecond; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
504 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
505 while (seek_time != -1) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
506 g_usleep (80000); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
507 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
508 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
509 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
510 file_seek (InputPlayback *playback, gint time) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
511 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
512 gulong millisecond = time * 1000; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
513 file_mseek(playback, millisecond); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
514 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
515 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
516 static Tuple* |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
517 get_song_tuple (gchar *filename) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
518 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
519 Tuple *ti = aud_tuple_new_from_filename(filename); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
520 fill_song_tuple(filename, ti); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
521 return ti; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
522 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
523 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
524 static int is_our_file_from_vfs(char *filename, VFSFile *fin) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
525 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
526 SNDFILE *tmp_sndfile; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
527 SF_INFO tmp_sfinfo; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
528 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
529 /* Have to open the file to see if libsndfile can handle it. */ |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
530 tmp_sndfile = sf_open_virtual (&sf_virtual_io, SFM_READ, &tmp_sfinfo, fin); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
531 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
532 if (!tmp_sndfile) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
533 return FALSE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
534 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
535 /* It can so close file and return TRUE. */ |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
536 sf_close (tmp_sndfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
537 tmp_sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
538 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
539 return TRUE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
540 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
541 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
542 static void plugin_about(void) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
543 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
544 static GtkWidget *box; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
545 if (!box) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
546 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
547 box = audacious_info_dialog(_("About sndfile plugin"), |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
548 _("Adapted for Audacious usage by Tony Vroon <chainsaw@gentoo.org>\n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
549 "from the xmms_sndfile plugin which is:\n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
550 "Copyright (C) 2000, 2002 Erik de Castro Lopo\n\n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
551 "This program is free software ; you can redistribute it and/or modify \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
552 "it under the terms of the GNU General Public License as published by \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
553 "the Free Software Foundation ; either version 2 of the License, or \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
554 "(at your option) any later version. \n \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
555 "This program is distributed in the hope that it will be useful, \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
556 "but WITHOUT ANY WARRANTY ; without even the implied warranty of \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
557 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
558 "See the GNU General Public License for more details. \n\n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
559 "You should have received a copy of the GNU General Public \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
560 "License along with this program ; if not, write to \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
561 "the Free Software Foundation, Inc., \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
562 "51 Franklin Street, Fifth Floor, \n" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
563 "Boston, MA 02110-1301 USA"), |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
564 _("Ok"), FALSE, NULL, NULL); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
565 g_signal_connect(G_OBJECT(box), "destroy", |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
566 (GCallback)gtk_widget_destroyed, &box); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
567 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
568 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
569 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
570 static gchar *fmts[] = { "aiff", "au", "raw", "wav", NULL }; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
571 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
572 InputPlugin sndfile_ip = { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
573 .description = "sndfile plugin", |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
574 .init = plugin_init, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
575 .about = plugin_about, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
576 .is_our_file = is_our_file, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
577 .play_file = play_start, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
578 .stop = play_stop, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
579 .pause = play_pause, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
580 .seek = file_seek, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
581 .cleanup = plugin_cleanup, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
582 .get_song_tuple = get_song_tuple, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
583 .is_our_file_from_vfs = is_our_file_from_vfs, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
584 .vfs_extensions = fmts, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
585 .mseek = file_mseek, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
586 }; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
587 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
588 InputPlugin *sndfile_iplist[] = { &sndfile_ip, NULL }; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
589 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
590 SIMPLE_INPUT_PLUGIN(sndfile, sndfile_iplist) |