|
| 1 | +# This program is free software: you can redistribute it and/or modify |
| 2 | +# it under the terms of the GNU General Public License as published by |
| 3 | +# the Free Software Foundation, either version 3 of the License, or |
| 4 | +# (at your option) any later version. |
| 5 | +# |
| 6 | +# This program is distributed in the hope that it will be useful, |
| 7 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 8 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 9 | +# GNU General Public License for more details. |
| 10 | +# |
| 11 | +# You should have received a copy of the GNU General Public License |
| 12 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 13 | + |
| 14 | +cdef extern from "mpv/client.h": |
| 15 | + |
| 16 | + ctypedef signed char int8_t |
| 17 | + |
| 18 | + ctypedef short int16_t |
| 19 | + |
| 20 | + ctypedef int int32_t |
| 21 | + |
| 22 | + ctypedef long int64_t |
| 23 | + |
| 24 | + ctypedef unsigned char uint8_t |
| 25 | + |
| 26 | + ctypedef unsigned short uint16_t |
| 27 | + |
| 28 | + ctypedef unsigned int uint32_t |
| 29 | + |
| 30 | + ctypedef unsigned long uint64_t |
| 31 | + |
| 32 | + ctypedef signed char int_least8_t |
| 33 | + |
| 34 | + ctypedef short int_least16_t |
| 35 | + |
| 36 | + ctypedef int int_least32_t |
| 37 | + |
| 38 | + ctypedef long int_least64_t |
| 39 | + |
| 40 | + ctypedef unsigned char uint_least8_t |
| 41 | + |
| 42 | + ctypedef unsigned short uint_least16_t |
| 43 | + |
| 44 | + ctypedef unsigned int uint_least32_t |
| 45 | + |
| 46 | + ctypedef unsigned long uint_least64_t |
| 47 | + |
| 48 | + ctypedef signed char int_fast8_t |
| 49 | + |
| 50 | + ctypedef long int_fast16_t |
| 51 | + |
| 52 | + ctypedef long int_fast32_t |
| 53 | + |
| 54 | + ctypedef long int_fast64_t |
| 55 | + |
| 56 | + ctypedef unsigned char uint_fast8_t |
| 57 | + |
| 58 | + ctypedef unsigned long uint_fast16_t |
| 59 | + |
| 60 | + ctypedef unsigned long uint_fast32_t |
| 61 | + |
| 62 | + ctypedef unsigned long uint_fast64_t |
| 63 | + |
| 64 | + ctypedef long intptr_t |
| 65 | + |
| 66 | + ctypedef unsigned long uintptr_t |
| 67 | + |
| 68 | + ctypedef long intmax_t |
| 69 | + |
| 70 | + ctypedef unsigned long uintmax_t |
| 71 | + |
| 72 | + unsigned long mpv_client_api_version() nogil |
| 73 | + |
| 74 | + cdef struct mpv_handle: |
| 75 | + pass |
| 76 | + |
| 77 | + cdef enum mpv_error: |
| 78 | + MPV_ERROR_SUCCESS |
| 79 | + MPV_ERROR_EVENT_QUEUE_FULL |
| 80 | + MPV_ERROR_NOMEM |
| 81 | + MPV_ERROR_UNINITIALIZED |
| 82 | + MPV_ERROR_INVALID_PARAMETER |
| 83 | + MPV_ERROR_OPTION_NOT_FOUND |
| 84 | + MPV_ERROR_OPTION_FORMAT |
| 85 | + MPV_ERROR_OPTION_ERROR |
| 86 | + MPV_ERROR_PROPERTY_NOT_FOUND |
| 87 | + MPV_ERROR_PROPERTY_FORMAT |
| 88 | + MPV_ERROR_PROPERTY_UNAVAILABLE |
| 89 | + MPV_ERROR_PROPERTY_ERROR |
| 90 | + MPV_ERROR_COMMAND |
| 91 | + MPV_ERROR_LOADING_FAILED |
| 92 | + MPV_ERROR_AO_INIT_FAILED |
| 93 | + MPV_ERROR_VO_INIT_FAILED |
| 94 | + MPV_ERROR_NOTHING_TO_PLAY |
| 95 | + MPV_ERROR_UNKNOWN_FORMAT |
| 96 | + MPV_ERROR_UNSUPPORTED |
| 97 | + MPV_ERROR_NOT_IMPLEMENTED |
| 98 | + |
| 99 | + const char *mpv_error_string(int error) nogil |
| 100 | + |
| 101 | + void mpv_free(void *data) nogil |
| 102 | + |
| 103 | + const char *mpv_client_name(mpv_handle *ctx) nogil |
| 104 | + |
| 105 | + mpv_handle *mpv_create() nogil |
| 106 | + |
| 107 | + int mpv_initialize(mpv_handle *ctx) nogil |
| 108 | + |
| 109 | + void mpv_detach_destroy(mpv_handle *ctx) nogil |
| 110 | + |
| 111 | + void mpv_terminate_destroy(mpv_handle *ctx) nogil |
| 112 | + |
| 113 | + int mpv_load_config_file(mpv_handle *ctx, const char *filename) nogil |
| 114 | + |
| 115 | + void mpv_suspend(mpv_handle *ctx) nogil |
| 116 | + |
| 117 | + void mpv_resume(mpv_handle *ctx) nogil |
| 118 | + |
| 119 | + int64_t mpv_get_time_us(mpv_handle *ctx) nogil |
| 120 | + |
| 121 | + cdef enum mpv_format: |
| 122 | + MPV_FORMAT_NONE |
| 123 | + MPV_FORMAT_STRING |
| 124 | + MPV_FORMAT_OSD_STRING |
| 125 | + MPV_FORMAT_FLAG |
| 126 | + MPV_FORMAT_INT64 |
| 127 | + MPV_FORMAT_DOUBLE |
| 128 | + MPV_FORMAT_NODE |
| 129 | + MPV_FORMAT_NODE_ARRAY |
| 130 | + MPV_FORMAT_NODE_MAP |
| 131 | + |
| 132 | + cdef struct ____mpv_node_u_mpv_node_list: |
| 133 | + pass |
| 134 | + |
| 135 | + ctypedef ____mpv_node_u_mpv_node_list ____mpv_node_u_mpv_node_list_t |
| 136 | + |
| 137 | + cdef union __mpv_node_u: |
| 138 | + char *string |
| 139 | + int flag |
| 140 | + int64_t int64 |
| 141 | + double double_ |
| 142 | + mpv_node_list *list |
| 143 | + |
| 144 | + ctypedef __mpv_node_u __mpv_node_u_t |
| 145 | + |
| 146 | + cdef struct mpv_node: |
| 147 | + __mpv_node_u_t u |
| 148 | + mpv_format format |
| 149 | + |
| 150 | + cdef struct mpv_node_list: |
| 151 | + int num |
| 152 | + mpv_node *values |
| 153 | + char **keys |
| 154 | + |
| 155 | + cdef struct mpv_byte_array: |
| 156 | + void *data |
| 157 | + size_t size |
| 158 | + |
| 159 | + void mpv_free_node_contents(mpv_node *node) nogil |
| 160 | + |
| 161 | + int mpv_set_option(mpv_handle *ctx, const char *name, mpv_format format, void *data) nogil |
| 162 | + |
| 163 | + int mpv_set_option_string(mpv_handle *ctx, const char *name, const char *data) nogil |
| 164 | + |
| 165 | + int mpv_command(mpv_handle *ctx, const char **args) nogil |
| 166 | + |
| 167 | + int mpv_command_node(mpv_handle *ctx, mpv_node *args, mpv_node *result) nogil |
| 168 | + |
| 169 | + int mpv_command_string(mpv_handle *ctx, const char *args) nogil |
| 170 | + |
| 171 | + int mpv_command_async(mpv_handle *ctx, uint64_t reply_userdata, const char **args) nogil |
| 172 | + |
| 173 | + int mpv_command_node_async(mpv_handle *ctx, uint64_t reply_userdata, mpv_node *args) nogil |
| 174 | + |
| 175 | + int mpv_set_property(mpv_handle *ctx, const char *name, mpv_format format, void *data) nogil |
| 176 | + |
| 177 | + int mpv_set_property_string(mpv_handle *ctx, const char *name, const char *data) nogil |
| 178 | + |
| 179 | + int mpv_set_property_async(mpv_handle *ctx, uint64_t reply_userdata, const char *name, mpv_format format, void *data) nogil |
| 180 | + |
| 181 | + int mpv_get_property(mpv_handle *ctx, const char *name, mpv_format format, void *data) nogil |
| 182 | + |
| 183 | + char *mpv_get_property_string(mpv_handle *ctx, const char *name) nogil |
| 184 | + |
| 185 | + char *mpv_get_property_osd_string(mpv_handle *ctx, const char *name) nogil |
| 186 | + |
| 187 | + int mpv_get_property_async(mpv_handle *ctx, uint64_t reply_userdata, const char *name, mpv_format format) nogil |
| 188 | + |
| 189 | + int mpv_observe_property(mpv_handle *mpv, uint64_t reply_userdata, const char *name, mpv_format format) nogil |
| 190 | + |
| 191 | + int mpv_unobserve_property(mpv_handle *mpv, uint64_t registered_reply_userdata) nogil |
| 192 | + |
| 193 | + enum mpv_event_id: |
| 194 | + MPV_EVENT_NONE |
| 195 | + MPV_EVENT_SHUTDOWN |
| 196 | + MPV_EVENT_LOG_MESSAGE |
| 197 | + MPV_EVENT_GET_PROPERTY_REPLY |
| 198 | + MPV_EVENT_SET_PROPERTY_REPLY |
| 199 | + MPV_EVENT_COMMAND_REPLY |
| 200 | + MPV_EVENT_START_FILE |
| 201 | + MPV_EVENT_END_FILE |
| 202 | + MPV_EVENT_FILE_LOADED |
| 203 | + MPV_EVENT_TRACKS_CHANGED |
| 204 | + MPV_EVENT_TRACK_SWITCHED |
| 205 | + MPV_EVENT_IDLE |
| 206 | + MPV_EVENT_PAUSE |
| 207 | + MPV_EVENT_UNPAUSE |
| 208 | + MPV_EVENT_TICK |
| 209 | + MPV_EVENT_SCRIPT_INPUT_DISPATCH |
| 210 | + MPV_EVENT_CLIENT_MESSAGE |
| 211 | + MPV_EVENT_VIDEO_RECONFIG |
| 212 | + MPV_EVENT_AUDIO_RECONFIG |
| 213 | + MPV_EVENT_METADATA_UPDATE |
| 214 | + MPV_EVENT_SEEK |
| 215 | + MPV_EVENT_PLAYBACK_RESTART |
| 216 | + MPV_EVENT_PROPERTY_CHANGE |
| 217 | + MPV_EVENT_CHAPTER_CHANGE |
| 218 | + |
| 219 | + const char *mpv_event_name(mpv_event_id event) nogil |
| 220 | + |
| 221 | + cdef struct mpv_event_property: |
| 222 | + const char *name |
| 223 | + mpv_format format |
| 224 | + void *data |
| 225 | + |
| 226 | + enum mpv_log_level: |
| 227 | + MPV_LOG_LEVEL_NONE |
| 228 | + MPV_LOG_LEVEL_FATAL |
| 229 | + MPV_LOG_LEVEL_ERROR |
| 230 | + MPV_LOG_LEVEL_WARN |
| 231 | + MPV_LOG_LEVEL_INFO |
| 232 | + MPV_LOG_LEVEL_V |
| 233 | + MPV_LOG_LEVEL_DEBUG |
| 234 | + MPV_LOG_LEVEL_TRACE |
| 235 | + |
| 236 | + cdef struct mpv_event_log_message: |
| 237 | + const char *prefix |
| 238 | + const char *level |
| 239 | + const char *text |
| 240 | + int log_level |
| 241 | + |
| 242 | + enum mpv_end_file_reason: |
| 243 | + MPV_END_FILE_REASON_EOF |
| 244 | + MPV_END_FILE_REASON_STOP |
| 245 | + MPV_END_FILE_REASON_QUIT |
| 246 | + MPV_END_FILE_REASON_ERROR |
| 247 | + |
| 248 | + cdef struct mpv_event_end_file: |
| 249 | + int reason |
| 250 | + int error |
| 251 | + |
| 252 | + cdef struct mpv_event_script_input_dispatch: |
| 253 | + int arg0 |
| 254 | + const char *type |
| 255 | + |
| 256 | + cdef struct mpv_event_client_message: |
| 257 | + int num_args |
| 258 | + const char **args |
| 259 | + |
| 260 | + cdef struct mpv_event: |
| 261 | + mpv_event_id event_id |
| 262 | + int error |
| 263 | + uint64_t reply_userdata |
| 264 | + void *data |
| 265 | + |
| 266 | + int mpv_request_event(mpv_handle *ctx, mpv_event_id event, int enable) nogil |
| 267 | + |
| 268 | + int mpv_request_log_messages(mpv_handle *ctx, const char *min_level) nogil |
| 269 | + |
| 270 | + mpv_event *mpv_wait_event(mpv_handle *ctx, double timeout) nogil |
| 271 | + |
| 272 | + void mpv_wakeup(mpv_handle *ctx) nogil |
| 273 | + |
| 274 | + void mpv_set_wakeup_callback(mpv_handle *ctx, void (*cb)(void *), void *d) nogil |
| 275 | + |
| 276 | + int mpv_get_wakeup_pipe(mpv_handle *ctx) nogil |
| 277 | + |
| 278 | + void mpv_wait_async_requests(mpv_handle *ctx) nogil |
| 279 | + |
| 280 | + enum mpv_sub_api: |
| 281 | + MPV_SUB_API_OPENGL_CB |
| 282 | + |
| 283 | + void *mpv_get_sub_api(mpv_handle *ctx, mpv_sub_api sub_api) nogil |
| 284 | + |
| 285 | +cdef extern from "mpv/opengl_cb.h": |
| 286 | + struct mpv_opengl_cb_context: |
| 287 | + pass |
| 288 | + |
| 289 | + ctypedef void (*mpv_opengl_cb_update_fn)(void *cb_ctx) nogil |
| 290 | + ctypedef void *(*mpv_opengl_cb_get_proc_address_fn)(void *fn_ctx, |
| 291 | + const char *name) nogil |
| 292 | + |
| 293 | + void mpv_opengl_cb_set_update_callback(mpv_opengl_cb_context *ctx, |
| 294 | + mpv_opengl_cb_update_fn callback, |
| 295 | + void *callback_ctx) nogil |
| 296 | + |
| 297 | + int mpv_opengl_cb_init_gl(mpv_opengl_cb_context *ctx, const char *exts, |
| 298 | + mpv_opengl_cb_get_proc_address_fn get_proc_address, |
| 299 | + void *get_proc_address_ctx) nogil |
| 300 | + |
| 301 | + int mpv_opengl_cb_draw(mpv_opengl_cb_context *ctx, int fbo, int w, int h) nogil |
| 302 | + |
| 303 | + int mpv_opengl_cb_report_flip(mpv_opengl_cb_context *ctx, int64_t time) nogil |
| 304 | + |
| 305 | + int mpv_opengl_cb_uninit_gl(mpv_opengl_cb_context *ctx) nogil |
| 306 | + |
| 307 | + |
| 308 | +cdef extern from "mpv/render.h": |
| 309 | + struct mpv_render_context: |
| 310 | + pass |
| 311 | + |
| 312 | + enum mpv_render_param_type: |
| 313 | + MPV_RENDER_PARAM_INVALID |
| 314 | + MPV_RENDER_PARAM_API_TYPE |
| 315 | + MPV_RENDER_PARAM_OPENGL_INIT_PARAMS |
| 316 | + MPV_RENDER_PARAM_OPENGL_FBO |
| 317 | + MPV_RENDER_PARAM_FLIP_Y |
| 318 | + MPV_RENDER_PARAM_DEPTH |
| 319 | + MPV_RENDER_PARAM_ICC_PROFILE |
| 320 | + MPV_RENDER_PARAM_AMBIENT_LIGHT |
| 321 | + MPV_RENDER_PARAM_X11_DISPLAY |
| 322 | + MPV_RENDER_PARAM_WL_DISPLAY |
| 323 | + MPV_RENDER_PARAM_ADVANCED_CONTROL |
| 324 | + MPV_RENDER_PARAM_NEXT_FRAME_INFO |
| 325 | + MPV_RENDER_PARAM_BLOCK_FOR_TARGET_TIME |
| 326 | + MPV_RENDER_PARAM_SKIP_RENDERING |
| 327 | + MPV_RENDER_PARAM_DRM_DISPLAY |
| 328 | + MPV_RENDER_PARAM_DRM_OSD_SIZE |
| 329 | + |
| 330 | + char *MPV_RENDER_API_TYPE_OPENGL |
| 331 | + |
| 332 | + enum mpv_render_frame_info_flag: |
| 333 | + MPV_RENDER_FRAME_INFO_PRESENT |
| 334 | + MPV_RENDER_FRAME_INFO_REDRAW |
| 335 | + MPV_RENDER_FRAME_INFO_REPEAT |
| 336 | + MPV_RENDER_FRAME_INFO_BLOCK_VSYNC |
| 337 | + |
| 338 | + struct mpv_render_param: |
| 339 | + mpv_render_param_type type |
| 340 | + void *data |
| 341 | + |
| 342 | + struct mpv_render_frame_info: |
| 343 | + uint64_t flags |
| 344 | + int64_t target_time |
| 345 | + |
| 346 | + int mpv_render_context_create(mpv_render_context **res, mpv_handle *mpv, |
| 347 | + mpv_render_param *params) nogil |
| 348 | + |
| 349 | + int mpv_render_context_set_parameter(mpv_render_context *ctx, |
| 350 | + mpv_render_param param) nogil |
| 351 | + |
| 352 | + int mpv_render_context_get_info(mpv_render_context *ctx, |
| 353 | + mpv_render_param param) nogil |
| 354 | + |
| 355 | + ctypedef void (*mpv_render_update_fn)(void *cb_ctx) nogil |
| 356 | + |
| 357 | + void mpv_render_context_set_update_callback(mpv_render_context *ctx, |
| 358 | + mpv_render_update_fn callback, |
| 359 | + void *callback_ctx) nogil |
| 360 | + |
| 361 | + uint64_t mpv_render_context_update(mpv_render_context *ctx) nogil |
| 362 | + |
| 363 | + enum mpv_render_update_flag: |
| 364 | + MPV_RENDER_UPDATE_FRAME |
| 365 | + |
| 366 | + int mpv_render_context_render(mpv_render_context *ctx, mpv_render_param *params) nogil |
| 367 | + |
| 368 | + void mpv_render_context_report_swap(mpv_render_context *ctx) nogil |
| 369 | + |
| 370 | + void mpv_render_context_free(mpv_render_context *ctx) nogil |
| 371 | + |
| 372 | +cdef extern from "mpv/render_gl.h": |
| 373 | + struct mpv_opengl_init_params: |
| 374 | + void *(*get_proc_address)(void *ctx, const char *name) |
| 375 | + void *get_proc_address_ctx |
| 376 | + const char *extra_exts |
| 377 | + |
| 378 | + struct mpv_opengl_fbo: |
| 379 | + int fbo |
| 380 | + int w |
| 381 | + int h |
| 382 | + int internal_format |
| 383 | + |
| 384 | + struct _drmModeAtomicReq: |
| 385 | + pass |
| 386 | + |
| 387 | + struct mpv_opengl_drm_params: |
| 388 | + int fd |
| 389 | + int crtc_id |
| 390 | + int connector_id |
| 391 | + _drmModeAtomicReq **atomic_request_ptr |
| 392 | + int render_fd |
| 393 | + |
| 394 | + struct mpv_opengl_drm_osd_size: |
| 395 | + int width |
| 396 | + int height |
0 commit comments