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