Mercurial > audlegacy-plugins
annotate src/vorbis/vorbis.c @ 3085:ac0af6b39272
Introduce new GIO plugin to buildsystem. stdio is now deprecated.
Thoughts:
- getc()/ungetc() should be moved to VFS core now
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Wed, 29 Apr 2009 20:58:36 -0500 |
parents | b13c904dcd40 |
children |
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 |
2971
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2576
diff
changeset
|
55 #include <audlegacy/plugin.h> |
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2576
diff
changeset
|
56 #include <audlegacy/output.h> |
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2576
diff
changeset
|
57 #include <audlegacy/i18n.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 #include "vorbis.h" |
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 extern vorbis_config_t vorbis_cfg; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
63 static Tuple *get_song_tuple(gchar *filename); |
475 | 64 static int vorbis_check_fd(char *filename, VFSFile *stream); |
559 | 65 static void vorbis_play(InputPlayback *data); |
66 static void vorbis_stop(InputPlayback *data); | |
67 static void vorbis_pause(InputPlayback *data, short p); | |
68 static void vorbis_seek(InputPlayback *data, int time); | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 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
|
70 static void vorbis_aboutbox(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 static void vorbis_init(void); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 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
|
73 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
|
74 float *pcmout); |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
75 static gboolean vorbis_update_replaygain(ReplayGainInfo *rg_info); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 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
|
78 void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 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
|
80 static int ovcb_close(void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 static long ovcb_tell(void *datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 ov_callbacks vorbis_callbacks = { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 ovcb_read, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 ovcb_seek, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 ovcb_close, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 ovcb_tell |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
90 ov_callbacks vorbis_callbacks_stream = { |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
91 ovcb_read, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
92 NULL, |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
93 ovcb_close, |
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 }; |
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
96 |
2994
732c4cb24aec
xiph.org sucks, add .oga to allowed extensions list.
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
97 gchar *vorbis_fmts[] = { "ogg", "ogm", "oga", NULL }; |
375 | 98 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
99 InputPlugin vorbis_ip = { |
1618
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
100 .description = "Ogg Vorbis Audio Plugin", /* description */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
101 .init = vorbis_init, /* init */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
102 .about = vorbis_aboutbox, /* aboutbox */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
103 .configure = vorbis_configure, /* configure */ |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
104 .play_file = vorbis_play, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
105 .stop = vorbis_stop, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
106 .pause = vorbis_pause, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
107 .seek = vorbis_seek, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
108 .cleanup = vorbis_cleanup, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
109 .get_song_tuple = get_song_tuple, |
177aec41b238
vorbis: C99 initialisers
William Pitcock <nenolod@atheme.org>
parents:
1489
diff
changeset
|
110 .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
|
111 .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
|
112 .update_song_tuple = vorbis_update_song_tuple, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 }; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 |
1078 | 115 InputPlugin *vorbis_iplist[] = { &vorbis_ip, NULL }; |
116 | |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1373
diff
changeset
|
117 DECLARE_PLUGIN(vorbis, NULL, NULL, vorbis_iplist, NULL, NULL, NULL, NULL, NULL); |
1078 | 118 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 static OggVorbis_File vf; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
120 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
121 static GThread *thread; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
122 static volatile int seekneeded = -1; |
3000
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
123 static volatile char pause_flag; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 static int samplerate, channels; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 GMutex *vf_mutex; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 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
|
128 static GtkWidget *about_window; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
129 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
130 static int |
475 | 131 vorbis_check_fd(char *filename, VFSFile *stream) |
132 { | |
133 OggVorbis_File vfile; /* avoid thread interaction */ | |
134 gint result; | |
478 | 135 VFSVorbisFile *fd; |
136 | |
137 fd = g_new0(VFSVorbisFile, 1); | |
138 fd->fd = stream; | |
139 fd->probe = TRUE; | |
475 | 140 |
141 /* | |
142 * The open function performs full stream detection and machine | |
143 * initialization. If it returns zero, the stream *is* Vorbis and | |
144 * we're fully ready to decode. | |
145 */ | |
146 | |
147 /* libvorbisfile isn't thread safe... */ | |
148 memset(&vfile, 0, sizeof(vfile)); | |
149 g_mutex_lock(vf_mutex); | |
150 | |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
151 result = ov_test_callbacks(fd, &vfile, NULL, 0, aud_vfs_is_streaming(stream) ? vorbis_callbacks_stream : vorbis_callbacks); |
475 | 152 |
153 switch (result) { | |
154 case OV_EREAD: | |
155 #ifdef DEBUG | |
156 g_message("** vorbis.c: Media read error: %s", filename); | |
157 #endif | |
158 g_mutex_unlock(vf_mutex); | |
159 return FALSE; | |
160 break; | |
161 case OV_ENOTVORBIS: | |
162 #ifdef DEBUG | |
163 g_message("** vorbis.c: Not Vorbis data: %s", filename); | |
164 #endif | |
165 g_mutex_unlock(vf_mutex); | |
166 return FALSE; | |
167 break; | |
168 case OV_EVERSION: | |
169 #ifdef DEBUG | |
170 g_message("** vorbis.c: Version mismatch: %s", filename); | |
171 #endif | |
172 g_mutex_unlock(vf_mutex); | |
173 return FALSE; | |
174 break; | |
175 case OV_EBADHEADER: | |
176 #ifdef DEBUG | |
177 g_message("** vorbis.c: Invalid Vorbis bistream header: %s", | |
178 filename); | |
179 #endif | |
180 g_mutex_unlock(vf_mutex); | |
181 return FALSE; | |
182 break; | |
183 case OV_EFAULT: | |
184 #ifdef DEBUG | |
185 g_message("** vorbis.c: Internal logic fault while reading %s", | |
186 filename); | |
187 #endif | |
188 g_mutex_unlock(vf_mutex); | |
189 return FALSE; | |
190 break; | |
191 case 0: | |
192 break; | |
193 default: | |
194 break; | |
195 } | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
196 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
197 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
|
198 vorbisfile.a. ov_clear will fclose it */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 return TRUE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 } |
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 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
204 vorbis_jump_to_time(InputPlayback *playback, long time) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
205 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 g_mutex_lock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
207 |
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 * 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
|
210 * 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
|
211 * to this |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
212 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
213 if (time == ov_time_total(&vf, -1)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
214 time--; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
216 playback->output->flush(time * 1000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 ov_time_seek(&vf, time); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
220 } |
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 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
223 do_seek(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
224 { |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
225 if (seekneeded != -1) { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
226 vorbis_jump_to_time(playback, seekneeded); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
227 seekneeded = -1; |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
228 playback->eof = FALSE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 } |
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 |
3000
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
232 static void do_pause (InputPlayback * playback) { |
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
233 playback->output->pause (1); |
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
234 while (pause_flag) { |
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
235 if (seekneeded != -1) |
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
236 do_seek (playback); |
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
237 g_usleep(50000); |
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
238 } |
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
239 playback->output->pause (0); |
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
240 } |
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
241 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
242 #define PCM_FRAMES 1024 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
243 #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
|
244 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 static gpointer |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 vorbis_play_loop(gpointer arg) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 { |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
248 InputPlayback *playback = arg; |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
249 char *filename = playback->filename; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 gchar *title = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 double time; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 long timercount = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 vorbis_info *vi; |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
254 gint br; |
478 | 255 VFSVorbisFile *fd = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 int last_section = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 VFSFile *stream = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 void *datasource = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
262 /*gboolean use_rg; |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
263 /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
|
264 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
265 ReplayGainInfo rg_info; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
267 memset(&vf, 0, sizeof(vf)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 |
1978 | 269 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
|
270 playback->eof = TRUE; |
478 | 271 goto play_cleanup; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 } |
478 | 273 |
274 fd = g_new0(VFSVorbisFile, 1); | |
275 fd->fd = stream; | |
276 datasource = (void *) fd; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
278 /*char pcmout[4096];*/ |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
279 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
|
280 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
|
281 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
|
282 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
283 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 * The open function performs full stream detection and |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 * 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
|
286 * 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
|
287 * |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
288 * 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
|
289 * 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
|
290 * 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
|
291 * 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
|
292 * 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
|
293 */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
294 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
295 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 g_mutex_lock(vf_mutex); |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
297 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
|
298 vorbis_callbacks.close_func(datasource); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 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
|
300 playback->eof = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 vi = ov_info(&vf, -1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
305 if (aud_vfs_is_streaming(fd->fd)) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 time = -1; |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
307 else |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
308 time = ov_time_total(&vf, -1) * 1000; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 if (vi->channels > 2) { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
311 playback->eof = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 goto play_cleanup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
316 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
|
317 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
|
318 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
|
319 |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
320 vi = ov_info(&vf, -1); |
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
321 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 samplerate = vi->rate; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 channels = vi->channels; |
1372
495825028a70
Division by 1000 is not necessary.
William Pitcock <nenolod@atheme-project.org>
parents:
1370
diff
changeset
|
324 br = vi->bitrate_nominal; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 g_mutex_unlock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 |
1987 | 328 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
|
329 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
|
330 playback->error = TRUE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 goto play_cleanup; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 seekneeded = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
336 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 * 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
|
338 * 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
|
339 * 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
|
340 * using the ov_ interface. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
342 |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
343 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
|
344 |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
345 if (playback->eof) { |
1676
aee4ebea943a
xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents:
1618
diff
changeset
|
346 g_usleep(20000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
347 continue; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
350 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
|
351 do_seek(playback); |
3000
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
352 if (pause_flag) |
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
353 do_pause (playback); |
2329
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 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
356 int current_section = last_section; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
357 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
358 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
|
359 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
360 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
|
361 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
362 if (bytes > 0) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
363 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
|
364 |
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 * 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
|
367 */ |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
368 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
|
369 /* |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
370 * EOF |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
371 */ |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
372 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
|
373 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
|
374 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
|
375 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
|
376 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
377 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
378 if (current_section <= last_section) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 /* |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
380 * 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
|
381 * 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
|
382 * requests the current one |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
383 */ |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
384 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
|
385 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
386 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
|
387 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
|
388 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
|
389 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
|
390 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
391 |
533
2fa253251598
[svn] - fix uninitialized value conditional jump, maybe it will help
nenolod
parents:
527
diff
changeset
|
392 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
393 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
|
394 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
|
395 channels = vi->channels; |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
396 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
|
397 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
|
398 if (!playback->output-> |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
399 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
|
400 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
|
401 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
|
402 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
|
403 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
|
404 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
405 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
|
406 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
|
407 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
|
408 } |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
409 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
410 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
411 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
|
412 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
413 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
|
414 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
415 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
|
416 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
|
417 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
418 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
|
419 do_seek(playback); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
421 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
|
422 |
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
423 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
|
424 /* |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
425 * 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
|
426 * current section |
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 if (title) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
429 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
|
430 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
431 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
|
432 title = vorbis_generate_title(&vf, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
433 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
434 if (time != -1) |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
435 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
|
436 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
437 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
|
438 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
439 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
|
440 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
441 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
|
442 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
443 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
|
444 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
445 } |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
446 } /* 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
|
447 |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
448 if (!playback->error) { |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
449 /*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
|
450 * 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
|
451 * |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
452 * majeru |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
453 */ |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
454 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
|
455 while(playback->output->buffer_playing()) { |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
456 AUDDBG("waiting for empty output buffer\n"); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
457 g_usleep(50000); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
458 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
459 |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
460 playback->output->close_audio(); |
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
461 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 |
2329
7b38e28464ee
Modified the playback loop to fix the last seconds skip (fixes bug #87)
Cristi Magherusan <majeru@atheme.org>
parents:
2212
diff
changeset
|
463 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
464 play_cleanup: |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
465 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
|
466 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
467 /* |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
468 * 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
|
469 * 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
|
470 */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 g_mutex_lock(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 ov_clear(&vf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 g_mutex_unlock(vf_mutex); |
1373
85ffec632924
Use InputPlayback.playing properly.
William Pitcock <nenolod@atheme-project.org>
parents:
1372
diff
changeset
|
474 playback->playing = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 return NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 } |
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 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
479 vorbis_play(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
481 playback->playing = 1; |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
482 playback->eof = 0; |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
483 playback->error = FALSE; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 |
1352
ab66f3ee7a11
vorbis: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1279
diff
changeset
|
485 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
|
486 playback->set_pb_ready(playback); |
1352
ab66f3ee7a11
vorbis: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1279
diff
changeset
|
487 vorbis_play_loop(playback); |
0
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 |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
491 vorbis_stop(InputPlayback *playback) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 { |
564
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
493 if (playback->playing) { |
6b959c9914a7
[svn] Fix a dumb mistake, and also use generic flags and get_time.
iabervon
parents:
561
diff
changeset
|
494 playback->playing = 0; |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
495 AUDDBG("waiting for playback thread finished\n"); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 g_thread_join(thread); |
2375
22641735c9b1
- fixed freezing on track end
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2351
diff
changeset
|
497 AUDDBG("playback finished\n"); |
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 } |
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 static void |
561
914c96de3244
[svn] Convert plugins to use InputPlayback.output instead of InputPlugin.output
iabervon
parents:
559
diff
changeset
|
502 vorbis_pause(InputPlayback *playback, short p) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 { |
3000
b13c904dcd40
Patch from John Lindgren <john.lindgren@tds.net> to support seeking whilst paused, Debian bug #517692.
Tony Vroon <chainsaw@gentoo.org>
parents:
2994
diff
changeset
|
504 pause_flag = p; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
505 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
506 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
507 static void |
559 | 508 vorbis_seek(InputPlayback *data, int time) |
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 seekneeded = time; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
511 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
512 while (seekneeded != -1) |
1676
aee4ebea943a
xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents:
1618
diff
changeset
|
513 g_usleep(20000); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
514 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
515 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
516 /* 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
|
517 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
518 static gboolean |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
519 vorbis_update_replaygain(ReplayGainInfo *rg_info) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
520 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
521 vorbis_comment *comment; |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
522 char *rg_gain = NULL, *rg_peak = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
523 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
524 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
|
525 return FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
526 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
527 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
|
528 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
|
529 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
|
530 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
531 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
|
532 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
|
533 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
|
534 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
535 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
|
536 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
|
537 |
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
538 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
|
539 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
|
540 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
|
541 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
542 return TRUE; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
545 static long |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
546 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
|
547 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
548 int i, j; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
549 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
|
550 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
|
551 *pcmout++ = pcm[j][i]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
552 |
2351
db02ad480056
vorbis switched to floating-point output. RG stuff removed
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2329
diff
changeset
|
553 return ch * samples * sizeof(float); |
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 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
556 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
|
557 { |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
558 if (string) { |
2050
2ffc6a69fcd1
string API calls -> vtable
William Pitcock <nenolod@atheme.org>
parents:
2033
diff
changeset
|
559 gchar *str = aud_str_to_utf8(string); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
560 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
|
561 g_free(str); |
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
562 } |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
563 } |
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
564 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
565 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
566 * Ok, nhjm449! Are you *happy* now?! -nenolod |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
567 */ |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
568 static Tuple * |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
569 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
|
570 { |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
571 VFSVorbisFile *vfd = (VFSVorbisFile *) vorbisfile->datasource; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
572 Tuple *tuple = NULL; |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
573 gint length; |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
574 vorbis_comment *comment = NULL; |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
575 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
576 tuple = aud_tuple_new_from_filename(filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
577 |
2134
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
578 if (aud_vfs_is_streaming(vfd->fd)) |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
579 length = -1; |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
580 else |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
581 length = ov_time_total(vorbisfile, -1) * 1000; |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
582 |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
583 /* associate with tuple */ |
fd0d5615f674
Fix seeking for non-streamed files.
William Pitcock <nenolod@atheme.org>
parents:
2133
diff
changeset
|
584 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
|
585 /* 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
|
586 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
|
587 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
588 if ((comment = ov_comment(vorbisfile, -1))) { |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
589 gchar *tmps; |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
590 _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
|
591 _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
|
592 _aud_tuple_associate_string(tuple, FIELD_ALBUM, NULL, vorbis_comment_query(comment, "album", 0)); |
2106 | 593 _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
|
594 _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
|
595 _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
|
596 |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
597 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
|
598 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
|
599 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
600 |
2212
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_QUALITY, NULL, "lossy"); |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1489
diff
changeset
|
602 |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
603 if (comment && comment->vendor) |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
604 { |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
605 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
|
606 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
|
607 g_free(codec); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
608 } |
2212
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
609 else |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
610 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
|
611 |
a13b8f308dce
vorbis: mimetype field added. also little fix
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2211
diff
changeset
|
612 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
|
613 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
614 return tuple; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
615 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
616 |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
617 static Tuple * |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
618 get_song_tuple(gchar *filename) |
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 VFSFile *stream = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
621 OggVorbis_File vfile; /* avoid thread interaction */ |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
622 Tuple *tuple = NULL; |
481 | 623 VFSVorbisFile *fd = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
624 |
1978 | 625 if ((stream = aud_vfs_fopen(filename, "r")) == NULL) |
481 | 626 return NULL; |
627 | |
628 fd = g_new0(VFSVorbisFile, 1); | |
629 fd->fd = stream; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
630 |
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 * The open function performs full stream detection and |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 * machine initialization. If it returns zero, the stream |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
634 * *is* Vorbis and we're fully ready to decode. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 */ |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
636 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
|
637 aud_vfs_fclose(stream); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 return NULL; |
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 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
641 tuple = get_aud_tuple_for_vorbisfile(&vfile, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
642 |
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 * once the ov_open succeeds, the stream belongs to |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
645 * vorbisfile.a. ov_clear will fclose it |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
646 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
647 ov_clear(&vfile); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
648 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
649 return tuple; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
650 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
651 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
652 static gchar * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
653 vorbis_generate_title(OggVorbis_File * vorbisfile, gchar * filename) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
654 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
655 /* Caller should hold vf_mutex */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
656 gchar *displaytitle = NULL; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
657 Tuple *input; |
545
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
658 gchar *tmp; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
659 |
2131
c162b6a0f11f
majorly decraq the code
William Pitcock <nenolod@atheme.org>
parents:
2130
diff
changeset
|
660 input = get_aud_tuple_for_vorbisfile(vorbisfile, filename); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
661 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
662 displaytitle = aud_tuple_formatter_make_title_string(input, vorbis_cfg.tag_override ? |
2055 | 663 vorbis_cfg.tag_format : aud_get_gentitle_format()); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
664 |
1978 | 665 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
|
666 { |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
667 gchar *old = displaytitle; |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
668 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
669 aud_tuple_associate_string(input, -1, "stream", tmp); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
670 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
|
671 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
672 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
|
673 |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
674 g_free(old); |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
675 g_free(tmp); |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
676 } |
f9dc3d58207a
[svn] - display the stream title if it's available, like in mp3 streams
nenolod
parents:
544
diff
changeset
|
677 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1973
diff
changeset
|
678 aud_tuple_free(input); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
679 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
680 return displaytitle; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
681 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
682 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
683 static void |
1433
d557d987e42d
vorbis: new tuple API
William Pitcock <nenolod@atheme-project.org>
parents:
1417
diff
changeset
|
684 vorbis_aboutbox(void) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
685 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
686 if (about_window) |
2191
329267b09658
get rid of talking with GDK directly
Eugene Zagidullin <e.asphyx@gmail.com>
parents:
2134
diff
changeset
|
687 gtk_window_present(GTK_WINDOW(about_window)); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
688 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
689 { |
1677
f6f5603a0954
xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents:
1676
diff
changeset
|
690 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
|
691 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
692 * I18N: UTF-8 Translation: "Haavard Kvaalen" -> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
693 * "H\303\245vard Kv\303\245len" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
694 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
695 _ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
696 ("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
|
697 "Original code by\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
698 "Tony Arcieri <bascule@inferno.tusculum.edu>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
699 "Contributions from\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
700 "Chris Montgomery <monty@xiph.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
701 "Peter Alm <peter@xmms.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
702 "Michael Smith <msmith@labyrinth.edu.au>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
703 "Jack Moffitt <jack@icecast.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
704 "Jorn Baayen <jorn@nl.linux.org>\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
705 "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
|
706 "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
|
707 "Eugene Zagidullin <e.asphyx@gmail.com>\n\n" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
708 "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
|
709 _("Ok"), FALSE, NULL, NULL); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
710 g_signal_connect(G_OBJECT(about_window), "destroy", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
711 G_CALLBACK(gtk_widget_destroyed), &about_window); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
712 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
713 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
714 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
715 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
716 static void |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
717 vorbis_init(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
718 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2496
diff
changeset
|
719 mcs_handle_t *db; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
720 gchar *tmp = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
721 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
722 memset(&vorbis_cfg, 0, sizeof(vorbis_config_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
723 vorbis_cfg.http_buffer_size = 128; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
724 vorbis_cfg.http_prebuffer = 25; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
725 vorbis_cfg.proxy_port = 8080; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
726 vorbis_cfg.proxy_use_auth = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
727 vorbis_cfg.proxy_user = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
728 vorbis_cfg.proxy_pass = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
729 vorbis_cfg.tag_override = FALSE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
730 vorbis_cfg.tag_format = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
731 |
2124 | 732 db = aud_cfg_db_open(); |
733 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
|
734 &vorbis_cfg.http_buffer_size); |
2124 | 735 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
|
736 &vorbis_cfg.http_prebuffer); |
2124 | 737 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
|
738 &vorbis_cfg.save_http_stream); |
2124 | 739 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
|
740 &vorbis_cfg.save_http_path)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
741 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
|
742 |
2124 | 743 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
|
744 &vorbis_cfg.tag_override); |
2124 | 745 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
|
746 &vorbis_cfg.tag_format)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
747 vorbis_cfg.tag_format = g_strdup("%p - %t"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
748 |
2124 | 749 aud_cfg_db_get_bool(db, NULL, "use_proxy", &vorbis_cfg.use_proxy); |
750 aud_cfg_db_get_string(db, NULL, "proxy_host", &vorbis_cfg.proxy_host); | |
751 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
|
752 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
753 if (tmp != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
754 vorbis_cfg.proxy_port = atoi(tmp); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
755 |
2124 | 756 aud_cfg_db_get_bool(db, NULL, "proxy_use_auth", &vorbis_cfg.proxy_use_auth); |
757 aud_cfg_db_get_string(db, NULL, "proxy_user", &vorbis_cfg.proxy_user); | |
758 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
|
759 |
2124 | 760 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
761 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
762 vf_mutex = g_mutex_new(); |
2032
55f2fd232291
associate with application/ogg mimetype.
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
763 |
55f2fd232291
associate with application/ogg mimetype.
William Pitcock <nenolod@atheme.org>
parents:
1998
diff
changeset
|
764 aud_mime_set_plugin("application/ogg", &vorbis_ip); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
765 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
766 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
767 static void |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
768 vorbis_cleanup(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
769 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
770 if (vorbis_cfg.save_http_path) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
771 free(vorbis_cfg.save_http_path); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
772 vorbis_cfg.save_http_path = NULL; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
775 if (vorbis_cfg.proxy_host) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
776 free(vorbis_cfg.proxy_host); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
777 vorbis_cfg.proxy_host = NULL; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
780 if (vorbis_cfg.proxy_user) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
781 free(vorbis_cfg.proxy_user); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
782 vorbis_cfg.proxy_user = NULL; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
785 if (vorbis_cfg.proxy_pass) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
786 free(vorbis_cfg.proxy_pass); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
787 vorbis_cfg.proxy_pass = NULL; |
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 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
790 if (vorbis_cfg.tag_format) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
791 free(vorbis_cfg.tag_format); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
792 vorbis_cfg.tag_format = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
793 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
794 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
795 if (vorbis_cfg.title_encoding) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
796 free(vorbis_cfg.title_encoding); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
797 vorbis_cfg.title_encoding = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
798 } |
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 g_strfreev(vorbis_tag_encoding_list); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
801 g_mutex_free(vf_mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
802 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
803 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
804 static size_t |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
805 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
|
806 { |
478 | 807 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
808 |
1978 | 809 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
|
810 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
811 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
812 static int |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
813 ovcb_seek(void *datasource, int64_t offset, int whence) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
814 { |
478 | 815 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
816 | |
1978 | 817 return aud_vfs_fseek(handle->fd, offset, whence); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
818 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
819 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
820 static int |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
821 ovcb_close(void *datasource) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
822 { |
478 | 823 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
824 | |
825 gint ret = 0; | |
826 | |
827 if (handle->probe == FALSE) | |
828 { | |
1978 | 829 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
|
830 /* g_free(handle); it causes double free. i'm not really sure that commenting out at here is correct. --yaz*/ |
478 | 831 } |
832 | |
833 return ret; | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
834 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
835 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
836 static long |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
837 ovcb_tell(void *datasource) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
838 { |
478 | 839 VFSVorbisFile *handle = (VFSVorbisFile *) datasource; |
840 | |
1978 | 841 return aud_vfs_ftell(handle->fd); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
842 } |