[xiph-commits] r12188 - trunk/vorbis-tools/ogg123
conrad at svn.xiph.org
conrad at svn.xiph.org
Fri Dec 8 17:37:27 PST 2006
Author: conrad
Date: 2006-12-08 17:37:25 -0800 (Fri, 08 Dec 2006)
New Revision: 12188
Modified:
trunk/vorbis-tools/ogg123/ogg123.c
trunk/vorbis-tools/ogg123/oggvorbis_format.c
Log:
Fix support for multichannel playback in ogg123. Patches from Joachim Falk.
Closes ticket:575
Problem verified and patches tested on 6-channel Ogg Vorbis I file.
Modified: trunk/vorbis-tools/ogg123/ogg123.c
===================================================================
--- trunk/vorbis-tools/ogg123/ogg123.c 2006-12-09 01:21:09 UTC (rev 12187)
+++ trunk/vorbis-tools/ogg123/ogg123.c 2006-12-09 01:37:25 UTC (rev 12188)
@@ -55,8 +55,9 @@
void exit_cleanup ();
void play (char *source_string);
+#define PRIMAGIC (2*2*2*2*3*3*3*5*7)
/* take buffer out of the data segment, not the stack */
-#define AUDIO_CHUNK_SIZE 4096
+#define AUDIO_CHUNK_SIZE ((32768 + PRIMAGIC - 1)/ PRIMAGIC * PRIMAGIC)
unsigned char convbuffer[AUDIO_CHUNK_SIZE];
int convsize = AUDIO_CHUNK_SIZE;
@@ -362,6 +363,8 @@
/* Setup buffer */
if (options.buffer_size > 0) {
+ /* Keep sample size alignment for surround sound with up to 10 channels */
+ options.buffer_size = (options.buffer_size + PRIMAGIC - 1) / PRIMAGIC * PRIMAGIC;
audio_buffer = buffer_create(options.buffer_size,
options.buffer_size * options.prebuffer / 100,
audio_play_callback, &audio_play_arg,
Modified: trunk/vorbis-tools/ogg123/oggvorbis_format.c
===================================================================
--- trunk/vorbis-tools/ogg123/oggvorbis_format.c 2006-12-09 01:21:09 UTC (rev 12187)
+++ trunk/vorbis-tools/ogg123/oggvorbis_format.c 2006-12-09 01:37:25 UTC (rev 12188)
@@ -137,7 +137,7 @@
*audio_fmt = decoder->actual_fmt;
/* Attempt to read as much audio as is requested */
- while (nbytes > 0) {
+ while (nbytes >= audio_fmt->word_size * audio_fmt->channels) {
old_section = priv->current_section;
ret = ov_read(&priv->vf, ptr, nbytes, audio_fmt->big_endian,
@@ -162,6 +162,9 @@
cb->printf_error(decoder->callback_arg, ERROR,
_("=== Vorbis library reported a stream error.\n"));
+ /* EOF */
+ *eos = 1;
+ break;
} else {
bytes_read += ret;
More information about the commits
mailing list