Compare commits

..

2 commits

Author SHA1 Message Date
8c4c4f8e74 make mpv call its audio output audrey 2024-10-26 09:26:17 +02:00
36d6734e73 stop playback immediately on window close 2024-10-26 09:20:25 +02:00
2 changed files with 16 additions and 0 deletions

View file

@ -74,6 +74,7 @@ public class Playbin : GLib.Object {
this._play_queue = new ListStore (typeof (Subsonic.Song));
assert (this.mpv.initialize () >= 0);
assert (this.mpv.set_property_string ("audio-client-name", "audrey") >= 0);
assert (this.mpv.set_property_string ("user-agent", Audrey.Const.user_agent) >= 0);
assert (this.mpv.set_property_string ("video", "no") >= 0);
assert (this.mpv.set_property_string ("prefetch-playlist", "yes") >= 0);
@ -362,6 +363,15 @@ public class Playbin : GLib.Object {
}
}
public void stop () {
debug ("stopping playback");
// don't clear the playlist, just in case (less state changes to sync)
assert(this.mpv.command({"stop", "keep-playlist"}) >= 0);
this.state = PlaybinState.STOPPED;
this.play_queue_position = this._play_queue.get_n_items ();
this.stopped ();
}
~Playbin () {
debug ("destroying playbin");
}

View file

@ -116,6 +116,12 @@ class Ui.Window : Adw.ApplicationWindow {
return stack_child != "play-queue";
}
public override bool close_request () {
// stop playback on close
this.playbin.stop ();
return false;
}
~Window () {
debug ("destroying main window");
}