Re: New: audio/mpg123 1.6.0

2008-11-12 Thread Alexandre Ratchov
On Tue, Nov 11, 2008 at 12:32:22AM +, Christian Weisgerber wrote:
 Christian Weisgerber [EMAIL PROTECTED] wrote:
 
  New version:
  * Update to 1.6.1.
  * Integrate ratchov@'s sndio backend improvements.
  * Enable IPv6 support.
 
 * Fix next/previous/back to beginning of track in terminal control
   mode.
 

discovered the -C flag...

since few days i'm using mpg123 (instead of mpg321) and it worked
all the time.

  The output module API isn't documented, so this involves a bit
  of guesswork.
 
 Turns out I guessed wrong for the flush primitive.  Provide a dummy,
 since this function is expected to exist, but libsndio doesn't have
 any flush/drain call.
 

there's no need to flush/drain the device, it will always be
properly drained in background, without blocking mpg123.

-- Alexandre



Re: New: audio/mpg123 1.6.0

2008-11-10 Thread Alexandre Ratchov
On Mon, Nov 10, 2008 at 12:38:54AM +0100, Christian Weisgerber wrote:
 This is a first draft of a new port of mpg123 1.6.0, created from
 scratch as a replacement for our cadaverous audio/mpg123 port.
 

works here, on i386 with various devices.

 I have added a simple sndio backend.  The output module API isn't
 documented, so this involves a bit of guesswork.  There is a function
 to query the capabilities of the audio system, which could be
 interfaced with sio_getcap() to enable resampling in mpg123.

sio_getcap() returns the ``hardware'' capabilities, this is mainly
for apps that need direct access to hardware and therefore do not
run with the aucat(1) backend.  IMO mpg123 (as most apps) should
call sio_setpar() as you do, and possibly check that it worked with
sio_getpar().

 I haven't bothered with this for a simple audio player--does anybody
 think it would be worth it?
 

i don't think it's worth.

below is a small diff for fixed rate devices: by calling
sio_getpar(), and returning the rate/channels the mpg123 conversion
code will be triggered if aucat is not running.

as we're at it, check that the returned format is correct so mpg321
can fail rather than playing with the wrong format (eg. on envy(4)
devices).

that reminds me that audio/libao port should check this too.

-- Alexandre

--- files/sndio.c.old   Mon Nov 10 11:02:16 2008
+++ files/sndio.c   Mon Nov 10 11:22:31 2008
@@ -50,11 +50,20 @@ static int open_sndio(audio_output_t *ao)
return -1;
}
 
-   if (!sio_setpar(hdl, par) || !sio_start(hdl)) {
+   if (!sio_setpar(hdl, par) || !sio_getpar(hdl, par) || 
+   !sio_start(hdl)) {
sio_close(hdl);
return -1;
}
-
+   if ((par.bits != 8  par.bits != 16) || par.le != SIO_LE_NATIVE) {
+   sio_close(hdl);
+   return -1;
+   }
+   ao-rate = par.rate;
+   ao-channels = par.pchan;
+   ao-format = (par.bits == 8) ?
+   (par.sig ? MPG123_ENC_SIGNED_8 : MPG123_ENC_UNSIGNED_8) :
+   (par.sig ? MPG123_ENC_SIGNED_16 : MPG123_ENC_UNSIGNED_16);
ao-userptr = hdl;
return 0;
 }
@@ -68,8 +77,12 @@ static int get_formats_sndio(audio_output_t *ao)
 static int write_sndio(audio_output_t *ao, unsigned char *buf, int len)
 {
struct sio_hdl *hdl = (struct sio_hdl *)ao-userptr;
+   int count;
 
-   return (int)sio_write(hdl, buf, len);
+   count = (int)sio_write(hdl, buf, len);
+   if (count == 0  sio_eof(hdl))
+   return -1;
+   return count;
 }
 
 static void flush_sndio(audio_output_t *ao)



Re: New: audio/mpg123 1.6.0

2008-11-10 Thread Christian Weisgerber
New version:
* Update to 1.6.1.
* Integrate ratchov@'s sndio backend improvements.
* Enable IPv6 support.

Tested on alpha, amd64, arm, i386, sparc64.
I'd appreciate if somebody could give it a try on powerpc.
-- 
Christian naddy Weisgerber  [EMAIL PROTECTED]


mpg123-20081110_3.tar.gz
Description: Binary data


Re: New: audio/mpg123 1.6.0

2008-11-10 Thread Antoine Jacoutot
On Mon, 10 Nov 2008, Christian Weisgerber wrote:
 Tested on alpha, amd64, arm, i386, sparc64.
 I'd appreciate if somebody could give it a try on powerpc.

It works fine after some slight testing on macppc.

-- 
Antoine



Re: New: audio/mpg123 1.6.0

2008-11-10 Thread Christian Weisgerber
Christian Weisgerber [EMAIL PROTECTED] wrote:

 New version:
 * Update to 1.6.1.
 * Integrate ratchov@'s sndio backend improvements.
 * Enable IPv6 support.

* Fix next/previous/back to beginning of track in terminal control
  mode.

 The output module API isn't documented, so this involves a bit
 of guesswork.

Turns out I guessed wrong for the flush primitive.  Provide a dummy,
since this function is expected to exist, but libsndio doesn't have
any flush/drain call.

--- files/sndio.c.orig  Mon Nov 10 17:20:28 2008
+++ files/sndio.c   Tue Nov 11 01:15:39 2008
@@ -99,9 +99,7 @@
 
 static void flush_sndio(audio_output_t *ao)
 {
-   struct sio_hdl *hdl = (struct sio_hdl *)ao-userptr;
-
-   sio_stop(hdl);
+   return;
 }
 
 static int close_sndio(audio_output_t *ao)
@@ -119,7 +117,7 @@

/* Set callbacks */
ao-open = open_sndio;
-   ao-flush = flush_sndio;
+   ao-flush = flush_sndio;/* required */
ao-write = write_sndio;
ao-get_formats = get_formats_sndio;
ao-close = close_sndio;
-- 
Christian naddy Weisgerber  [EMAIL PROTECTED]



New: audio/mpg123 1.6.0

2008-11-09 Thread Christian Weisgerber
This is a first draft of a new port of mpg123 1.6.0, created from
scratch as a replacement for our cadaverous audio/mpg123 port.

I have added a simple sndio backend.  The output module API isn't
documented, so this involves a bit of guesswork.  There is a function
to query the capabilities of the audio system, which could be
interfaced with sio_getcap() to enable resampling in mpg123.
I haven't bothered with this for a simple audio player--does anybody
think it would be worth it?

Additional backends for esound, jack, etc. could be enabled and
multi-packaged, but I wanted to start out simple.

The ARM people might want to give --with-cpu=generic_nofpu a try.
It works on i386.  libm is still linked in, but not used for decoding.
Ripping libm out completely on ARM is not worth the effort, I think.

I haven't set SHARED_ONLY because libmpg123 may still be of use on
static platforms, but it would take very little to convince me
otherwise.

Lightly tested on i386, amd64 (-s), and sparc64.

-- 
Christian naddy Weisgerber  [EMAIL PROTECTED]


mpg123-20081110.tar.gz
Description: Binary data