diff --git a/src/playbin.vala b/src/playbin.vala index 691eaab..a1b5e90 100644 --- a/src/playbin.vala +++ b/src/playbin.vala @@ -129,6 +129,13 @@ class Playbin : GLib.Object { this.song = (Subsonic.Song) this.play_queue.get_item (this.play_queue_position); this.now_playing (); break; + + case Mpv.EventId.END_FILE: + var data = event.parse_end_file (); + if (data.error < 0) { + warning ("playback of track aborted: %s", data.error.to_string ()); + } + break; default: // ignore by default diff --git a/src/vapi/mpv.vapi b/src/vapi/mpv.vapi index f3d8ade..9010f8e 100644 --- a/src/vapi/mpv.vapi +++ b/src/vapi/mpv.vapi @@ -48,7 +48,7 @@ namespace Mpv { } [CCode (cname = "mpv_set_property")] - public Error set_property (string name, Format format, void *data); + private Error set_property (string name, Format format, void *data); [CCode (cname = "mpv_set_property_string")] public Error set_property_string (string name, string value); @@ -115,7 +115,14 @@ namespace Mpv { requires (event_id == EventId.PROPERTY_CHANGE) requires (error >= 0) { - return (Mpv.EventProperty?) data; + return (EventProperty?) data; + } + + public unowned EventEndFile? parse_end_file () + requires (event_id == EventId.END_FILE) + requires (error >= 0) + { + return (EventEndFile?) data; } } @@ -138,4 +145,21 @@ namespace Mpv { } } + [CCode (cname = "mpv_event_end_file", destroy_function = "", has_type_id = false, has_copy_function = false)] + public struct EventEndFile { + EndFileReason reason; + Error error; + int64 playlist_entry_id; + int playlist_insert_num_entries; + } + + [CCode (cname = "mpv_end_file_reason", cprefix = "MPV_END_FILE_REASON_", has_type_id = false)] + public enum EndFileReason { + EOF, + STOP, + QUIT, + ERROR, + REDIRECT, + } + }