+ */
+static subpicture_region_t *OSDIcon(int type, const video_format_t *fmt)
+{
+ const float size_ratio = 0.05;
+ const float margin_ratio = 0.07;
+
+ const int size = __MAX(fmt->i_visible_width, fmt->i_visible_height);
+ const int width = size * size_ratio;
+ const int height = size * size_ratio;
+ const int x = fmt->i_x_offset + fmt->i_visible_width - margin_ratio * size - width;
+ const int y = fmt->i_y_offset + margin_ratio * size;
+
+ subpicture_region_t *r = OSDRegion(__MAX(x, 0),
+ __MIN(y, (int)fmt->i_visible_height - height),
+ width, height);
+ if (!r)
+ return NULL;
+
+ if (type == OSD_PAUSE_ICON) {
+ int bar_width = width / 3;
+ DrawRect(r, STYLE_FILLED, 0, 0, bar_width - 1, height -1);
+ DrawRect(r, STYLE_FILLED, width - bar_width, 0, width - 1, height - 1);
+ } else if (type == OSD_PLAY_ICON) {
+ int mid = height >> 1;
+ int delta = (width - mid) >> 1;
+ int y2 = ((height - 1) >> 1) * 2;
+ DrawTriangle(r, STYLE_FILLED, delta, 0, width - delta, y2);
+ } else {
+ int mid = height >> 1;
+ int delta = (width - mid) >> 1;
+ int y2 = ((height - 1) >> 1) * 2;
+ DrawRect(r, STYLE_FILLED, delta, mid / 2, width - delta, height - 1 - mid / 2);
+ DrawTriangle(r, STYLE_FILLED, width - delta, 0, delta, y2);
+ if (type == OSD_MUTE_ICON) {
+ uint8_t *a = r->p_picture->A_PIXELS;
+ int pitch = r->p_picture->A_PITCH;
+ for (int i = 1; i < pitch; i++) {
+ int k = i + (height - i - 1) * pitch;
+ a[k] = 0xff - a[k];
+ }
+ }
+ }
+ return r;
+}
+
+struct subpicture_updater_sys_t {
+ int type;
+ int position;
+};
+
+static int OSDWidgetValidate(subpicture_t *subpic,
+ bool has_src_changed, const video_format_t *fmt_src,
+ bool has_dst_changed, const video_format_t *fmt_dst,
+ mtime_t ts)
+{
+ VLC_UNUSED(subpic); VLC_UNUSED(ts); VLC_UNUSED(fmt_src);
+ VLC_UNUSED(has_dst_changed); VLC_UNUSED(fmt_dst);
+
+ if (!has_src_changed && !has_dst_changed)
+ return VLC_SUCCESS;
+ return VLC_EGENERIC;
+}
+
+static void OSDWidgetUpdate(subpicture_t *subpic,
+ const video_format_t *fmt_src,
+ const video_format_t *fmt_dst,
+ mtime_t ts)
+{
+ subpicture_updater_sys_t *sys = subpic->updater.p_sys;
+ VLC_UNUSED(fmt_dst); VLC_UNUSED(ts);
+
+ subpic->i_original_picture_width = fmt_src->i_width;
+ subpic->i_original_picture_height = fmt_src->i_height;
+ if (sys->type == OSD_HOR_SLIDER || sys->type == OSD_VERT_SLIDER)
+ subpic->p_region = OSDSlider(sys->type, sys->position, fmt_src);
+ else
+ subpic->p_region = OSDIcon(sys->type, fmt_src);
+}
+
+static void OSDWidgetDestroy(subpicture_t *subpic)