[xiph-commits] r15373 - in trunk/vorbis-tools: . ogg123
ivo at svn.xiph.org
ivo at svn.xiph.org
Sat Oct 4 13:57:38 PDT 2008
Author: ivo
Date: 2008-10-04 13:57:37 -0700 (Sat, 04 Oct 2008)
New Revision: 15373
Modified:
trunk/vorbis-tools/CHANGES
trunk/vorbis-tools/configure.ac
trunk/vorbis-tools/ogg123/Makefile.am
trunk/vorbis-tools/ogg123/oggvorbis_format.c
Log:
ReplayGain support for ogg123. It requires libvorbis 1.2.1 or later, but the code checks for it properly and doesn't compile the feature if associated function is not available. Patch by William Poetra Yoga Hadisoeseno. Closes #381
Modified: trunk/vorbis-tools/CHANGES
===================================================================
--- trunk/vorbis-tools/CHANGES 2008-10-04 01:09:17 UTC (rev 15372)
+++ trunk/vorbis-tools/CHANGES 2008-10-04 20:57:37 UTC (rev 15373)
@@ -11,7 +11,10 @@
* ogg123: backported fix from libfishsound to patch the Speex decoder (#1347)
* ogg123: fixed CPU issue when outputting to a closed pipe (#1357)
* ogg123: return value to stop decoding after buffer is shut down (#1357)
+ * ogg123: support for ReplayGain (#381)
* oggdec: gettextized help text (#1385)
+ * oggdec: gettextized all strings
+ * oggdec: call ov_open_callbacks instead of ov_open; it works on Windows now
* oggenc: fixed a core dump while resampling from FLAC (#1316)
* oggenc: fixed a typo in the Skeleton handling routine
* oggenc: fixed remapping channels bug (#1326)
Modified: trunk/vorbis-tools/configure.ac
===================================================================
--- trunk/vorbis-tools/configure.ac 2008-10-04 01:09:17 UTC (rev 15372)
+++ trunk/vorbis-tools/configure.ac 2008-10-04 20:57:37 UTC (rev 15373)
@@ -141,15 +141,23 @@
VORBISFILE_LIBS="-lvorbisfile"
AC_SUBST(VORBISENC_LIBS)
AC_SUBST(VORBISFILE_LIBS)
+ libs_save=$LIBS
+ LIBS="$OGG_LIBS $VORBIS_LIBS $VORBISFILE_LIBS"
+ AC_CHECK_FUNC(ov_read_filter, have_ov_read_filter=yes, have_ov_read_filter=no)
+ LIBS=$libs_save
+ if test "x$have_ov_read_filter" = "xyes"
+ then
+ AC_DEFINE(HAVE_OV_READ_FILTER,1,[Defined if we have ov_read_filter()])
+ fi
fi
if test "x$HAVE_VORBIS" = "xno"
then
dnl fall back to the old school test
XIPH_PATH_VORBIS(,AC_MSG_ERROR(Vorbis needed!))
fi
+AM_CONDITIONAL(HAVE_OV_READ_FILTER, test "x$have_ov_read_filter" = "xyes")
-
SHARE_LIBS='$(top_builddir)/share/libutf8.a $(top_builddir)/share/libgetopt.a'
SHARE_CFLAGS='-I$(top_srcdir)/include'
Modified: trunk/vorbis-tools/ogg123/Makefile.am
===================================================================
--- trunk/vorbis-tools/ogg123/Makefile.am 2008-10-04 01:09:17 UTC (rev 15372)
+++ trunk/vorbis-tools/ogg123/Makefile.am 2008-10-04 20:57:37 UTC (rev 15373)
@@ -9,6 +9,11 @@
else
speex_sources =
endif
+if HAVE_OV_READ_FILTER
+vgfilter_sources = vgfilter.c vgfilter.h
+else
+vgfilter_sources =
+endif
datadir = @datadir@
localedir = $(datadir)/locale
@@ -37,7 +42,7 @@
cfgfile_options.h cmdline_options.h \
format.h ogg123.h playlist.h status.h \
transport.h remote.h vorbis_comments.h \
- $(flac_sources) $(speex_sources)
+ $(flac_sources) $(speex_sources) $(vgfilter_sources)
man_MANS = ogg123.1
doc_DATA = ogg123rc-example
Modified: trunk/vorbis-tools/ogg123/oggvorbis_format.c
===================================================================
--- trunk/vorbis-tools/ogg123/oggvorbis_format.c 2008-10-04 01:09:17 UTC (rev 15372)
+++ trunk/vorbis-tools/ogg123/oggvorbis_format.c 2008-10-04 20:57:37 UTC (rev 15373)
@@ -32,6 +32,9 @@
#include "utf8.h"
#include "i18n.h"
+#ifdef HAVE_OV_READ_FILTER
+#include "vgfilter.h"
+#endif
typedef struct ovf_private_t {
OggVorbis_File vf;
@@ -42,6 +45,9 @@
int bos; /* At beginning of logical bitstream */
decoder_stats_t stats;
+#ifdef HAVE_OV_READ_FILTER
+ vgain_state vg;
+#endif
} ovf_private_t;
/* Forward declarations */
@@ -91,6 +97,11 @@
private->stats.current_time = 0.0;
private->stats.instant_bitrate = 0;
private->stats.avg_bitrate = 0;
+
+#ifdef HAVE_OV_READ_FILTER
+ private->vg.scale_factor = 1.0;
+ private->vg.max_scale = 1.0;
+#endif
} else {
fprintf(stderr, _("ERROR: Out of memory.\n"));
exit(1);
@@ -128,6 +139,9 @@
decoder->actual_fmt.rate = priv->vi->rate;
decoder->actual_fmt.channels = priv->vi->channels;
+#ifdef HAVE_OV_READ_FILTER
+ vg_init(&priv->vg, priv->vc);
+#endif
print_vorbis_stream_info(decoder);
print_vorbis_comments(priv->vc, cb, decoder->callback_arg);
@@ -140,9 +154,16 @@
while (nbytes >= audio_fmt->word_size * audio_fmt->channels) {
old_section = priv->current_section;
+#ifdef HAVE_OV_READ_FILTER
+ ret = ov_read_filter(&priv->vf, ptr, nbytes, audio_fmt->big_endian,
+ audio_fmt->word_size, audio_fmt->signed_sample,
+ &priv->current_section,
+ vg_filter, &priv->vg);
+#else
ret = ov_read(&priv->vf, ptr, nbytes, audio_fmt->big_endian,
audio_fmt->word_size, audio_fmt->signed_sample,
&priv->current_section);
+#endif
if (ret == 0) {
More information about the commits
mailing list