Commit 9b67948
committed
osc: define and add support for "thumbnailer" api
this adds a "standard" api for ui scripts and thumbnailers to
communicate with each other, based on the simple thumbfast api
[1].
the api works as follows:
* If a thumbnailer script is active, it will set
`user-data/thumbnailer` property with the width and height of
the thumbnail. UI scripts can observe this property to know
the thumbnail w/h along with whether thumbnailer is active or
not.
* To issue a thumbnail draw command, the UI script will set the property
`user-data/osc/thumbnailer` with `hover_sec`, `x` and `y`
field set.
* To clear the thumbnail, the UI script will set the previously
mentioned property to `nil`.
a more ideal api would make it so that the thumbnailer script
only generates the thumbnail and doesn't need to draw at all.
but this is a decent enough api that allows arbitrary
thumbnailers and ui scripts to communicate between each other
and work together.
this change has been tested with work with thumbfast (using the
"thumbfast-glue" script below). and for demonstration that this
api can be useful outside of osc, it has also been tested to
work on mfpbar's thumbnailer branch [3].
the code to determine thumbnail x,y is based on the osc fork
inside of thumbfast [2].
[1]: https://github.com/po5/thumbfast?tab=readme-ov-file#for-ui-developers-how-to-add-thumbfast-support-to-your-script
[2]: https://github.com/po5/thumbfast/tree/vanilla-osc
[3]: https://codeberg.org/NRK/mpv-toolbox/src/branch/thumbnailer/mfpbar1 parent 3b55bc9 commit 9b67948
1 file changed
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| |||
1063 | 1064 | | |
1064 | 1065 | | |
1065 | 1066 | | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
1066 | 1089 | | |
1067 | 1090 | | |
1068 | 1091 | | |
| |||
2734 | 2757 | | |
2735 | 2758 | | |
2736 | 2759 | | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
2737 | 2767 | | |
2738 | 2768 | | |
2739 | 2769 | | |
| |||
0 commit comments