currently, akode always* tries to resample to 44100 Hz.  this has
interesting effects.  when you play a 22050 Hz file on a device
that supports 22050 Hz, it plays 2x too slowly.  the fix is simple,
delete the resampler when it's not needed.  same with sample format
conversions.  this makes the auto-resampling feature work in
both akodeplay and juk (when juk is configured to use akode for
audio output, that is).

* the default "fast" resampler does at least.  the libsamplerate "src"
resampler seems to be completely broken.

this patch also enables jack support and fixes a couple issues in
akode's jack support.  akodeplay makes for a "small" and fast cli
player for jack, capable of playing flac, ogg, mp3, wav.

oh, and fix some overdue ffmpeg-related wantlib changes while here.

ok?

-- 
[EMAIL PROTECTED]
SDF Public Access UNIX System - http://sdf.lonestar.org

Index: Makefile
===================================================================
RCS file: /home/cvs/OpenBSD/ports/audio/akode/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- Makefile    24 Mar 2008 05:50:05 -0000      1.9
+++ Makefile    24 Mar 2008 21:57:51 -0000
@@ -2,7 +2,7 @@
 COMMENT=       Decoding Library for KDE Multimedia
 
 DISTNAME=      akode-2.0.2
-PKGNAME=       ${DISTNAME}p2
+PKGNAME=       ${DISTNAME}p3
 SHARED_LIBS += akode                2.1      # .2.0
 
 CATEGORIES=    audio multimedia x11/kde
@@ -25,10 +25,11 @@
                vorbis,vorbisfile,vorbisenc::audio/libvorbis \
                ltdl::devel/libtool,-ltdl \
                avcodec.>=10,avformat.>=10,avutil.>=3::graphics/ffmpeg \
-               samplerate.>=1::audio/libsamplerate
+               samplerate.>=1::audio/libsamplerate \
+               jack::audio/jack
 
-WANTLIB=       X11 Xau Xdmcp Xext a52 c faac faad m mp3lame \
-               ogg ossaudio pthread stdc++ theora x264 z
+WANTLIB=       a52 c faac faad m mp3lame ogg ossaudio pthread stdc++ \
+               theora x264 z
 
 USE_X11=       Yes
 USE_GMAKE=     Yes
@@ -40,7 +41,7 @@
 CONFIGURE_ENV=         PTHREAD_LIBS=-pthread
 CONFIGURE_ARGS+=       --with-extra-includes=${LOCALBASE}/include \
                        --with-extra-libs=${LOCALBASE}/lib \
-                       --without-jack \
+                       --with-jack \
                        --without-polyaudio
 
 .include <bsd.port.mk>
Index: patches/patch-akode_lib_player_cpp
===================================================================
RCS file: patches/patch-akode_lib_player_cpp
diff -N patches/patch-akode_lib_player_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-akode_lib_player_cpp  24 Mar 2008 21:57:51 -0000
@@ -0,0 +1,27 @@
+$OpenBSD$
+--- akode/lib/player.cpp.orig  Mon Mar 24 01:59:23 2008
++++ akode/lib/player.cpp       Mon Mar 24 02:54:46 2008
+@@ -398,7 +398,10 @@ bool Player::load() {
+         if (d->sample_rate != first_frame.sample_rate) {
+             AKODE_DEBUG("Resampling to " << d->sample_rate);
+             d->resampler->setSampleRate(d->sample_rate);
+-        }
++        } else {
++            delete d->resampler;
++          d->resampler = 0;
++      }
+         int out_channels = d->sink->audioConfiguration()->channels;
+         int in_channels = first_frame.channels;
+         if (in_channels != out_channels) {
+@@ -419,7 +422,10 @@ bool Player::load() {
+                 d->converter = new Converter(out_width);
+             else
+                 d->converter->setSampleWidth(out_width);
+-        }
++        } else {
++          delete d->converter;
++          d->converter = 0;
++      }
+     }
+     else
+     {
Index: patches/patch-akode_plugins_jack_sink_jack_sink_cpp
===================================================================
RCS file: patches/patch-akode_plugins_jack_sink_jack_sink_cpp
diff -N patches/patch-akode_plugins_jack_sink_jack_sink_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-akode_plugins_jack_sink_jack_sink_cpp 24 Mar 2008 21:57:51 
-0000
@@ -0,0 +1,28 @@
+$OpenBSD$
+--- akode/plugins/jack_sink/jack_sink.cpp.orig Mon Mar 24 03:18:18 2008
++++ akode/plugins/jack_sink/jack_sink.cpp      Mon Mar 24 03:54:26 2008
+@@ -84,7 +84,7 @@ static int process (jack_nframes_t nframes, void *arg)
+         m_data->pos++;
+     }
+ 
+-    return n;
++    return 0;
+ }
+ 
+ static void shutdown (void *arg)
+@@ -147,13 +147,13 @@ int JACKSink::setAudioConfiguration(const AudioConfigu
+ 
+     if (config->channel_config != MonoStereo ) return -1;
+     m_data->left_port = jack_port_register (m_data->client, "left", 
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+-    if (jack_connect (m_data->client, jack_port_name (m_data->left_port), 
"alsa_pcm:playback_1")) {
++    if (jack_connect (m_data->client, jack_port_name (m_data->left_port), 
"system:playback_1")) {
+         m_data->error = true;
+         return -1;
+     }
+     if (config->channels > 1) {
+         m_data->right_port = jack_port_register (m_data->client, "right", 
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+-        if (jack_connect (m_data->client, jack_port_name 
(m_data->right_port), "alsa_pcm:playback_2")) {
++        if (jack_connect (m_data->client, jack_port_name 
(m_data->right_port), "system:playback_2")) {
+             m_data->config.channels = 1;
+             res = 1;
+         }
Index: pkg/PFRAG.shared
===================================================================
RCS file: /home/cvs/OpenBSD/ports/audio/akode/pkg/PFRAG.shared,v
retrieving revision 1.2
diff -u -r1.2 PFRAG.shared
--- pkg/PFRAG.shared    1 Oct 2007 17:39:50 -0000       1.2
+++ pkg/PFRAG.shared    24 Mar 2008 21:57:51 -0000
@@ -1,6 +1,7 @@
 @comment $OpenBSD: PFRAG.shared,v 1.2 2007/10/01 17:39:50 jakemsr Exp $
 @lib lib/libakode.so.${LIBakode_VERSION}
 lib/libakode_ffmpeg_decoder.so
+lib/libakode_jack_sink.so
 lib/libakode_mpc_decoder.so
 lib/libakode_mpeg_decoder.so
 lib/libakode_oss_sink.so
Index: pkg/PLIST
===================================================================
RCS file: /home/cvs/OpenBSD/ports/audio/akode/pkg/PLIST,v
retrieving revision 1.3
diff -u -r1.3 PLIST
--- pkg/PLIST   1 Oct 2007 17:39:50 -0000       1.3
+++ pkg/PLIST   24 Mar 2008 21:57:51 -0000
@@ -32,6 +32,8 @@
 lib/libakode.la
 @comment lib/libakode_ffmpeg_decoder.a
 @comment lib/libakode_ffmpeg_decoder.la
[EMAIL PROTECTED] lib/libakode_jack_sink.a
[EMAIL PROTECTED] lib/libakode_jack_sink.la
 @comment lib/libakode_mpc_decoder.a
 @comment lib/libakode_mpc_decoder.la
 @comment lib/libakode_mpeg_decoder.a

Reply via email to