Mercurial > audlegacy-plugins
annotate src/vorbis/vorbis.c @ 2557:f0c34c3b61c0
Synchronized Autoconf/m4 cleanups from XMMS-SID.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 10 May 2008 03:08:07 +0300 |
parents | 769e17da93dd |
children | bd3a24b39058 |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 * Copyright (C) Tony Arcieri <bascule@inferno.tusculum.edu> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 * Copyright (C) 2001-2002 Haavard Kvaalen <havardk@xmms.org> |
545
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
4 * Copyright (C) 2007 William Pitcock <nenolod@sacredspiral.co.uk> |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
5 * Copyright (C) 2008 Cristi Măgherușan <majeru@gentoo.ro> |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
6 * Copyright (C) 2008 Eugene Zagidullin <e.asphyx@gmail.com> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 * ReplayGain processing Copyright (C) 2002 Gian-Carlo Pascutto <gcp@sjeng.org> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 * modify it under the terms of the GNU General Public License |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 * as published by the Free Software Foundation; either version 2 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 * of the License, or (at your option) any later version. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 * 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
|
16 * 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
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 * 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
|
21 * 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
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 * 02110-1301, USA. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 * 2002-01-11 ReplayGain processing added by Gian-Carlo Pascutto <gcp@sjeng.org> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 * Note that this uses vorbisfile, which is not (currently) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 * thread-safe. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 |
1777 | 36 #include "config.h" |
2377
9056897525e1
pretend to be stopped when buffer is free. needed for correct waiting for free buffer
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2375
diff
changeset
|
37 /*#define AUD_DEBUG |
9056897525e1
pretend to be stopped when buffer is free. needed for correct waiting for free buffer
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2375
diff
changeset
|
38 #define DEBUG*/ |
537
e55f789573e3
[svn] - treat all failures the same. this is XIPH. we're not going to ever be
nenolod
parents:
536
diff
changeset
|
39 |
615
1fb44c12a812
[svn] - avoid NULL dereference. closes mandriva #28603.
nenolod
parents:
608
diff
changeset
|
40 #define REMOVE_NONEXISTANT_TAG(x) if (x != NULL && !*x) { x = NULL; } |
608 | 41 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 #include <glib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 #include <gtk/gtk.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 #include <math.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 #include <fcntl.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 #include <ogg/ogg.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
52 #include <vorbis/codec.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 #include <vorbis/vorbisfile.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 |
1950
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1777
diff
changeset
|
55 #include <audacious/plugin.h> |
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1777
diff
changeset
|
56 #include <audacious/output.h> |
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1777
diff
changeset
|
57 #include <audacious/util.h> |
527
d124034ebea3
[svn] - glib/gi18n.h -> audacious/i18n.h for automatic dgettext support
nenolod
parents:
484
diff
changeset
|
58 #include <audacious/i18n.h> |
772 | 59 #include <audacious/strings.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 #include "vorbis.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 extern vorbis_config_t vorbis_cfg; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
64 |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
65 static Tuple *get_song_tuple(gchar *filename); |
475 | 66 static int vorbis_check_fd(char *filename, VFSFile *stream); |
559 | 67 static void vorbis_play(InputPlayback *data); |
68 static void vorbis_stop(InputPlayback *data); | |
69 static void vorbis_pause(InputPlayback *data, short p); | |
70 static void vorbis_seek(InputPlayback *data, int time); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 static gchar *vorbis_generate_title(OggVorbis_File * vorbisfile, gchar * fn); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 static void vorbis_aboutbox(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
73 static void vorbis_init(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 static void vorbis_cleanup(void); |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
75 static long vorbis_interleave_buffer(float **pcm, int samples, int ch, |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
76 float *pcmout); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
77 static gboolean vorbis_update_replaygain(ReplayGainInfo *rg_info); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
78 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 static size_t ovcb_read(void *ptr, size_t size, size_t nmemb, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 static int ovcb_seek(void *datasource, int64_t offset, int whence); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 static int ovcb_close(void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 static long ovcb_tell(void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 ov_callbacks vorbis_callbacks = { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 ovcb_read, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 ovcb_seek, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 ovcb_close, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 ovcb_tell |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
90 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
92 ov_callbacks vorbis_callbacks_stream = { |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
93 ovcb_read, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
94 NULL, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
95 ovcb_close, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
96 NULL |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
97 }; |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
98 |
375 | 99 gchar *vorbis_fmts[] = { "ogg", "ogm", NULL }; |
100 | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
101 InputPlugin vorbis_ip = { |
1618
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
102 .description = "Ogg Vorbis Audio Plugin", /* description */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
103 .init = vorbis_init, /* init */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
104 .about = vorbis_aboutbox, /* aboutbox */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
105 .configure = vorbis_configure, /* configure */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
106 .play_file = vorbis_play, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
107 .stop = vorbis_stop, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
108 .pause = vorbis_pause, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
109 .seek = vorbis_seek, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
110 .cleanup = vorbis_cleanup, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
111 .get_song_tuple = get_song_tuple, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
112 .is_our_file_from_vfs = vorbis_check_fd, |
1979
839804c3b3a4
aud_vfs_extensions -> vfs_extensions, some vtable fixes
William Pitcock <nenolod@atheme.org>
parents:
1978
diff
changeset
|
113 .vfs_extensions = vorbis_fmts, |
2208
201a47338baf
vorbis: removed fileinfo dialog, switched to mowgli_dictionary, some fixes
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2191
diff
changeset
|
114 .update_song_tuple = vorbis_update_song_tuple, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
115 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
116 |
1078 | 117 InputPlugin *vorbis_iplist[] = { &vorbis_ip, NULL }; |
118 | |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1373
diff
changeset
|
119 DECLARE_PLUGIN(vorbis, NULL, NULL, vorbis_iplist, NULL, NULL, NULL, NULL, NULL); |
1078 | 120 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
121 static OggVorbis_File vf; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
122 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
123 static GThread *thread; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 static volatile int seekneeded = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 static int samplerate, channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 GMutex *vf_mutex; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 gchar **vorbis_tag_encoding_list = NULL; |
2191
329267b09658
get rid of talking with GDK directly
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2134
diff
changeset
|
129 static GtkWidget *about_window; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
130 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
131 static int |
475 | 132 vorbis_check_fd(char *filename, VFSFile *stream) |
133 { | |
134 OggVorbis_File vfile; /* avoid thread interaction */ | |
135 gint result; | |
478 | 136 VFSVorbisFile *fd; |
137 | |
138 fd = g_new0(VFSVorbisFile, 1); | |
139 fd->fd = stream; | |
140 fd->probe = TRUE; | |
475 | 141 |
142 /* | |
143 * The open function performs full stream detection and machine | |
144 * initialization. If it returns zero, the stream *is* Vorbis and | |
145 * we're fully ready to decode. | |
146 */ | |
147 | |
148 /* libvorbisfile isn't thread safe... */ | |
149 memset(&vfile, 0, sizeof(vfile)); | |
150 g_mutex_lock(vf_mutex); | |
151 | |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
152 result = ov_test_callbacks(fd, &vfile, NULL, 0, aud_vfs_is_streaming(stream) ? vorbis_callbacks_stream : vorbis_callbacks); |
475 | 153 |
154 switch (result) { | |
155 case OV_EREAD: | |
156 #ifdef DEBUG | |
157 g_message("** vorbis.c: Media read error: %s", filename); | |
158 #endif | |
159 g_mutex_unlock(vf_mutex); | |
160 return FALSE; | |
161 break; | |
162 case OV_ENOTVORBIS: | |
163 #ifdef DEBUG | |
164 g_message("** vorbis.c: Not Vorbis data: %s", filename); | |
165 #endif | |
166 g_mutex_unlock(vf_mutex); | |
167 return FALSE; | |
168 break; | |
169 case OV_EVERSION: | |
170 #ifdef DEBUG | |
171 g_message("** vorbis.c: Version mismatch: %s", filename); | |
172 #endif | |
173 g_mutex_unlock(vf_mutex); | |
174 return FALSE; | |
175 break; | |
176 case OV_EBADHEADER: | |
177 #ifdef DEBUG | |
178 g_message("** vorbis.c: Invalid Vorbis bistream header: %s", | |
179 filename); | |
180 #endif | |
181 g_mutex_unlock(vf_mutex); | |
182 return FALSE; | |
183 break; | |
184 case OV_EFAULT: | |
185 #ifdef DEBUG | |
186 g_message("** vorbis.c: Internal logic fault while reading %s", | |
187 filename); | |
188 #endif | |
189 g_mutex_unlock(vf_mutex); | |
190 return FALSE; | |
191 break; | |
192 case 0: | |
193 break; | |
194 default: | |
195 break; | |
196 } | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
197 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 ov_clear(&vfile); /* once the ov_open succeeds, the stream belongs to |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 vorbisfile.a. ov_clear will fclose it */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 return TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
205 vorbis_jump_to_time(InputPlayback *playback, long time) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
207 g_mutex_lock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
208 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
209 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
210 * We need to guard against seeking to the end, or things |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
211 * don't work right. Instead, just seek to one second prior |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
212 * to this |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 if (time == ov_time_total(&vf, -1)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 time--; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
217 playback->output->flush(time * 1000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 ov_time_seek(&vf, time); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
221 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
222 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
224 do_seek(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
225 { |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
226 if (seekneeded != -1) { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
227 vorbis_jump_to_time(playback, seekneeded); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 seekneeded = -1; |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
229 playback->eof = FALSE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
231 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
233 #define PCM_FRAMES 1024 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
234 #define PCM_BUFSIZE PCM_FRAMES*2 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
235 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 static gpointer |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 vorbis_play_loop(gpointer arg) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
239 InputPlayback *playback = arg; |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
240 char *filename = playback->filename; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 gchar *title = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 double time; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 long timercount = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 vorbis_info *vi; |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
245 gint br; |
478 | 246 VFSVorbisFile *fd = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 int last_section = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 VFSFile *stream = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 void *datasource = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
253 /*gboolean use_rg; |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
254 /float rg_scale = 1.0;*/ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
255 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
256 ReplayGainInfo rg_info; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 memset(&vf, 0, sizeof(vf)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 |
1978 | 260 if ((stream = aud_vfs_fopen(filename, "r")) == NULL) { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
261 playback->eof = TRUE; |
478 | 262 goto play_cleanup; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
263 } |
478 | 264 |
265 fd = g_new0(VFSVorbisFile, 1); | |
266 fd->fd = stream; | |
267 datasource = (void *) fd; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
269 /*char pcmout[4096];*/ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
270 float pcmout[PCM_BUFSIZE*sizeof(float)]; |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
271 int bytes; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
272 float **pcm; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
273 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 * The open function performs full stream detection and |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 * machine initialization. None of the rest of ov_xx() works |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 * without it |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
278 * |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
279 * A vorbis physical bitstream may consist of many logical |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
280 * sections (information for each of which may be fetched from |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
281 * the vf structure). This value is filled in by ov_read to |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
282 * alert us what section we're currently decoding in case we |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
283 * need to change playback settings at a section boundary |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
285 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
286 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 g_mutex_lock(vf_mutex); |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
288 if (ov_open_callbacks(datasource, &vf, NULL, 0, aud_vfs_is_streaming(fd->fd) ? vorbis_callbacks_stream : vorbis_callbacks) < 0) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 vorbis_callbacks.close_func(datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 g_mutex_unlock(vf_mutex); |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
291 playback->eof = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 vi = ov_info(&vf, -1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
296 if (aud_vfs_is_streaming(fd->fd)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 time = -1; |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
298 else |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
299 time = ov_time_total(&vf, -1) * 1000; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
300 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 if (vi->channels > 2) { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
302 playback->eof = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
307 title = vorbis_generate_title(&vf, filename); |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
308 vorbis_update_replaygain(&rg_info); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
309 playback->set_replaygain_info(playback, &rg_info); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
310 |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
311 vi = ov_info(&vf, -1); |
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
312 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 samplerate = vi->rate; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 channels = vi->channels; |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
315 br = vi->bitrate_nominal; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 |
1987 | 319 playback->set_params(playback, title, time, br, samplerate, channels); |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
320 if (!playback->output->open_audio(FMT_FLOAT, vi->rate, vi->channels)) { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
321 playback->error = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 seekneeded = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 * Note that chaining changes things here; A vorbis file may |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 * be a mix of different channels, bitrates and sample rates. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 * You can fetch the information for any section of the file |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 * using the ov_ interface. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
333 |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
334 while (playback->playing) { |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
335 |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
336 if (playback->eof) { |
1676
aee4ebea943a
xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents:
1618
diff
changeset
|
337 g_usleep(20000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
341 if (seekneeded != -1) |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
342 do_seek(playback); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
343 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
344 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
345 int current_section = last_section; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
347 g_mutex_lock(vf_mutex); |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
348 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
349 bytes = ov_read_float(&vf, &pcm, PCM_FRAMES, ¤t_section); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
350 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
351 if (bytes > 0) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
352 bytes = vorbis_interleave_buffer(pcm, bytes, channels, pcmout); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
353 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
354 /* |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
355 * We got some sort of error. Bail. |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
356 */ |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
357 if (bytes <= 0 && bytes != OV_HOLE) { |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
358 /* |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
359 * EOF |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
360 */ |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
361 AUDDBG("EOF\n"); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
362 playback->playing = 0; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
363 playback->eof = TRUE; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
364 current_section = last_section; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
365 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
366 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
367 if (current_section <= last_section) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
368 /* |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
369 * The info struct is different in each section. vf |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
370 * holds them all for the given bitstream. This |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
371 * requests the current one |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
372 */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
373 vorbis_info *vi = ov_info(&vf, -1); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
374 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
375 if (vi->channels > 2) { |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
376 playback->eof = TRUE; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
377 g_mutex_unlock(vf_mutex); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
378 goto stop_processing; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
379 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
380 |
533
2fa253251598
[svn] - fix uninitialized value conditional jump, maybe it will help
nenolod
parents:
527
diff
changeset
|
381 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
382 if (vi->rate != samplerate || vi->channels != channels) { |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
383 samplerate = vi->rate; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
384 channels = vi->channels; |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
385 while(playback->output->buffer_playing()) g_usleep(50000); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
386 playback->output->close_audio(); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
387 if (!playback->output-> |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
388 open_audio(FMT_FLOAT, vi->rate, vi->channels)) { |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
389 playback->error = TRUE; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
390 playback->eof = TRUE; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
391 g_mutex_unlock(vf_mutex); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
392 goto stop_processing; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
393 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
394 playback->output->flush(ov_time_tell(&vf) * 1000); |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
395 vorbis_update_replaygain(&rg_info); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
396 playback->set_replaygain_info(playback, &rg_info); /* audio reopened */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
397 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
398 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
400 g_mutex_unlock(vf_mutex); |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
401 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
402 playback->pass_audio(playback, FMT_FLOAT, channels, bytes, pcmout, &playback->playing); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
404 if (!playback->playing) |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
405 goto stop_processing; |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
406 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
407 if (seekneeded != -1) |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
408 do_seek(playback); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
410 stop_processing: |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
411 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
412 if (current_section <= last_section) { |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
413 /* |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
414 * set total play time, bitrate, rate, and channels of |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
415 * current section |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
416 */ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
417 if (title) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
418 g_free(title); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
419 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
420 g_mutex_lock(vf_mutex); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
421 title = vorbis_generate_title(&vf, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
423 if (time != -1) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
424 time = ov_time_total(&vf, -1) * 1000; |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
425 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
426 g_mutex_unlock(vf_mutex); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
427 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
428 playback->set_params(playback, title, time, br, samplerate, channels); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
429 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
430 timercount = playback->output->output_time(); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
431 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
432 last_section = current_section; |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
433 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
434 } |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
435 } /* main loop */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
436 |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
437 if (!playback->error) { |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
438 /*this loop makes it not skip the last ~4 seconds, but the playback |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
439 * timer isn't updated in this period, so it still needs a bit of work |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
440 * |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
441 * majeru |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
442 */ |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
443 if(playback->eof) /* do it only on EOF --asphyx */ |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
444 while(playback->output->buffer_playing()) { |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
445 AUDDBG("waiting for empty output buffer\n"); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
446 g_usleep(50000); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
447 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
448 |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
449 playback->output->close_audio(); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
450 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
452 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
453 play_cleanup: |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
454 g_free(title); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
455 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
456 /* |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
457 * ov_clear closes the stream if its open. Safe to call on an |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
458 * uninitialized structure as long as we've zeroed it |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
459 */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
460 g_mutex_lock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
461 ov_clear(&vf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 g_mutex_unlock(vf_mutex); |
1373
85ffec632924
Use InputPlayback.playing properly.
William Pitcock <nenolod@atheme-project.org>
parents:
1372
diff
changeset
|
463 playback->playing = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
464 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
467 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
468 vorbis_play(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
470 playback->playing = 1; |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
471 playback->eof = 0; |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
472 playback->error = FALSE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 |
1352
ab66f3ee7a11
vorbis: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1279
diff
changeset
|
474 thread = g_thread_self(); |
1447
195b5657303e
updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
Giacomo Lozito <james@develia.org>
parents:
1433
diff
changeset
|
475 playback->set_pb_ready(playback); |
1352
ab66f3ee7a11
vorbis: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1279
diff
changeset
|
476 vorbis_play_loop(playback); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
478 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
479 static void |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
480 vorbis_stop(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
482 if (playback->playing) { |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
483 playback->playing = 0; |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
484 AUDDBG("waiting for playback thread finished\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
485 g_thread_join(thread); |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
486 AUDDBG("playback finished\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
488 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
489 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
491 vorbis_pause(InputPlayback *playback, short p) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
493 playback->output->pause(p); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
495 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 static void |
559 | 497 vorbis_seek(InputPlayback *data, int time) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
499 seekneeded = time; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
500 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
501 while (seekneeded != -1) |
1676
aee4ebea943a
xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents:
1618
diff
changeset
|
502 g_usleep(20000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 } |
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 /* Make sure you've locked vf_mutex */ |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
506 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
507 static gboolean |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
508 vorbis_update_replaygain(ReplayGainInfo *rg_info) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
509 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
510 vorbis_comment *comment; |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
511 char *rg_gain = NULL, *rg_peak = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
512 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
513 if (rg_info == NULL || (comment = ov_comment(&vf, -1)) == NULL) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
514 return FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
515 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
516 rg_gain = vorbis_comment_query(comment, "replaygain_album_gain", 0); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
517 if (!rg_gain) rg_gain = vorbis_comment_query(comment, "rg_audiophile", 0); /* Old */ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
518 rg_info->album_gain = rg_gain != NULL ? atof(rg_gain) : 0.0; |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
519 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
520 rg_gain = vorbis_comment_query(comment, "replaygain_track_gain", 0); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
521 if (!rg_gain) rg_gain = vorbis_comment_query(comment, "rg_radio", 0); /* Old */ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
522 rg_info->track_gain = rg_gain != NULL ? atof(rg_gain) : 0.0; |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
523 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
524 rg_peak = vorbis_comment_query(comment, "replaygain_album_peak", 0); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
525 rg_info->album_peak = rg_peak != NULL ? atof(rg_peak) : 0.0; |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
526 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
527 rg_peak = vorbis_comment_query(comment, "replaygain_track_peak", 0); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
528 if (!rg_peak) rg_peak = vorbis_comment_query(comment, "rg_peak", 0); /* Old */ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
529 rg_info->track_peak = rg_peak != NULL ? atof(rg_peak) : 0.0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
530 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
531 return TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
532 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
533 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
534 static long |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
535 vorbis_interleave_buffer(float **pcm, int samples, int ch, float *pcmout) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
536 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
537 int i, j; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
538 for (i = 0; i < samples; i++) |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
539 for (j = 0; j < ch; j++) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
540 *pcmout++ = pcm[j][i]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
541 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
542 return ch * samples * sizeof(float); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
543 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
544 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
545 static void _aud_tuple_associate_string(Tuple *tuple, const gint nfield, const gchar *field, const gchar *string) |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
546 { |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
547 if (string) { |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
2033
diff
changeset
|
548 gchar *str = aud_str_to_utf8(string); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
549 aud_tuple_associate_string(tuple, nfield, field, str); |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
550 g_free(str); |
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
551 } |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
552 } |
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
553 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
554 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
555 * Ok, nhjm449! Are you *happy* now?! -nenolod |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
556 */ |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
557 static Tuple * |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
558 get_aud_tuple_for_vorbisfile(OggVorbis_File * vorbisfile, gchar *filename) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
559 { |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
560 VFSVorbisFile *vfd = (VFSVorbisFile *) vorbisfile->datasource; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
561 Tuple *tuple = NULL; |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
562 gint length; |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
563 vorbis_comment *comment = NULL; |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
564 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
565 tuple = aud_tuple_new_from_filename(filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
566 |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
567 if (aud_vfs_is_streaming(vfd->fd)) |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
568 length = -1; |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
569 else |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
570 length = ov_time_total(vorbisfile, -1) * 1000; |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
571 |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
572 /* associate with tuple */ |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
573 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length); |
2211
2a13a038987c
vorbis: bitrate field added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2210
diff
changeset
|
574 /* maybe, it would be better to display nominal bitrate (like in main win), not average? --eugene */ |
2a13a038987c
vorbis: bitrate field added
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2210
diff
changeset
|
575 aud_tuple_associate_int(tuple, FIELD_BITRATE, NULL, ov_bitrate(vorbisfile, -1)/1000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
576 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
577 if ((comment = ov_comment(vorbisfile, -1))) { |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
578 gchar *tmps; |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
579 _aud_tuple_associate_string(tuple, FIELD_TITLE, NULL, vorbis_comment_query(comment, "title", 0)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
580 _aud_tuple_associate_string(tuple, FIELD_ARTIST, NULL, vorbis_comment_query(comment, "artist", 0)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
581 _aud_tuple_associate_string(tuple, FIELD_ALBUM, NULL, vorbis_comment_query(comment, "album", 0)); |
2106 | 582 _aud_tuple_associate_string(tuple, FIELD_DATE, NULL, vorbis_comment_query(comment, "date", 0)); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
583 _aud_tuple_associate_string(tuple, FIELD_GENRE, NULL, vorbis_comment_query(comment, "genre", 0)); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
584 _aud_tuple_associate_string(tuple, FIELD_COMMENT, NULL, vorbis_comment_query(comment, "comment", 0)); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
585 |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
586 if ((tmps = vorbis_comment_query(comment, "tracknumber", 0)) != NULL) |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
587 aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, atoi(tmps)); |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
588 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
589 |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
590 aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, "lossy"); |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
591 |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
592 if (comment && comment->vendor) |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
593 { |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
594 gchar *codec = g_strdup_printf("Ogg Vorbis [%s]", comment->vendor); |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
595 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, codec); |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
596 g_free(codec); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
597 } |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
598 else |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
599 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, "Ogg Vorbis"); |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
600 |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
601 aud_tuple_associate_string(tuple, FIELD_MIMETYPE, NULL, "application/ogg"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
602 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
603 return tuple; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
604 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
605 |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
606 static Tuple * |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
607 get_song_tuple(gchar *filename) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
608 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
609 VFSFile *stream = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
610 OggVorbis_File vfile; /* avoid thread interaction */ |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
611 Tuple *tuple = NULL; |
481 | 612 VFSVorbisFile *fd = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
613 |
1978 | 614 if ((stream = aud_vfs_fopen(filename, "r")) == NULL) |
481 | 615 return NULL; |
616 | |
617 fd = g_new0(VFSVorbisFile, 1); | |
618 fd->fd = stream; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
619 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
620 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
621 * The open function performs full stream detection and |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
622 * machine initialization. If it returns zero, the stream |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
623 * *is* Vorbis and we're fully ready to decode. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
624 */ |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
625 if (ov_open_callbacks(fd, &vfile, NULL, 0, aud_vfs_is_streaming(stream) ? vorbis_callbacks_stream : vorbis_callbacks) < 0) { |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
626 aud_vfs_fclose(stream); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
627 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
628 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
629 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
630 tuple = get_aud_tuple_for_vorbisfile(&vfile, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
631 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 * once the ov_open succeeds, the stream belongs to |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
634 * vorbisfile.a. ov_clear will fclose it |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 ov_clear(&vfile); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
637 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 return tuple; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
639 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
640 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
641 static gchar * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
642 vorbis_generate_title(OggVorbis_File * vorbisfile, gchar * filename) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
643 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
644 /* Caller should hold vf_mutex */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
645 gchar *displaytitle = NULL; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
646 Tuple *input; |
545
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
647 gchar *tmp; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
648 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
649 input = get_aud_tuple_for_vorbisfile(vorbisfile, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
650 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
651 displaytitle = aud_tuple_formatter_make_title_string(input, vorbis_cfg.tag_override ? |
2055 | 652 vorbis_cfg.tag_format : aud_get_gentitle_format()); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
653 |
1978 | 654 if ((tmp = aud_vfs_get_metadata(((VFSVorbisFile *) vorbisfile->datasource)->fd, "stream-name")) != NULL) |
545
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
655 { |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
656 gchar *old = displaytitle; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
657 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
658 aud_tuple_associate_string(input, -1, "stream", tmp); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
659 aud_tuple_associate_string(input, FIELD_TITLE, NULL, old); |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
660 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
661 displaytitle = aud_tuple_formatter_process_string(input, "${?title:${title}}${?stream: (${stream})}"); |
545
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
662 |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
663 g_free(old); |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
664 g_free(tmp); |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
665 } |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
666 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
667 aud_tuple_free(input); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
668 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
669 return displaytitle; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
670 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
671 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
672 static void |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
673 vorbis_aboutbox(void) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
674 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
675 if (about_window) |
2191
329267b09658
get rid of talking with GDK directly
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2134
diff
changeset
|
676 gtk_window_present(GTK_WINDOW(about_window)); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
677 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
678 { |
1677
f6f5603a0954
xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents:
1676
diff
changeset
|
679 about_window = audacious_info_dialog(_("About Ogg Vorbis Audio Plugin"), |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
680 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
681 * I18N: UTF-8 Translation: "Haavard Kvaalen" -> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
682 * "H\303\245vard Kv\303\245len" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
683 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
684 _ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
685 ("Ogg Vorbis Plugin by the Xiph.org Foundation\n\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
686 "Original code by\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
687 "Tony Arcieri <bascule@inferno.tusculum.edu>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
688 "Contributions from\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
689 "Chris Montgomery <monty@xiph.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
690 "Peter Alm <peter@xmms.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
691 "Michael Smith <msmith@labyrinth.edu.au>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
692 "Jack Moffitt <jack@icecast.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
693 "Jorn Baayen <jorn@nl.linux.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
694 "Haavard Kvaalen <havardk@xmms.org>\n" |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
695 "Gian-Carlo Pascutto <gcp@sjeng.org>\n" |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
696 "Eugene Zagidullin <e.asphyx@gmail.com>\n\n" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
697 "Visit the Xiph.org Foundation at http://www.xiph.org/\n"), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
698 _("Ok"), FALSE, NULL, NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
699 g_signal_connect(G_OBJECT(about_window), "destroy", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
700 G_CALLBACK(gtk_widget_destroyed), &about_window); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
701 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
702 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
703 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
704 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
705 static void |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
706 vorbis_init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
707 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2496
diff
changeset
|
708 mcs_handle_t *db; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
709 gchar *tmp = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
710 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
711 memset(&vorbis_cfg, 0, sizeof(vorbis_config_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
712 vorbis_cfg.http_buffer_size = 128; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
713 vorbis_cfg.http_prebuffer = 25; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
714 vorbis_cfg.proxy_port = 8080; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
715 vorbis_cfg.proxy_use_auth = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
716 vorbis_cfg.proxy_user = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
717 vorbis_cfg.proxy_pass = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
718 vorbis_cfg.tag_override = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
719 vorbis_cfg.tag_format = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
720 |
2124 | 721 db = aud_cfg_db_open(); |
722 aud_cfg_db_get_int(db, "vorbis", "http_buffer_size", | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
723 &vorbis_cfg.http_buffer_size); |
2124 | 724 aud_cfg_db_get_int(db, "vorbis", "http_prebuffer", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
725 &vorbis_cfg.http_prebuffer); |
2124 | 726 aud_cfg_db_get_bool(db, "vorbis", "save_http_stream", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
727 &vorbis_cfg.save_http_stream); |
2124 | 728 if (!aud_cfg_db_get_string(db, "vorbis", "save_http_path", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
729 &vorbis_cfg.save_http_path)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
730 vorbis_cfg.save_http_path = g_strdup(g_get_home_dir()); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
731 |
2124 | 732 aud_cfg_db_get_bool(db, "vorbis", "tag_override", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
733 &vorbis_cfg.tag_override); |
2124 | 734 if (!aud_cfg_db_get_string(db, "vorbis", "tag_format", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
735 &vorbis_cfg.tag_format)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
736 vorbis_cfg.tag_format = g_strdup("%p - %t"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
737 |
2124 | 738 aud_cfg_db_get_bool(db, NULL, "use_proxy", &vorbis_cfg.use_proxy); |
739 aud_cfg_db_get_string(db, NULL, "proxy_host", &vorbis_cfg.proxy_host); | |
740 aud_cfg_db_get_string(db, NULL, "proxy_port", &tmp); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
741 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
742 if (tmp != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
743 vorbis_cfg.proxy_port = atoi(tmp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
744 |
2124 | 745 aud_cfg_db_get_bool(db, NULL, "proxy_use_auth", &vorbis_cfg.proxy_use_auth); |
746 aud_cfg_db_get_string(db, NULL, "proxy_user", &vorbis_cfg.proxy_user); | |
747 aud_cfg_db_get_string(db, NULL, "proxy_pass", &vorbis_cfg.proxy_pass); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
748 |
2124 | 749 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
750 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
751 vf_mutex = g_mutex_new(); |
2032
55f2fd232291
associate with application/ogg mimetype.
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
752 |
55f2fd232291
associate with application/ogg mimetype.
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
753 aud_mime_set_plugin("application/ogg", &vorbis_ip); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
754 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
755 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
756 static void |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
757 vorbis_cleanup(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
758 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
759 if (vorbis_cfg.save_http_path) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
760 free(vorbis_cfg.save_http_path); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
761 vorbis_cfg.save_http_path = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
762 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
763 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
764 if (vorbis_cfg.proxy_host) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
765 free(vorbis_cfg.proxy_host); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
766 vorbis_cfg.proxy_host = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
767 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
768 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
769 if (vorbis_cfg.proxy_user) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
770 free(vorbis_cfg.proxy_user); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
771 vorbis_cfg.proxy_user = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
772 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
773 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
774 if (vorbis_cfg.proxy_pass) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
775 free(vorbis_cfg.proxy_pass); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
776 vorbis_cfg.proxy_pass = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
777 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
778 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
779 if (vorbis_cfg.tag_format) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
780 free(vorbis_cfg.tag_format); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
781 vorbis_cfg.tag_format = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
782 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
783 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
784 if (vorbis_cfg.title_encoding) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
785 free(vorbis_cfg.title_encoding); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
786 vorbis_cfg.title_encoding = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
787 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
788 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
789 g_strfreev(vorbis_tag_encoding_list); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
790 g_mutex_free(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
791 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
792 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
793 static size_t |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
794 ovcb_read(void *ptr, size_t size, size_t nmemb, void *datasource) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
795 { |
478 | 796 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
797 |
1978 | 798 return aud_vfs_fread(ptr, size, nmemb, handle->fd); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
799 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
800 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
801 static int |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
802 ovcb_seek(void *datasource, int64_t offset, int whence) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
803 { |
478 | 804 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
805 | |
1978 | 806 return aud_vfs_fseek(handle->fd, offset, whence); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
807 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
808 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
809 static int |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
810 ovcb_close(void *datasource) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
811 { |
478 | 812 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
813 | |
814 gint ret = 0; | |
815 | |
816 if (handle->probe == FALSE) | |
817 { | |
1978 | 818 ret = aud_vfs_fclose(handle->fd); |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
819 /* g_free(handle); it causes double free. i'm not really sure that commenting out at here is correct. --yaz*/ |
478 | 820 } |
821 | |
822 return ret; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
823 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
824 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
825 static long |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
826 ovcb_tell(void *datasource) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
827 { |
478 | 828 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
829 | |
1978 | 830 return aud_vfs_ftell(handle->fd); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
831 } |