Commits
- Commit:
17ef54d6ac6c34b0b1370c1c57836322702783e1
- From:
- Omar Polo <op@omarpolo.com>
- Date:
improving error reporting
makes the player process optionally send back a string describing the
failure to provide a better and more coincise error message.
This turns the syslog message(s):
amused: unknown file type
amused: failed to play, skipping /home/op/pics/phos.jpg
into:
amused: unknown file type; skipping /home/op/pics/phos.jpg
- Commit:
f523773656c7fb53c7ec2f373fb48da5c2f1d788
- From:
- Omar Polo <op@omarpolo.com>
- Date:
don't sio_start if we're not stopped
- Commit:
463ce8791b0da705a2cfd040324fc8dd3c2fd9b9
- From:
- Omar Polo <op@omarpolo.com>
- Date:
don't POLLIN, we only care about POLLOUT
- Commit:
4d8a06d41dc96cb9b17dcbf3a20477dfb5566b82
- From:
- Omar Polo <op@omarpolo.com>
- Date:
don't change params if they're the same
avoids a sio_stop in the common case of switching from song that needs
similar params (such as tracks in the same album.)
- Commit:
aecca17ce0a487ea94b7e3f0c8e5387c1fce31e7
- From:
- Omar Polo <op@omarpolo.com>
- Date:
inline player_init
- Commit:
c0180200175f649dcb6bd4214a7d55a89bccab8c
- From:
- Omar Polo <op@omarpolo.com>
- Date:
switch to a non-blocking usage of sndio
- Commit:
fd90976c2bb3674cfbf4ffd5ad0fcec51a64da18
- From:
- Omar Polo <op@omarpolo.com>
- Date:
free the imsg in player after handling, plugs a memory leak
- Commit:
6e4f8947cd1b33dc0004236e614d704377353f24
- From:
- Omar Polo <op@omarpolo.com>
- Date:
inline player_enqueue
- Commit:
ee5ab27dda2f3da5cd6a38ec0d4d4c9e6a5b6c48
- From:
- Omar Polo <op@omarpolo.com>
- Date:
s/audio_init/player_init
was the only function to disrespect the player_* namespace (well,
excepting play). while here also don't mark those two as static, they
were the only static functions in the file. I'm not trying to
enforcing private symbols here.
- Commit:
7850bef5851db3b13284bfaae7cede92b8450aff
- From:
- Omar Polo <op@omarpolo.com>
- Date:
no need to sio_setpar during initialization
we don't know what format the music will be so we have to stop and set
the parameters in player_setup. there's no point in setting bogus
parameter in audio_init.
- Commit:
926ee8364e8c83d7a22dcd5bceb65e235486703a
- From:
- Omar Polo <op@omarpolo.com>
- Date:
consume all enqueued messages before calling imsg_read
player_dispatch reads only one imsg from the ibuf. Next time it's
called, the other messages on the ibuf (if any) are discarded and new
ones are read. This can cause the player process to go out-of-sync with
the main process if multiple messages were "bundled" in the same chunk.
To avoid this, always try to imsg_read before. If it succeedes, we read
process the equeued messages one by one, if it fails then we poll for
new data and call imsg_read to process them and retry.
This fixes a bug where amused could be "confused" by running
$ amused pause ; amused stop ; amused play
in a loop a few times. This bug and the repro were reported two months
ago by Dirk-Wilhelm Peters, thanks! (and sorry it took so long to
understand and fix the issue)
- Commit:
fc4a38afafeec3a23f264e76659b3405d2d7cc48
- From:
- Omar Polo <op@omarpolo.com>
- Date:
don't set the imsg fd as blocking mode
just do a poll before imsg_read in player_disptach to wait for data to
read. It's not performance-critical code, so this is fine.
If it were important not to do an extra poll(2), for example when we're
called is called after player_pendingimsg we already know there's
something to read, we could move the polling in the case `n == 0' below.
- Commit:
a975dca965d92cd6af18a82629b597668e1d69d8
- From:
- Omar Polo <op@omarpolo.com>
- Date:
don't send the song' path to the player process
we're not relying anymore on the file extension, so this information is
useless for the player.
- Commit:
239029b61f575847650021a5b4904ed426a2e9e4
- From:
- Omar Polo <op@omarpolo.com>
- Date:
don't call player_sendeof on IMSG_STOP
the refactoring introduced this error where we call report an EOF upon
IMSG_STOP, making the player infinitely loop.
- Commit:
bf19b03e6400fa3a7573b0ba4fd057767f0adc22
- From:
- Omar Polo <op@omarpolo.com>
- Date:
add a simple filetype detector instead of relying on file extension
just a bit of "magic" :)
Flac are easy, they always start with "fLaC". mp3 are weird because
they either start with "ID3" (but this theoretically only ensures that's
a tagged file, not an mp3) or 0xFF 0xFB.
Ogg Opus should have a magic sequence "OpusHead" somewhere near the
start of the file but also have the ogg' "OggS" magic bytes. I hope
it's enough to distinguish between Ogg Opus and Vorbis.
Another option would be to refactor play_oggvorbis/opus to not close the
file on failure and try in cascade the play_* functions, but it's more
complex and this solution seems to be enough.