Skip to content

Commit

Permalink
libmpv: remove opengl_cb API and other deprecated symbols
Browse files Browse the repository at this point in the history
Not all deprecated symbols were removed. Only three events were removed for now
since these are not used internally.
This bumps the library version to 2.0.
  • Loading branch information
sfan5 committed Dec 15, 2021
1 parent 72915e8 commit 6320598
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 593 deletions.
8 changes: 6 additions & 2 deletions DOCS/client-api-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ API changes

::

--- mpv 0.35.0 ---
2.0 - remove headers/functions of the obsolete opengl_cb API
- remove mpv_opengl_init_params.extra_exts field
- remove deprecated mpv_detach_destroy. Use mpv_destroy instead.
- remove obsolete mpv_suspend and mpv_resume
- remove deprecated SCRIPT_INPUT_DISPATCH, PAUSE and UNPAUSE events
--- mpv 0.33.0 ---
1.109 - add MPV_RENDER_API_TYPE_SW and related (software rendering API)
- inactivate the opengl_cb API (always fails to initialize now)
Expand All @@ -54,7 +60,6 @@ API changes
It is a good idea to write better wrappers for your use, though.
--- mpv 0.31.0 ---
1.107 - Deprecate MPV_EVENT_TICK

--- mpv 0.30.0 ---
1.106 - Add cancel_fn to mpv_stream_cb_info
1.105 - Fix deadlock problems with MPV_RENDER_PARAM_ADVANCED_CONTROL and if
Expand All @@ -72,7 +77,6 @@ API changes
- add mpv_abort_async_command()
1.102 - rename struct mpv_opengl_drm_osd_size to mpv_opengl_drm_draw_surface_size
- rename MPV_RENDER_PARAM_DRM_OSD_SIZE to MPV_RENDER_PARAM_DRM_DRAW_SURFACE_SIZE

--- mpv 0.29.0 ---
1.101 - add MPV_RENDER_PARAM_ADVANCED_CONTROL and related API
- add MPV_RENDER_PARAM_NEXT_FRAME_INFO and related symbols
Expand Down
2 changes: 1 addition & 1 deletion DOCS/man/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ This list uses the event name field value, and the C API symbol in brackets:
The new value of the property.

The following events also happen, but are deprecated: ``tracks-changed``,
``track-switched``, ``pause``, ``unpause``, ``metadata-update``, ``idle``,
``track-switched``, ``metadata-update``, ``idle``,
``tick``, ``chapter-change``. Use ``mpv_observe_property()``
(Lua: ``mp.observe_property()``) instead.

