|
libmpv
20200718-git-96cdf53
development library for the MPV media player
|
Looking for a C++ dev? I'm looking for work. Hire me!
|
|
Go to the documentation of this file.
23 #ifndef MPV_CLIENT_API_H_
24 #define MPV_CLIENT_API_H_
234 #define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
235 #define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 109)
243 #ifndef MPV_ENABLE_DEPRECATED
244 #define MPV_ENABLE_DEPRECATED 1
502 #if MPV_ENABLE_DEPRECATED
609 #if MPV_ENABLE_DEPRECATED
1154 const char *name,
mpv_format format,
void *data);
1332 #if MPV_ENABLE_DEPRECATED
1437 #if MPV_ENABLE_DEPRECATED
1466 #if MPV_ENABLE_DEPRECATED
1671 #if MPV_ENABLE_DEPRECATED
1953 const char *name,
int priority);
1973 #if MPV_ENABLE_DEPRECATED
@ MPV_EVENT_END_FILE
Notification after playback end (after the file was unloaded).
@ MPV_LOG_LEVEL_INFO
"warn" - possible problems
int mpv_get_property_async(mpv_handle *ctx, uint64_t reply_userdata, const char *name, mpv_format format)
Get a property asynchronously.
@ MPV_FORMAT_STRING
The basic type is char*.
const char * mpv_client_name(mpv_handle *ctx)
Return the name of this client handle.
struct mpv_event_end_file mpv_event_end_file
@ MPV_END_FILE_REASON_QUIT
Playback was stopped by the quit command or player shutdown.
@ MPV_ERROR_EVENT_QUEUE_FULL
The event ringbuffer is full.
struct mpv_event_hook mpv_event_hook
int num_args
Arbitrary arguments chosen by the sender of the message.
int mpv_unobserve_property(mpv_handle *mpv, uint64_t registered_reply_userdata)
Undo mpv_observe_property().
@ MPV_EVENT_SHUTDOWN
Happens when the player quits.
@ MPV_ERROR_NOTHING_TO_PLAY
There was no audio or video data to play.
int playlist_insert_num_entries
See playlist_insert_id.
struct mpv_event mpv_event
int flag
valid if format==MPV_FORMAT_STRING
char ** keys
MPV_FORMAT_NODE_ARRAY: unused (typically NULL), access is not allowed.
int num
Number of entries.
@ MPV_ERROR_UNINITIALIZED
The mpv core wasn't configured and initialized yet.
void mpv_suspend(mpv_handle *ctx)
This does nothing since mpv 0.23.0 (API version 1.24).
@ MPV_LOG_LEVEL_ERROR
"fatal" - critical/aborting errors
unsigned long mpv_client_api_version(void)
Return the MPV_CLIENT_API_VERSION the mpv source has been compiled with.
void mpv_wakeup(mpv_handle *ctx)
Interrupt the current mpv_wait_event() call.
@ MPV_EVENT_METADATA_UPDATE
Happens when metadata (like file tags) is possibly updated.
const char * level
The log level as string.
int mpv_command_string(mpv_handle *ctx, const char *args)
Same as mpv_command, but use input.conf parsing for splitting arguments.
@ MPV_EVENT_GET_PROPERTY_REPLY
Reply to a mpv_get_property_async() request.
@ MPV_ERROR_OPTION_FORMAT
Trying to set an option using an unsupported MPV_FORMAT.
char * mpv_get_property_string(mpv_handle *ctx, const char *name)
Return the value of the property with the given name as string.
void * data
Pointer to the data.
int mpv_request_log_messages(mpv_handle *ctx, const char *min_level)
Enable or disable receiving of log messages.
@ MPV_END_FILE_REASON_REDIRECT
The file was a playlist or similar.
char * mpv_get_property_osd_string(mpv_handle *ctx, const char *name)
Return the property as "OSD" formatted string.
@ MPV_FORMAT_DOUBLE
The basic type is double.
int64_t mpv_client_id(mpv_handle *ctx)
Return the ID of this client handle.
void * data
Received property value.
@ MPV_ERROR_GENERIC
Unspecified error.
@ MPV_EVENT_IDLE
Idle mode was entered.
struct mpv_event_log_message mpv_event_log_message
int mpv_load_config_file(mpv_handle *ctx, const char *filename)
Load a config file.
int mpv_initialize(mpv_handle *ctx)
Initialize an uninitialized mpv instance.
uint64_t reply_userdata
If the event is in reply to a request (made with this API and this API handle), this is set to the re...
mpv_event_id event_id
One of mpv_event.
@ MPV_EVENT_CLIENT_MESSAGE
Triggered by the script-message input command.
@ MPV_ERROR_UNSUPPORTED
Generic error for signaling that certain system requirements are not fulfilled.
@ MPV_ERROR_NOMEM
Memory allocation failed.
const char * mpv_error_string(int error)
Return a string describing the error.
@ MPV_EVENT_COMMAND_REPLY
Reply to a mpv_command_async() or mpv_command_node_async() request.
@ MPV_EVENT_QUEUE_OVERFLOW
Happens if the internal per-mpv_handle ringbuffer overflows, and at least 1 event had to be dropped.
mpv_format
Data format for options and properties.
@ MPV_EVENT_AUDIO_RECONFIG
Similar to MPV_EVENT_VIDEO_RECONFIG.
@ MPV_FORMAT_OSD_STRING
The basic type is char*.
int mpv_command_node_async(mpv_handle *ctx, uint64_t reply_userdata, mpv_node *args)
Same as mpv_command_node(), but run it asynchronously.
@ MPV_EVENT_START_FILE
Notification before playback start of a file (before the file is loaded).
@ MPV_ERROR_INVALID_PARAMETER
Generic catch-all error if a parameter is set to an invalid or unsupported value.
@ MPV_END_FILE_REASON_STOP
Playback was stopped by an external action (e.g.
@ MPV_ERROR_NOT_IMPLEMENTED
The API function which was called is a stub only.
void mpv_resume(mpv_handle *ctx)
See mpv_suspend().
@ MPV_EVENT_TRACKS_CHANGED
The list of video/audio/subtitle tracks was changed.
@ MPV_EVENT_SEEK
Happens when a seek was initiated.
@ MPV_FORMAT_NODE_MAP
See MPV_FORMAT_NODE_ARRAY.
void mpv_destroy(mpv_handle *ctx)
Disconnect and destroy the mpv_handle.
const char * name
The hook name as passed to mpv_hook_add().
@ MPV_EVENT_TRACK_SWITCHED
A video/audio/subtitle track was switched on or off.
int mpv_get_property(mpv_handle *ctx, const char *name, mpv_format format, void *data)
Read the value of the given property.
int mpv_command_node(mpv_handle *ctx, mpv_node *args, mpv_node *result)
Same as mpv_command(), but allows passing structured data in any format.
@ MPV_LOG_LEVEL_DEBUG
"v" - noisy informational message
int mpv_request_event(mpv_handle *ctx, mpv_event_id event, int enable)
Enable or disable the given event.
@ MPV_END_FILE_REASON_EOF
The end of file was reached.
int mpv_command_async(mpv_handle *ctx, uint64_t reply_userdata, const char **args)
Same as mpv_command, but run the command asynchronously.
mpv_handle * mpv_create_client(mpv_handle *ctx, const char *name)
Create a new client handle connected to the same player core as ctx.
void * mpv_get_sub_api(mpv_handle *ctx, mpv_sub_api sub_api)
This is used for additional APIs that are not strictly part of the core API.
const char * mpv_event_name(mpv_event_id event)
Return a string describing the event.
int error
This is mainly used for events that are replies to (asynchronous) requests.
@ MPV_ERROR_SUCCESS
No error happened (used to signal successful operation).
int mpv_set_option_string(mpv_handle *ctx, const char *name, const char *data)
Convenience function to set an option to a string value.
mpv_event * mpv_wait_event(mpv_handle *ctx, double timeout)
Wait for the next event, or until the timeout expires, or if another thread makes a call to mpv_wakeu...
@ MPV_EVENT_LOG_MESSAGE
See mpv_request_log_messages().
@ MPV_ERROR_UNKNOWN_FORMAT
When trying to load the file, the file format could not be determined, or the file was too broken to ...
mpv_format format
Format of the data field in the same struct.
const char * prefix
The module prefix, identifies the sender of the message.
@ MPV_EVENT_UNPAUSE
Playback was unpaused.
@ MPV_FORMAT_NODE_ARRAY
Used with mpv_node only.
@ MPV_FORMAT_INT64
The basic type is int64_t.
struct mpv_byte_array * ba
valid if format==MPV_FORMAT_BYTE_ARRAY
@ MPV_EVENT_PAUSE
Playback was paused.
@ MPV_EVENT_CHAPTER_CHANGE
Happens when the current chapter changes.
@ MPV_LOG_LEVEL_WARN
"error" - simple errors
mpv_node result
Result data of the command.
int64_t mpv_get_time_us(mpv_handle *ctx)
Return the internal time in microseconds.
void mpv_terminate_destroy(mpv_handle *ctx)
Similar to mpv_destroy(), but brings the player and all clients down as well, and waits until all of ...
@ MPV_ERROR_PROPERTY_FORMAT
Trying to set or get a property using an unsupported MPV_FORMAT.
mpv_handle * mpv_create(void)
Create a new mpv instance and an associated client API handle to control the mpv instance.
void mpv_free(void *data)
General function to deallocate memory returned by some of the API functions.
void mpv_set_wakeup_callback(mpv_handle *ctx, void(*cb)(void *d), void *d)
Set a custom function that should be called when there are new events.
@ MPV_LOG_LEVEL_TRACE
"debug" - very noisy technical information
int mpv_set_property(mpv_handle *ctx, const char *name, mpv_format format, void *data)
Set a property to a given value.
int mpv_command(mpv_handle *ctx, const char **args)
Send a command to the player.
void mpv_abort_async_command(mpv_handle *ctx, uint64_t reply_userdata)
Signal to all async requests with the matching ID to abort.
int mpv_set_property_string(mpv_handle *ctx, const char *name, const char *data)
Convenience function to set a property to a string value.
int mpv_event_to_node(mpv_node *dst, mpv_event *src)
Convert the given src event to a mpv_node, and set dst to the result.
@ MPV_ERROR_COMMAND
General error when running a command with mpv_command and similar.
int mpv_command_ret(mpv_handle *ctx, const char **args, mpv_node *result)
This is essentially identical to mpv_command() but it also returns a result.
@ MPV_FORMAT_BYTE_ARRAY
A raw, untyped byte array.
@ MPV_END_FILE_REASON_ERROR
Some kind of error happened that lead to playback abort.
@ MPV_ERROR_PROPERTY_NOT_FOUND
The accessed property doesn't exist.
struct mpv_handle mpv_handle
Client context used by the client API.
@ MPV_FORMAT_NODE
The type is mpv_node.
@ MPV_FORMAT_NONE
Invalid.
mpv_log_level log_level
The same contents as the level field, but as a numeric ID.
void * data
The meaning and contents of the data member depend on the event_id: MPV_EVENT_GET_PROPERTY_REPLY: mpv...
mpv_error
List of error codes than can be returned by API functions.
void mpv_free_node_contents(mpv_node *node)
Frees any data referenced by the node.
mpv_log_level
Numeric log levels.
@ MPV_EVENT_PROPERTY_CHANGE
Event sent due to mpv_observe_property().
mpv_format format
Type of the data stored in this struct.
@ MPV_EVENT_FILE_LOADED
Notification when the file has been loaded (headers were read etc.), and decoding starts.
@ MPV_ERROR_PROPERTY_UNAVAILABLE
The property exists, but is not available.
@ MPV_ERROR_PROPERTY_ERROR
Error setting or getting a property.
@ MPV_FORMAT_FLAG
The basic type is int.
struct mpv_event_client_message mpv_event_client_message
@ MPV_EVENT_HOOK
Triggered if a hook handler was registered with mpv_hook_add(), and the hook is invoked.
const char * text
The log message.
int mpv_hook_continue(mpv_handle *ctx, uint64_t id)
Respond to a MPV_EVENT_HOOK event.
@ MPV_EVENT_VIDEO_RECONFIG
Happens after video changed in some way.
int error
If reason==MPV_END_FILE_REASON_ERROR, this contains a mpv error code (one of MPV_ERROR_....
mpv_end_file_reason
Since API version 1.9.
@ MPV_ERROR_OPTION_ERROR
Setting the option failed.
struct mpv_event_command mpv_event_command
int mpv_hook_add(mpv_handle *ctx, uint64_t reply_userdata, const char *name, int priority)
A hook is like a synchronous event that blocks the player.
int mpv_set_property_async(mpv_handle *ctx, uint64_t reply_userdata, const char *name, mpv_format format, void *data)
Set a property asynchronously.
@ MPV_LOG_LEVEL_V
"info" - informational message
struct mpv_node_list * list
valid if format==MPV_FORMAT_DOUBLE
int64_t int64
valid if format==MPV_FORMAT_FLAG
@ MPV_EVENT_SCRIPT_INPUT_DISPATCH
mpv_handle * mpv_create_weak_client(mpv_handle *ctx, const char *name)
This is the same as mpv_create_client(), but the created mpv_handle is treated as a weak reference.
int64_t playlist_entry_id
Playlist entry ID of the file being loaded now.
struct mpv_event_start_file mpv_event_start_file
Since API version 1.108.
int64_t playlist_entry_id
Playlist entry ID of the file that was being played or attempted to be played.
@ MPV_ERROR_VO_INIT_FAILED
Initializing the video output failed.
mpv_node * values
MPV_FORMAT_NODE_ARRAY: values[N] refers to value of the Nth item.
void mpv_detach_destroy(mpv_handle *ctx)
int mpv_get_wakeup_pipe(mpv_handle *ctx)
Return a UNIX file descriptor referring to the read end of a pipe.
struct mpv_node mpv_node
Generic data storage.
struct mpv_node_list mpv_node_list
(see mpv_node)
@ MPV_ERROR_OPTION_NOT_FOUND
Trying to set an option that doesn't exist.
struct mpv_event_property mpv_event_property
@ MPV_EVENT_SET_PROPERTY_REPLY
Reply to a mpv_set_property_async() request.
@ MPV_EVENT_PLAYBACK_RESTART
There was a discontinuity of some sort (like a seek), and playback was reinitialized.
@ MPV_SUB_API_OPENGL_CB
For using mpv's OpenGL renderer on an external OpenGL context.
uint64_t id
Internal ID that must be passed to mpv_hook_continue().
double double_
valid if format==MPV_FORMAT_INT64
struct mpv_byte_array mpv_byte_array
(see mpv_node)
struct mpv_event_script_input_dispatch mpv_event_script_input_dispatch
@ MPV_ERROR_LOADING_FAILED
Generic error on loading (usually used with mpv_event_end_file.error).
void mpv_wait_async_requests(mpv_handle *ctx)
Block until all asynchronous requests are done.
int reason
Corresponds to the values in enum mpv_end_file_reason (the "int" type will be replaced with mpv_end_f...
int64_t playlist_insert_id
If loading ended, because the playlist entry to be played was for example a playlist,...
@ MPV_EVENT_NONE
Nothing happened.
int mpv_observe_property(mpv_handle *mpv, uint64_t reply_userdata, const char *name, mpv_format format)
Get a notification whenever the given property changes.
int mpv_set_option(mpv_handle *ctx, const char *name, mpv_format format, void *data)
Set an option.
@ MPV_ERROR_AO_INIT_FAILED
Initializing the audio output failed.
@ MPV_EVENT_TICK
Sent every time after a video frame is displayed.
const char * name
Name of the property.
size_t size
Size of the data pointed to by ptr.
@ MPV_LOG_LEVEL_FATAL
"no" - disable absolutely all messages