History

command: add input-key-list property

wm4 committed 6 years ago

Commit a58b2df1 parent c6369934 files · +29 −0Browse files

Unified · Split

4 files
  1. DOCS/man/input.rst +3 −0
  2. input/keycodes.c +10 −0
  3. input/keycodes.h +1 −0
  4. player/command.c +15 −0
DOCS/man/input.rst+3−0
@@ -3046,6 +3046,9 @@ Property list · 3045 unmodified lines
3046 List of available libavformat demuxers' names. This can be used to check3046 List of available libavformat demuxers' names. This can be used to check
3047 for support for a specific format or use with ``--demuxer-lavf-format``.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``mpv-version``3052``mpv-version``
3050 Return the mpv version/copyright string. Depending on how the binary was3053 Return the mpv version/copyright string. Depending on how the binary was
3051 built, it might contain either a release version, or just a git hash.3054 built, it might contain either a release version, or just a git hash.
input/keycodes.c+10−0
@@ -322,6 +322,16 @@ void mp_print_key_list(struct mp_log *out) · 321 unmodified lines
322 mp_info(out, "%s\n", key_names[i].name);322 mp_info(out, "%s\n", key_names[i].name);
323}323}
324 324
325char **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
325int mp_normalize_keycode(int keycode)335int mp_normalize_keycode(int keycode)
326{336{
327 if (keycode <= 0)337 if (keycode <= 0)
input/keycodes.h+1−0
@@ -253,5 +253,6 @@ int mp_input_get_keys_from_string(char *str, int max_num_keys, · 252 unmodified lines
253 253
254struct mp_log;254struct mp_log;
255void mp_print_key_list(struct mp_log *out);255void mp_print_key_list(struct mp_log *out);
256char **mp_get_key_list(void);
256 257
257#endif /* MPLAYER_KEYCODES_H */258#endif /* MPLAYER_KEYCODES_H */
player/command.c+15−0
@@ -3016,6 +3016,20 @@ static int mp_property_protocols(void *ctx, struct m_property *prop, · 3015 unmodified lines
3016 return M_PROPERTY_NOT_IMPLEMENTED;3016 return M_PROPERTY_NOT_IMPLEMENTED;
3017}3017}
3018 3018
3019static 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
3019static int get_decoder_entry(int item, int action, void *arg, void *ctx)3033static int get_decoder_entry(int item, int action, void *arg, void *ctx)
3020{3034{
3021 struct mp_decoder_list *codecs = ctx;3035 struct mp_decoder_list *codecs = ctx;
@@ -3533,6 +3547,7 @@ static const struct m_property mp_properties_base[] = { · 511 unmodified lines
3533 {"decoder-list", mp_property_decoders},3547 {"decoder-list", mp_property_decoders},
3534 {"encoder-list", mp_property_encoders},3548 {"encoder-list", mp_property_encoders},
3535 {"demuxer-lavf-list", mp_property_lavf_demuxers},3549 {"demuxer-lavf-list", mp_property_lavf_demuxers},
3550 {"input-key-list", mp_property_keylist},
3536 3551
3537 {"mpv-version", mp_property_version},3552 {"mpv-version", mp_property_version},
3538 {"mpv-configuration", mp_property_configuration},3553 {"mpv-configuration", mp_property_configuration},

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t