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
30463046 List of available libavformat demuxers' names. This can be used to check
30473047 for support for a specific format or use with ``--demuxer-lavf-format``.
30483048
3049+``input-key-list``
3050+ List of `Key names`_, same as output by ``--input-keylist``.
3051+
30493052 ``mpv-version``
30503053 Return the mpv version/copyright string. Depending on how the binary was
30513054 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
322322 mp_info(out, "%s\n", key_names[i].name);
323323 }
324324
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+
325335 int mp_normalize_keycode(int keycode)
326336 {
327337 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
253253
254254 struct mp_log;
255255 void mp_print_key_list(struct mp_log *out);
256+char **mp_get_key_list(void);
256257
257258 #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
30163016 return M_PROPERTY_NOT_IMPLEMENTED;
30173017 }
30183018
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+
30193033 static int get_decoder_entry(int item, int action, void *arg, void *ctx)
30203034 {
30213035 struct mp_decoder_list *codecs = ctx;
@@ -3533,6 +3547,7 @@ static const struct m_property mp_properties_base[] = { · 511 unmodified lines
35333547 {"decoder-list", mp_property_decoders},
35343548 {"encoder-list", mp_property_encoders},
35353549 {"demuxer-lavf-list", mp_property_lavf_demuxers},
3550+ {"input-key-list", mp_property_keylist},
35363551
35373552 {"mpv-version", mp_property_version},
35383553 {"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