Bug#680101: mpg123: writing wav to stdout still works ugly

Thomas Orgis thomas at orgis.org
Thu Jul 5 07:18:51 UTC 2012


Am Wed, 4 Jul 2012 14:25:56 +0400
schrieb dimas <dimas000 at ya.ru>: 

> well, in my case:
> 
> >14:19:03 186 ~/downloads/music/Sword/1986 Metalized$ /usr/bin/mpg123 -q -w /dev/stdout 01.mp3 | file -

Ah, everyday I learn something new. I did not know that there is a
difference for a program between

$ prog > output

and 

$prog | otherprog > output

In the former case, stdout is seekable (as it's a file), in the latter,
it is not (as it's a pipe). Now, thinking about it, it's obvious. The
shell opens the output file and maps the file descriptor to stdout of
the child. Et voilá, you got seekable stdout.

Now, back to the issue. I am getting angry about this. What triggers
here is the attempt of mpg123 to deal with a full disk; code which
tries to deal with
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=67259 . It is actually
non-trivial to handle out-of-disk well when using buffered I/O (C
stdio).

There is a test if at least one byte can be written at the
beginning, combined with a seek to overwrite it again. I have to think
hard why I did this. This is not necessary. Writing the header is test
enough. Ah! No, for raw CD audio (cdr) writing, there is no header.

Well, frick this ... I will remove the test with the single byte. This
will fix this bug here by reverting to old behaviour. Only concession
to bug 67259 is catching out-of-disk while writing WAV/AU header and
informing at the end if out-of-disk condition prevented full output.

I hope that makes everyone reasonably happy. Except me: I should just
have ignored bug 67259. Two regressions with one attempt at fixing a
not-really-fixable bug. That sucks.

And: Looking for possible aliases for stdout won't happen. It will be
treated just like any other file (in the case of a pipe, a non-seekable
one).

I will also clear up the situation about changing input format and WAV
writing for the next release (at least document it).

This stuff will part of mpg123 1.15.0, not a new 1.14.x release, as I
am explicitly changing functionality (even if it is only a single byte
write). Test with http://mpg123.org/snapshot --- does that work with
dir2ogg?


Alrighty then,

Thomas

-- 
Thomas Orgis - Source Mage GNU/Linux Developer
(http://www.sourcemage.org) OrgisNetzOrganisation ---)=-
http://orgis.org GPG public key D446D524:
http://thomas.orgis.org/public_key Fingerprint: 7236 3885 A742 B736
E0C8 9721 9B4C 52BC D446 D524
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-multimedia-maintainers/attachments/20120705/9bc2abde/attachment.pgp>


More information about the pkg-multimedia-maintainers mailing list