Expand Down
160 changes: 6 additions & 154 deletions libmpv/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,8 @@ extern "C" {
* This are the planned changes that will most likely be done on the next major
* bump of the library:
*
* - remove all symbols and include files that are marked as deprecated
* - remove all symbols that are marked as deprecated
* - reassign enum numerical values to remove gaps
* - remove the mpv_opengl_init_params.extra_exts field
* - change the type of mpv_event_end_file.reason
* - disabling all events by default
*/

Expand All @@ -244,7 +242,7 @@ extern "C" {
* relational operators (<, >, <=, >=).
*/
#define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 109)
#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(2, 0)

/**
* The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
Expand Down Expand Up @@ -510,26 +508,6 @@ MPV_EXPORT int mpv_initialize(mpv_handle *ctx);
*/
MPV_EXPORT void mpv_destroy(mpv_handle *ctx);

#if MPV_ENABLE_DEPRECATED
/**
* @deprecated use mpv_destroy(), which has exactly the same semantics (the
* deprecation is a mere rename)
*
* Since mpv client API version 1.29:
* If the last mpv_handle is detached, the core player is destroyed. In
* addition, if there are only weak mpv_handles (such as created by
* mpv_create_weak_client() or internal scripts), these mpv_handles will
* be sent MPV_EVENT_SHUTDOWN. This function may block until these clients
* have responded to the shutdown event, and the core is finally destroyed.
*
* Before mpv client API version 1.29:
* This left the player running. If you want to be sure that the
* player is terminated, send a "quit" command, and wait until the
* MPV_EVENT_SHUTDOWN event is received, or use mpv_terminate_destroy().
*/
MPV_EXPORT void mpv_detach_destroy(mpv_handle *ctx);
#endif

/**
* Similar to mpv_destroy(), but brings the player and all clients down
* as well, and waits until all of them are destroyed. This function blocks. The
Expand Down Expand Up @@ -617,43 +595,6 @@ MPV_EXPORT mpv_handle *mpv_create_weak_client(mpv_handle *ctx, const char *name)
*/
MPV_EXPORT int mpv_load_config_file(mpv_handle *ctx, const char *filename);

#if MPV_ENABLE_DEPRECATED

/**
* This does nothing since mpv 0.23.0 (API version 1.24). Below is the
* description of the old behavior.
*
* Stop the playback thread. This means the core will stop doing anything, and
* only run and answer to client API requests. This is sometimes useful; for
* example, no new frame will be queued to the video output, so doing requests
* which have to wait on the video output can run instantly.
*
* Suspension is reentrant and recursive for convenience. Any thread can call
* the suspend function multiple times, and the playback thread will remain
* suspended until the last thread resumes it. Note that during suspension, all
* clients still have concurrent access to the core, which is serialized through
* a single mutex.
*
* Call mpv_resume() to resume the playback thread. You must call mpv_resume()
* for each mpv_suspend() call. Calling mpv_resume() more often than
* mpv_suspend() is not allowed.
*
* Calling this on an uninitialized player (see mpv_create()) will deadlock.
*
* @deprecated This function, as well as mpv_resume(), are deprecated, and
* will stop doing anything soon. Their semantics were never
* well-defined, and their usefulness is extremely limited. The
* calls will remain stubs in order to keep ABI compatibility.
*/
MPV_EXPORT void mpv_suspend(mpv_handle *ctx);

/**
* See mpv_suspend().
*/
MPV_EXPORT void mpv_resume(mpv_handle *ctx);

#endif

/**
* Return the internal time in microseconds. This has an arbitrary start offset,
* but will never wrap or go backwards.
Expand Down Expand Up @@ -917,28 +858,11 @@ MPV_EXPORT void mpv_free_node_contents(mpv_node *node);
* Starting with mpv version 0.21.0 (version 1.23) most options can be set
* with mpv_set_property() (and related functions), and even before
* mpv_initialize(). In some obscure corner cases, using this function
* to set options might still be required (see below, and also section
* "Inconsistencies between options and properties" on the manpage). Once
* to set options might still be required (see
* "Inconsistencies between options and properties" in the manpage). Once
* these are resolved, the option setting functions might be fully
* deprecated.
*
* The following options still need to be set either _before_
* mpv_initialize() with mpv_set_property() (or related functions), or
* with mpv_set_option() (or related functions) at any time:
* - options shadowed by deprecated properties:
* - demuxer (property deprecated in 0.21.0)
* - idle (property deprecated in 0.21.0)
* - fps (property deprecated in 0.21.0)
* - cache (property deprecated in 0.21.0)
* - length (property deprecated in 0.10.0)
* - audio-samplerate (property deprecated in 0.10.0)
* - audio-channels (property deprecated in 0.10.0)
* - audio-format (property deprecated in 0.10.0)
* - deprecated options shadowed by properties:
* - chapter (option deprecated in 0.21.0)
* - playlist-pos (option deprecated in 0.21.0)
* The deprecated properties were removed in mpv 0.23.0.
*
* @param name Option name. This is the same as on the mpv command line, but
* without the leading "--".
* @param format see enum mpv_format.
Expand Down Expand Up @@ -1372,35 +1296,6 @@ typedef enum mpv_event_id {
* start of the program), while the property behaves correctly.
*/
MPV_EVENT_IDLE = 11,
/**
* Playback was paused. This indicates the user pause state.
*
* The user pause state is the state the user requested (changed with the
* "pause" property). There is an internal pause state too, which is entered
* if e.g. the network is too slow (the "core-idle" property generally
* indicates whether the core is playing or waiting).
*
* This event is sent whenever any pause states change, not only the user
* state. You might get multiple events in a row while these states change
* independently. But the event ID sent always indicates the user pause
* state.
*
* If you don't want to deal with this, use mpv_observe_property() on the
* "pause" property and ignore MPV_EVENT_PAUSE/UNPAUSE. Likewise, the
* "core-idle" property tells you whether video is actually playing or not.
*
* @deprecated The event is redundant with mpv_observe_property() as
* mentioned above, and might be removed in the far future.
*/
MPV_EVENT_PAUSE = 12,
/**
* Playback was unpaused. See MPV_EVENT_PAUSE for not so obvious details.
*
* @deprecated The event is redundant with mpv_observe_property() as
* explained in the MPV_EVENT_PAUSE comments, and might be
* removed in the far future.
*/
MPV_EVENT_UNPAUSE = 13,
/**
* Sent every time after a video frame is displayed. Note that currently,
* this will be sent in lower frequency if there is no video, or playback
Expand All @@ -1411,15 +1306,6 @@ typedef enum mpv_event_id {
* (such as "playback-time").
*/
MPV_EVENT_TICK = 14,
/**
* @deprecated This was used internally with the internal "script_dispatch"
* command to dispatch keyboard and mouse input for the OSC.
* It was never useful in general and has been completely
* replaced with "script-binding".
* This event never happens anymore, and is included in this
* header only for compatibility.
*/
MPV_EVENT_SCRIPT_INPUT_DISPATCH = 15,
#endif
/**
* Triggered by the script-message input command. The command uses the
Expand Down Expand Up @@ -1636,12 +1522,11 @@ typedef struct mpv_event_start_file {

typedef struct mpv_event_end_file {
/**
* Corresponds to the values in enum mpv_end_file_reason (the "int" type
* will be replaced with mpv_end_file_reason on the next ABI bump).
* Corresponds to the values in enum mpv_end_file_reason.
*
* Unknown values should be treated as unknown.
*/
int reason;
mpv_end_file_reason reason;
/**
* If reason==MPV_END_FILE_REASON_ERROR, this contains a mpv error code
* (one of MPV_ERROR_...) giving an approximate reason why playback
Expand Down Expand Up @@ -1679,15 +1564,6 @@ typedef struct mpv_event_end_file {
int playlist_insert_num_entries;
} mpv_event_end_file;

#if MPV_ENABLE_DEPRECATED
/** @deprecated see MPV_EVENT_SCRIPT_INPUT_DISPATCH for remarks
*/
typedef struct mpv_event_script_input_dispatch {
int arg0;
const char *type;
} mpv_event_script_input_dispatch;
#endif

typedef struct mpv_event_client_message {
/**
* Arbitrary arguments chosen by the sender of the message. If num_args > 0,
Expand Down Expand Up @@ -2043,30 +1919,6 @@ MPV_EXPORT int mpv_hook_continue(mpv_handle *ctx, uint64_t id);
*/
MPV_EXPORT int mpv_get_wakeup_pipe(mpv_handle *ctx);

/**
* @deprecated use render.h
*/
typedef enum mpv_sub_api {
/**
* For using mpv's OpenGL renderer on an external OpenGL context.
* mpv_get_sub_api(MPV_SUB_API_OPENGL_CB) returns mpv_opengl_cb_context*.
* This context can be used with mpv_opengl_cb_* functions.
* Will return NULL if unavailable (if OpenGL support was not compiled in).
* See opengl_cb.h for details.
*
* @deprecated use render.h
*/
MPV_SUB_API_OPENGL_CB = 1
} mpv_sub_api;

/**
* This is used for additional APIs that are not strictly part of the core API.
* See the individual mpv_sub_api member values.
*
* @deprecated use render.h
*/
MPV_EXPORT void *mpv_get_sub_api(mpv_handle *ctx, mpv_sub_api sub_api);

#endif

#ifdef __cplusplus
Expand Down
12 changes: 1 addition & 11 deletions libmpv/mpv.def
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mpv_create
mpv_create_client
mpv_create_weak_client
mpv_destroy
mpv_detach_destroy
mpv_error_string
mpv_event_to_node
mpv_event_name
Expand All @@ -22,20 +21,13 @@ mpv_get_property
mpv_get_property_async
mpv_get_property_osd_string
mpv_get_property_string
mpv_get_sub_api
mpv_get_time_us
mpv_get_wakeup_pipe
mpv_hook_add
mpv_hook_continue
mpv_initialize
mpv_load_config_file
mpv_observe_property
mpv_opengl_cb_draw
mpv_opengl_cb_init_gl
mpv_opengl_cb_report_flip
mpv_opengl_cb_render
mpv_opengl_cb_set_update_callback
mpv_opengl_cb_uninit_gl
mpv_render_context_create
mpv_render_context_free
mpv_render_context_get_info
Expand All @@ -46,17 +38,15 @@ mpv_render_context_set_update_callback
mpv_render_context_update
mpv_request_event
mpv_request_log_messages
mpv_resume
mpv_set_option
mpv_set_option_string
mpv_set_property
mpv_set_property_async
mpv_set_property_string
mpv_set_wakeup_callback
mpv_stream_cb_add_ro
mpv_suspend
mpv_terminate_destroy
mpv_unobserve_property
mpv_wait_async_requests
mpv_wait_event
mpv_wakeup
mpv_wakeup
Loading

0 comments on commit 6320598

Please sign in to comment.