audrey/src/vapi/mpv.vapi

134 lines
3.3 KiB
Vala
Raw Normal View History

2024-10-17 10:05:20 +00:00
[CCode (cheader_filename = "mpv/client.h")]
namespace Mpv {
[CCode (cname = "mpv_error", cprefix = "MPV_ERROR_", has_type_id = false)]
public enum Error {
SUCCESS,
EVENT_QUEUE_FULL,
NOMEM,
UNINITIALIZED,
INVALID_PARAMETER,
OPTION_NOT_FOUND,
OPTION_FORMAT,
OPTION_ERROR,
PROPERTY_NOT_FOUND,
PROPERTY_FORMAT,
PROPERTY_UNAVAILABLE,
PROPERTY_ERROR,
COMMAND,
LOADING_FAILED,
AO_INIT_FAILED,
VO_INIT_FAILED,
NOTHING_TO_PLAY,
UNKNOWN_FORMAT,
UNSUPPORTED,
NOT_IMPLEMENTED,
GENERIC;
[CCode (cname = "mpv_error_string")]
public unowned string to_string ();
}
2024-10-17 10:05:20 +00:00
public delegate void WakeupCallback ();
[CCode (cname = "mpv_handle", free_function = "mpv_destroy")]
[Compact]
public class Handle {
[CCode (cname = "mpv_create")]
public Handle ();
[CCode (cname = "mpv_initialize")]
public Error initialize ();
2024-10-17 10:05:20 +00:00
[CCode (cname = "mpv_wait_event")]
public unowned Event *wait_event (double timeout);
public WakeupCallback wakeup_callback {
[CCode (cname = "mpv_set_wakeup_callback")] set;
}
[CCode (cname = "mpv_set_property")]
public Error set_property (string name, Format format, void *data);
2024-10-17 10:05:20 +00:00
[CCode (cname = "mpv_set_property_string")]
public Error set_property_string (string name, string value);
public Error set_property_int64 (string name, int64 value) {
return this.set_property (name, Format.INT64, &value);
}
2024-10-17 10:05:20 +00:00
public Error set_property_flag (string name, bool value) {
int flag = value ? 1 : 0;
return this.set_property (name, Format.INT64, &flag);
}
2024-10-17 10:05:20 +00:00
[CCode (cname = "mpv_command")]
public Error command (
2024-10-17 10:05:20 +00:00
[CCode (array_length = false)]
string[] args);
[CCode (cname = "mpv_observe_property")]
public Error observe_property (uint64 reply_userdata, string name, Format format);
2024-10-17 10:05:20 +00:00
}
[CCode (cname = "mpv_format", cprefix = "MPV_FORMAT_", has_type_id = false)]
public enum Format {
NONE,
STRING,
OSD_STRING,
FLAG,
INT64,
DOUBLE,
NODE,
NODE_ARRAY,
NODE_MAP,
BYTE_ARRAY,
}
[CCode (cname = "mpv_event_id", cprefix = "MPV_EVENT_", has_type_id = false)]
public enum EventId {
NONE,
SHUTDOWN,
LOG_MESSAGE,
GET_PROPERTY_REPLY,
SET_PROPERTY_REPLY,
COMMAND_REPLY,
START_FILE,
END_FILE,
FILE_LOADED,
CLIENT_MESSAGE,
VIDEO_RECONFIG,
AUDIO_RECONFIG,
SEEK,
PLAYBACK_RESTART,
PROPERTY_CHANGE,
QUEUE_OVERFLOW,
HOOK,
// deprecated
IDLE,
TICK,
}
[CCode (cname = "mpv_event")]
public struct Event {
EventId event_id;
Error error;
2024-10-17 10:05:20 +00:00
uint64 reply_userdata;
void *data;
}
[CCode (cname = "mpv_event_start_file")]
public struct EventStartFile {
int64 playlist_entry_id;
}
[CCode (cname = "mpv_event_property")]
public struct EventProperty {
string name;
Format format;
void *data;
}
}