History

clipboard-vo: make logging verbose when clipboard is unavailable

It now only warns when the clipboard is implemented but get/set failed. This is consistent with other properties like current-vo.

nanahi committed 1 year ago

Commit e121c091 parent e62503c1 file · +18 −6Browse files

Unified · Split

player/clipboard/clipboard-vo.c+18−6
@@ -45,11 +45,17 @@ static int get_data(struct clipboard_ctx *cl, struct clipboard_access_params *pa · 44 unmodified lines
4545
4646 if (!vo)
4747 return CLIPBOARD_UNAVAILABLE;
48− if (vo_control(vo, VOCTRL_GET_CLIPBOARD, &vc) == VO_TRUE) {
48+ int ret = vo_control(vo, VOCTRL_GET_CLIPBOARD, &vc);
49+ switch (ret) {
50+ case VO_TRUE:
4951 *out = vc.data;
5052 return CLIPBOARD_SUCCESS;
51− } else {
52− MP_WARN(cl, "VO is not initialized, or it does not support getting clipboard.\n");
53+ case VO_NOTAVAIL:
54+ case VO_NOTIMPL:
55+ MP_VERBOSE(cl, "VO does not support getting clipboard in the requested format.\n");
56+ return CLIPBOARD_UNAVAILABLE;
57+ default:
58+ MP_WARN(cl, "Failed getting VO clipboard.\n");
5359 return CLIPBOARD_FAILED;
5460 }
5561 }
@@ -66,10 +72,16 @@ static int set_data(struct clipboard_ctx *cl, struct clipboard_access_params *pa · 10 unmodified lines
6672
6773 if (!vo)
6874 return CLIPBOARD_UNAVAILABLE;
69− if (vo_control(vo, VOCTRL_SET_CLIPBOARD, &vc) == VO_TRUE) {
75+ int ret = vo_control(vo, VOCTRL_SET_CLIPBOARD, &vc);
76+ switch (ret) {
77+ case VO_TRUE:
7078 return CLIPBOARD_SUCCESS;
71− } else {
72− MP_WARN(cl, "VO is not initialized, or it does not support setting clipboard.\n");
79+ case VO_NOTAVAIL:
80+ case VO_NOTIMPL:
81+ MP_VERBOSE(cl, "VO does not support setting clipboard in the requested format.\n");
82+ return CLIPBOARD_UNAVAILABLE;
83+ default:
84+ MP_WARN(cl, "Failed setting VO clipboard.\n");
7385 return CLIPBOARD_FAILED;
7486 }
7587 }

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