Unified · Split
| @@ -3046,6 +3046,9 @@ Property list · 3045 unmodified lines | ||
| 3046 | 3046 | List of available libavformat demuxers' names. This can be used to check |
| 3047 | 3047 | for support for a specific format or use with ``--demuxer-lavf-format``. |
| 3048 | 3048 | |
| 3049 | +``input-key-list`` | |
| 3050 | + List of `Key names`_, same as output by ``--input-keylist``. | |
| 3051 | + | |
| 3049 | 3052 | ``mpv-version`` |
| 3050 | 3053 | Return the mpv version/copyright string. Depending on how the binary was |
| 3051 | 3054 | built, it might contain either a release version, or just a git hash. |
| @@ -322,6 +322,16 @@ void mp_print_key_list(struct mp_log *out) · 321 unmodified lines | ||
| 322 | 322 | mp_info(out, "%s\n", key_names[i].name); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | +char **mp_get_key_list(void) | |
| 326 | +{ | |
| 327 | + char **list = NULL; | |
| 328 | + int num = 0; | |
| 329 | + for (int i = 0; key_names[i].name != NULL; i++) | |
| 330 | + MP_TARRAY_APPEND(NULL, list, num, talloc_strdup(NULL, key_names[i].name)); | |
| 331 | + MP_TARRAY_APPEND(NULL, list, num, NULL); | |
| 332 | + return list; | |
| 333 | +} | |
| 334 | + | |
| 325 | 335 | int mp_normalize_keycode(int keycode) |
| 326 | 336 | { |
| 327 | 337 | if (keycode <= 0) |
| @@ -253,5 +253,6 @@ int mp_input_get_keys_from_string(char *str, int max_num_keys, · 252 unmodified lines | ||
| 253 | 253 | |
| 254 | 254 | struct mp_log; |
| 255 | 255 | void mp_print_key_list(struct mp_log *out); |
| 256 | +char **mp_get_key_list(void); | |
| 256 | 257 | |
| 257 | 258 | #endif /* MPLAYER_KEYCODES_H */ |
| @@ -3016,6 +3016,20 @@ static int mp_property_protocols(void *ctx, struct m_property *prop, · 3015 unmodified lines | ||
| 3016 | 3016 | return M_PROPERTY_NOT_IMPLEMENTED; |
| 3017 | 3017 | } |
| 3018 | 3018 | |
| 3019 | +static int mp_property_keylist(void *ctx, struct m_property *prop, | |
| 3020 | + int action, void *arg) | |
| 3021 | +{ | |
| 3022 | + switch (action) { | |
| 3023 | + case M_PROPERTY_GET: | |
| 3024 | + *(char ***)arg = mp_get_key_list(); | |
| 3025 | + return M_PROPERTY_OK; | |
| 3026 | + case M_PROPERTY_GET_TYPE: | |
| 3027 | + *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING_LIST}; | |
| 3028 | + return M_PROPERTY_OK; | |
| 3029 | + } | |
| 3030 | + return M_PROPERTY_NOT_IMPLEMENTED; | |
| 3031 | +} | |
| 3032 | + | |
| 3019 | 3033 | static int get_decoder_entry(int item, int action, void *arg, void *ctx) |
| 3020 | 3034 | { |
| 3021 | 3035 | struct mp_decoder_list *codecs = ctx; |
| @@ -3533,6 +3547,7 @@ static const struct m_property mp_properties_base[] = { · 511 unmodified lines | ||
| 3533 | 3547 | {"decoder-list", mp_property_decoders}, |
| 3534 | 3548 | {"encoder-list", mp_property_encoders}, |
| 3535 | 3549 | {"demuxer-lavf-list", mp_property_lavf_demuxers}, |
| 3550 | + {"input-key-list", mp_property_keylist}, | |
| 3536 | 3551 | |
| 3537 | 3552 | {"mpv-version", mp_property_version}, |
| 3538 | 3553 | {"mpv-configuration", mp_property_configuration}, |