Commits


enrich `amused monitor' reported events The monitor mode now has access to some additional information other than just the name of the event. The `mode' and `seek' events now report the mode status and the position/duration respectively, allowing consumers of `amused monitor' to show correct and coherent information. It helps in particular applications like `amused-monitor' (in contrib/) that show a progress bar for the current song. Before, they had to run their own timers and periodically synchronize using `amused status', now they can just update the state in the same `amused-monitor' event loop.


define constants for mode special values and add a toggle value


add consume mode the consume mode implicitly drops the tracks from the playlist when played 'till the end (note that skipping over a track doesn't trigger the consume mode - yet?)


pledge early This changed amused to pledge "stdio rpath" early in main() and then drop down to "stdio" in ctlaction, by removing the pledge call in parse. Simplifies a bit the logic and runs more code under pledge.


monitor: fix reported event rethink a bit which event are reported and when. - drop 'toggle' event as it's not useful; now 'amused toggle' will report the play/pause event. - replace 'flush' with 'load'. there's no real difference between a flush and an empty load. (also, less event the better) - some events (next/prev/jump) are reported earlier to avoid possible issues (when messing around with the playing queue we can end up in every possible state.) - report 'seek' only after it really happened (i.e. after the player process sent the new position.) There's still a possible race here (we can receive a previous IMSG_POS and think it's the reply to the seek) but it it's hard/impossible to work around. - drop 'restart'. we have 'seek' now which is better (and actually restart is implemented on top of seek.) - add 'seek' to the default list of events.


allow to customize the output of amused status This add a -f flag (that falls back to $AMUSED_STATUS_FORMAT) to control which field to print and in which order.


implement seeking on percentage of total duration


reimplement `restart' on top of seek


implement seeking This adds the internal management of the seeking, as well as the decoder backends bits.


bits, rate and channels are unsigned match the struct sio_par


keep track of current position and total duration


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


amused monitor: allow to pass a list of event as filter it's easier / simpler for scripts to do $ amused monitor next,prev,jump rather than $ amused monitor | egrep --line-buffered 'next|prev|jump'


simplify main_send_player: data is always NULL


change play_*() so that they return an integer this will allow to remove the `got_stop' hack in player.c