Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion input/cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "misc/bstr.h"
#include "options/m_option.h"

#define MP_CMD_DEF_MAX_ARGS 9
#define MP_CMD_DEF_MAX_ARGS 11
#define MP_CMD_OPT_ARG M_OPT_OPTIONAL_PARAM

struct mp_log;
Expand Down
16 changes: 13 additions & 3 deletions player/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ static const struct m_option script_props_type = {
struct overlay {
struct mp_image *source;
int x, y;
int dw, dh;
};

struct hook_handler {
Expand Down Expand Up @@ -4201,8 +4202,8 @@ static void recreate_overlays(struct MPContext *mpctx)
struct sub_bitmap b = {
.bitmap = s->planes[0],
.stride = s->stride[0],
.w = s->w, .dw = s->w,
.h = s->h, .dh = s->h,
.w = s->w, .dw = o->dw,
.h = s->h, .dh = o->dh,
.x = o->x,
.y = o->y,
};
Expand Down Expand Up @@ -4299,7 +4300,12 @@ static void cmd_overlay_add(void *pcmd)
int offset = cmd->args[4].v.i;
char *fmt = cmd->args[5].v.s;
int w = cmd->args[6].v.i, h = cmd->args[7].v.i, stride = cmd->args[8].v.i;
int dw = cmd->args[9].v.i, dh = cmd->args[10].v.i;

if (dw <= 0)
dw = w;
if (dh <= 0)
dh = h;
if (strcmp(fmt, "bgra") != 0) {
MP_ERR(mpctx, "overlay-add: unsupported OSD format '%s'\n", fmt);
goto error;
Expand All @@ -4316,6 +4322,8 @@ static void cmd_overlay_add(void *pcmd)
.source = mp_image_alloc(IMGFMT_BGRA, w, h),
.x = x,
.y = y,
.dw = dw,
.dh = dh,
};
if (!overlay.source)
goto error;
Expand Down Expand Up @@ -6385,7 +6393,9 @@ const struct mp_cmd_def mp_cmds[] = {
{"fmt", OPT_STRING(v.s)},
{"w", OPT_INT(v.i)},
{"h", OPT_INT(v.i)},
{"stride", OPT_INT(v.i)}, }},
{"stride", OPT_INT(v.i)},
{"dw", OPT_INT(v.i)},
{"dh", OPT_INT(v.i)}, }},
{ "overlay-remove", cmd_overlay_remove, { {"id", OPT_INT(v.i)} } },

{ "osd-overlay", cmd_osd_overlay,
Expand Down