Mercurial > audlegacy-plugins
annotate src/sndfile/plugin.c @ 2499:4d6045c20cc5
Include cleanups, part #4.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 31 Mar 2008 15:18:05 +0300 |
parents | 5561e63e9133 |
children | 41c619e96a17 |
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/main.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
41 #include <audacious/output.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
42 #include "plugin.h" |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
43 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
44 #include <sndfile.h> |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
45 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
46 static SNDFILE *sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
47 static SF_INFO sfinfo; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
48 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
49 static int song_length; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
50 static int bit_rate = 0; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
51 static glong seek_time = -1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
52 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
53 static GThread *decode_thread; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
54 static GMutex *decode_mutex; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
55 static GCond *decode_cond; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
60 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
|
61 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
62 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
|
63 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
64 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
|
65 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
66 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
|
67 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
68 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
|
69 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
70 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
|
71 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
72 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
|
73 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
74 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
|
75 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
76 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
|
77 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
78 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
|
79 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
80 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
|
81 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
82 sf_get_filelen, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
83 sf_vseek, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
84 sf_vread, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
85 sf_vwrite, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
86 sf_tell |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
89 static SNDFILE * |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
90 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
|
91 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
92 SNDFILE *snd_file = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
93 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
|
94 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
95 if (vfsfile == NULL) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
96 return NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
97 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
98 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
|
99 if (snd_file == NULL) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
100 aud_vfs_fclose(vfsfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
101 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
102 return snd_file; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
105 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
106 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
|
107 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
108 sf_close(snd_file); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
109 aud_vfs_fclose(vfsfile); |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
114 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
115 plugin_init (void) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
116 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
117 seek_time = -1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
118 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
119 decode_mutex = g_mutex_new(); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
120 decode_cond = g_cond_new(); |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
123 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
124 plugin_cleanup (void) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
125 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
126 g_cond_free(decode_cond); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
127 g_mutex_free(decode_mutex); |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
130 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
131 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
|
132 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
133 VFSFile *vfsfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
134 SNDFILE *tmp_sndfile; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
135 SF_INFO tmp_sfinfo; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
136 unsigned int lossy = 0; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
137 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
|
138 GString *codec_gs = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
139 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
140 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
|
141 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
|
142 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
|
143 else |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
144 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
|
145 |
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_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
|
147 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
|
148 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
|
149 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
|
150 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
151 if (!tmp_sndfile) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
152 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
153 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
154 close_sndfile (tmp_sndfile, vfsfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
155 tmp_sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
156 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
157 if (tmp_sfinfo.samplerate > 0) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
158 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
|
159 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
160 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
|
161 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
162 case SF_FORMAT_WAV: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
163 case SF_FORMAT_WAVEX: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
164 format = "Microsoft WAV"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
165 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
166 case SF_FORMAT_AIFF: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
167 format = "Apple/SGI AIFF"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
168 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
169 case SF_FORMAT_AU: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
170 format = "Sun/NeXT AU"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
171 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
172 case SF_FORMAT_RAW: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
173 format = "Raw PCM data"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
174 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
175 case SF_FORMAT_PAF: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
176 format = "Ensoniq PARIS"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
177 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
178 case SF_FORMAT_SVX: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
179 format = "Amiga IFF / SVX8 / SV16"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
180 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
181 case SF_FORMAT_NIST: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
182 format = "Sphere NIST"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
183 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
184 case SF_FORMAT_VOC: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
185 format = "Creative VOC"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
186 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
187 case SF_FORMAT_IRCAM: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
188 format = "Berkeley/IRCAM/CARL"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
189 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
190 case SF_FORMAT_W64: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
191 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
|
192 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
193 case SF_FORMAT_MAT4: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
194 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
|
195 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
196 case SF_FORMAT_MAT5: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
197 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
|
198 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
199 case SF_FORMAT_PVF: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
200 format = "Portable Voice Format"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
201 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
202 case SF_FORMAT_XI: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
203 format = "Fasttracker 2 Extended Instrument"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
204 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
205 case SF_FORMAT_HTK: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
206 format = "HMM Tool Kit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
207 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
208 case SF_FORMAT_SDS: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
209 format = "Midi Sample Dump Standard"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
210 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
211 case SF_FORMAT_AVR: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
212 format = "Audio Visual Research"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
213 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
214 case SF_FORMAT_SD2: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
215 format = "Sound Designer 2"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
216 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
217 case SF_FORMAT_FLAC: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
218 format = "Free Lossless Audio Codec"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
219 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
220 case SF_FORMAT_CAF: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
221 format = "Core Audio File"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
222 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
223 default: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
224 format = "unknown sndfile"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
225 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
226 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
|
227 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
228 case SF_FORMAT_PCM_S8: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
229 subformat = "signed 8 bit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
230 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
231 case SF_FORMAT_PCM_16: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
232 subformat = "signed 16 bit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
233 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
234 case SF_FORMAT_PCM_24: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
235 subformat = "signed 24 bit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
236 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
237 case SF_FORMAT_PCM_32: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
238 subformat = "signed 32 bit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
239 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
240 case SF_FORMAT_PCM_U8: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
241 subformat = "unsigned 8 bit"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
242 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
243 case SF_FORMAT_FLOAT: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
244 subformat = "32 bit float"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
245 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
246 case SF_FORMAT_DOUBLE: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
247 subformat = "64 bit float"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
248 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
249 case SF_FORMAT_ULAW: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
250 subformat = "U-Law"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
251 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
252 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
253 case SF_FORMAT_ALAW: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
254 subformat = "A-Law"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
255 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
256 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
257 case SF_FORMAT_IMA_ADPCM: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
258 subformat = "IMA ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
259 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
260 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
261 case SF_FORMAT_MS_ADPCM: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
262 subformat = "MS ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
263 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
264 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
265 case SF_FORMAT_GSM610: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
266 subformat = "GSM 6.10"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
267 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
268 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
269 case SF_FORMAT_VOX_ADPCM: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
270 subformat = "Oki Dialogic ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
271 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
272 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
273 case SF_FORMAT_G721_32: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
274 subformat = "32kbs G721 ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
275 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
276 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
277 case SF_FORMAT_G723_24: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
278 subformat = "24kbs G723 ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
279 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
280 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
281 case SF_FORMAT_G723_40: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
282 subformat = "40kbs G723 ADPCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
283 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
284 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
285 case SF_FORMAT_DWVW_12: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
286 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
|
287 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
288 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
289 case SF_FORMAT_DWVW_16: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
290 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
|
291 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
292 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
293 case SF_FORMAT_DWVW_24: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
294 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
|
295 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
296 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
297 case SF_FORMAT_DWVW_N: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
298 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
|
299 lossy = 1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
300 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
301 case SF_FORMAT_DPCM_8: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
302 subformat = "8 bit differential PCM"; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
303 break; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
304 case SF_FORMAT_DPCM_16: |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
305 subformat = "16 bit differential PCM"; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
308 codec_gs = g_string_new(""); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
309 if (subformat != NULL) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
310 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
|
311 else |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
312 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
|
313 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
|
314 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
|
315 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
|
316 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
317 if (lossy != 0) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
318 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
|
319 else |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
320 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
|
321 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
322 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
323 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
|
324 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
325 Tuple *tuple; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
326 gchar *title; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
327 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
328 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
|
329 fill_song_tuple(filename, tuple); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
330 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
|
331 if (*title == '\0') |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
332 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
333 g_free(title); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
334 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
|
335 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
336 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
337 aud_tuple_free(tuple); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
338 return title; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
341 static int |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
342 is_our_file (char *filename) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
343 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
344 VFSFile *vfsfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
345 SNDFILE *tmp_sndfile; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
346 SF_INFO tmp_sfinfo; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
347 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
348 /* 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
|
349 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
|
350 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
351 if (!tmp_sndfile) { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
352 return FALSE; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
355 /* 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
|
356 close_sndfile (tmp_sndfile, vfsfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
357 tmp_sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
358 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
359 return TRUE; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
362 static gpointer |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
363 play_loop (gpointer arg) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
364 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
365 static short buffer [BUFFER_SIZE]; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
366 int samples; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
367 InputPlayback *playback = arg; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
368 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
369 for (;;) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
370 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
371 GTimeVal sleeptime; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
372 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
373 /* 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
|
374 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
|
375 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
376 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
|
377 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
|
378 playback->playing == TRUE) { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
379 g_get_current_time(&sleeptime); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
380 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
|
381 g_mutex_lock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
382 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
|
383 g_mutex_unlock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
384 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
385 if (playback->playing == FALSE) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
386 break; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
389 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
|
390 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
|
391 } |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
392 else { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
393 while(playback->output->buffer_playing()) { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
394 g_get_current_time(&sleeptime); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
395 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
|
396 g_mutex_lock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
397 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
|
398 g_mutex_unlock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
399 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
400 if(playback->playing == FALSE) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
401 break; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
404 playback->eof = TRUE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
405 playback->playing = FALSE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
406 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
407 g_mutex_unlock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
408 break; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
411 /* 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
|
412 if (seek_time >= 0) { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
413 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
|
414 SEEK_SET); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
415 playback->output->flush (seek_time); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
416 seek_time = -1; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
419 if (playback->playing == FALSE) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
420 break; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
423 sf_close (sndfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
424 sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
425 seek_time = -1; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
426 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
427 playback->output->close_audio(); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
428 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
429 return NULL; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
432 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
433 play_start (InputPlayback *playback) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
434 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
435 VFSFile *vfsfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
436 int pcmbitwidth; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
437 gchar *song_title; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
438 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
439 if (sndfile) /* already opened */ |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
440 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
441 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
442 pcmbitwidth = 32; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
443 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
|
444 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
445 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
|
446 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
447 if (!sndfile) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
448 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
449 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
450 bit_rate = sfinfo.samplerate * pcmbitwidth; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
451 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
452 if (sfinfo.samplerate > 0) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
453 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
|
454 else |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
455 song_length = 0; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
456 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
457 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
|
458 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
459 close_sndfile (sndfile, vfsfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
460 sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
461 return; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
464 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
|
465 g_free (song_title); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
466 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
467 playback->playing = TRUE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
468 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
469 decode_thread = g_thread_self(); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
470 playback->set_pb_ready(playback); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
471 play_loop(playback); |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
474 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
475 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
|
476 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
477 playback->output->pause(p); |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
480 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
481 play_stop (InputPlayback *playback) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
482 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
483 if (decode_thread == NULL) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
484 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
485 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
486 g_mutex_lock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
487 playback->playing = FALSE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
488 g_mutex_unlock(decode_mutex); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
489 g_cond_signal(decode_cond); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
490 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
491 g_thread_join (decode_thread); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
492 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
493 sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
494 decode_thread = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
495 seek_time = -1; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
498 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
499 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
|
500 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
501 if (! sfinfo.seekable) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
502 return; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
503 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
504 seek_time = (glong)millisecond; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
505 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
506 while (seek_time != -1) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
507 g_usleep (80000); |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
510 static void |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
511 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
|
512 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
513 gulong millisecond = time * 1000; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
514 file_mseek(playback, millisecond); |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
517 static Tuple* |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
518 get_song_tuple (gchar *filename) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
519 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
520 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
|
521 fill_song_tuple(filename, ti); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
522 return ti; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
525 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
|
526 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
527 SNDFILE *tmp_sndfile; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
528 SF_INFO tmp_sfinfo; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
529 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
530 /* 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
|
531 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
|
532 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
533 if (!tmp_sndfile) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
534 return FALSE; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
535 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
536 /* 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
|
537 sf_close (tmp_sndfile); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
538 tmp_sndfile = NULL; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
539 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
540 return TRUE; |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
543 static void plugin_about(void) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
544 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
545 static GtkWidget *box; |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
546 if (!box) |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
547 { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
548 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
|
549 _("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
|
550 "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
|
551 "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
|
552 "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
|
553 "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
|
554 "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
|
555 "(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
|
556 "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
|
557 "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
|
558 "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
|
559 "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
|
560 "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
|
561 "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
|
562 "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
|
563 "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
|
564 "Boston, MA 02110-1301 USA"), |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
565 _("Ok"), FALSE, NULL, NULL); |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
566 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
|
567 (GCallback)gtk_widget_destroyed, &box); |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
571 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
|
572 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
573 InputPlugin sndfile_ip = { |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
574 .description = "sndfile plugin", |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
575 .init = plugin_init, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
576 .about = plugin_about, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
577 .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
|
578 .play_file = play_start, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
579 .stop = play_stop, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
580 .pause = play_pause, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
581 .seek = file_seek, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
582 .cleanup = plugin_cleanup, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
583 .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
|
584 .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
|
585 .vfs_extensions = fmts, |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
586 .mseek = file_mseek, |
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 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
589 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
|
590 |
5561e63e9133
threw out the WAV plugin in favour of the sndfile plugin
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
591 SIMPLE_INPUT_PLUGIN(sndfile, sndfile_iplist) |