[xiph-cvs] cvs commit: ices/src in_vorbis.c reencode.c stream.c
Brendan
brendan at xiph.org
Sun Mar 23 20:16:16 PST 2003
brendan 03/03/23 23:16:16
Modified: . NEWS
src in_vorbis.c reencode.c stream.c
Log:
Mono source->stereo output fix.
Revision Changes Path
1.2 +10 -10 ices/NEWS
Index: NEWS
===================================================================
RCS file: /cvs/ice/ices/NEWS,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NEWS 19 Mar 2003 19:35:54 -0000 1.1
+++ NEWS 24 Mar 2003 04:16:15 -0000 1.2
@@ -1,13 +1,13 @@
- * Updated to libshout2, which brings icecast2 compatibility.
- * ices will now attempt to trim junk and short frames from MP3 files,
- which should help if you've been hearing chirps between songs.
- * Reencoding is much more reliable - VBR, sampling rate changes, and
- a wide variety of bitrates have been tested.
- * Stability stability stability.
- * Ogg reencoding works on bigendian (eg PowerPC) systems now.
- * Mono reencoding bug fixed.
- * ID3v2 tag support.
- * A blank line in a playlist will terminate ices.
+ * Updated to libshout2, which brings icecast2 compatibility.
+ * ices will now attempt to trim junk and short frames from MP3 files,
+ which should help if you've been hearing chirps between songs.
+ * Reencoding is much more reliable - VBR, sampling rate changes, and
+ a wide variety of bitrates have been tested.
+ * Stability stability stability.
+ * Ogg reencoding works on bigendian (eg PowerPC) systems now.
+ * Mono reencoding bug fixed.
+ * ID3v2 tag support.
+ * A blank line in a playlist will terminate ices.
0.2.3 2002-05-01
As always, the longer the time between releases, the less changed:
* ices no longer uses threads, making it much leaner and more portable.
<p><p>1.8 +1 -0 ices/src/in_vorbis.c
Index: in_vorbis.c
===================================================================
RCS file: /cvs/ice/ices/src/in_vorbis.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- in_vorbis.c 5 Mar 2003 16:15:44 -0000 1.7
+++ in_vorbis.c 24 Mar 2003 04:16:15 -0000 1.8
@@ -119,6 +119,7 @@
if (! self->bitrate)
self->bitrate = ov_bitrate (vf, -1) / 1000;
self->samplerate = (unsigned int) vorbis_data->info->rate;
+ self->channels = vorbis_data->info->channels;
ices_log_debug("Ogg vorbis file found, version %d, %d kbps, %d channels, %ld Hz",
vorbis_data->info->version, self->bitrate, vorbis_data->info->channels,
<p><p>1.22 +6 -1 ices/src/reencode.c
Index: reencode.c
===================================================================
RCS file: /cvs/ice/ices/src/reencode.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- reencode.c 17 Mar 2003 04:45:03 -0000 1.21
+++ reencode.c 24 Mar 2003 04:16:15 -0000 1.22
@@ -92,6 +92,12 @@
lame = (lame_global_flags*)stream->encoder_state;
+ lame_set_in_samplerate (lame, source->samplerate);
+ /* Lame won't reencode mono to stereo for some reason, so we have to
+ * duplicate left into right by hand. */
+ if (source->channels == 1 && stream->out_numchannels == 1)
+ lame_set_num_channels (lame, source->channels);
+
lame_set_brate (lame, stream->bitrate);
if (stream->out_numchannels == 1)
lame_set_mode (lame, MONO);
@@ -99,7 +105,6 @@
lame_set_out_samplerate (lame, stream->out_samplerate);
lame_set_original (lame, 0);
- lame_set_in_samplerate (lame, source->samplerate);
/* lame_init_params isn't more specific about the problem */
if (lame_init_params (lame) < 0) {
ices_log ("LAME: error resetting sample rate.");
<p><p>1.53 +9 -1 ices/src/stream.c
Index: stream.c
===================================================================
RCS file: /cvs/ice/ices/src/stream.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- stream.c 17 Mar 2003 04:45:03 -0000 1.52
+++ stream.c 24 Mar 2003 04:16:15 -0000 1.53
@@ -172,6 +172,7 @@
/* worst case decode: 22050 Hz at 8kbs = 44.1 samples/byte */
static int16_t left[INPUT_BUFSIZ * 45];
static int16_t right[INPUT_BUFSIZ * 45];
+ static int16_t* rightp;
#endif
#ifdef HAVE_LIBLAME
@@ -234,6 +235,12 @@
#ifdef HAVE_LIBLAME
if (stream->reencode && stream_needs_reencoding (source, stream)) {
if (samples > 0) {
+ /* for some reason we have to manually duplicate right from left to get
+ * LAME to output stereo from a mono source */
+ if (source->channels == 1 && stream->out_numchannels != 1)
+ rightp = left;
+ else
+ rightp = right;
if (obuf.len < 7200 + samples + samples / 4) {
char *tmpbuf;
@@ -246,7 +253,7 @@
obuf.data = tmpbuf;
ices_log_debug ("Grew output buffer to %d bytes", obuf.len);
}
- if ((olen = ices_reencode (stream, samples, left, right, obuf.data,
+ if ((olen = ices_reencode (stream, samples, left, rightp, obuf.data,
obuf.len)) < -1) {
ices_log_error ("Reencoding error, aborting track");
goto err;
@@ -323,6 +330,7 @@
source->filesize = 0;
source->bytes_read = 0;
+ source->channels = 2;
if ((fd = open (source->path, O_RDONLY)) < 0) {
ices_util_strerror (errno, buf, sizeof (buf));
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list