summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/command.c58
-rw-r--r--player/core.h17
-rw-r--r--player/osd.c24
-rw-r--r--player/screenshot.c6
4 files changed, 39 insertions, 66 deletions
diff --git a/player/command.c b/player/command.c
index 646b96864a..2334e844b4 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2098,8 +2098,6 @@ static struct property_osd_display {
const char *osd_name;
// progressbar type
int osd_progbar;
- // osd msg id if it must be shared
- int osd_id;
// Needs special ways to display the new value (seeks are delayed)
int seek_msg, seek_bar;
// Free-form message (if NULL, osd_name or the property name is used)
@@ -2142,7 +2140,7 @@ static struct property_osd_display {
{ "sub", "Subtitles" },
{ "secondary-sid", "Secondary subtitles" },
{ "sub-pos", "Sub position" },
- { "sub-delay", "Sub delay", .osd_id = OSD_MSG_SUB_DELAY },
+ { "sub-delay", "Sub delay" },
{ "sub-visibility", "Subtitles" },
{ "sub-forced-only", "Forced sub only" },
{ "sub-scale", "Sub Scale"},
@@ -2238,14 +2236,8 @@ static void show_property_osd(MPContext *mpctx, const char *pname, int osd_mode)
osd_msg && osd_msg[0] ? " " : "", t);
}
- if (osd_msg && osd_msg[0]) {
- int osd_id = 0;
- if (p) {
- int index = p - property_osd_display;
- osd_id = p->osd_id ? p->osd_id : OSD_MSG_PROPERTY + index;
- }
- set_osd_msg(mpctx, osd_id, 1, opts->osd_duration, "%s", osd_msg);
- }
+ if (osd_msg && osd_msg[0])
+ set_osd_msg(mpctx, 1, opts->osd_duration, "%s", osd_msg);
talloc_free(tmp);
}
@@ -2344,7 +2336,7 @@ static int edit_filters_osd(struct MPContext *mpctx, enum stream_type mediatype,
const char *prop = filter_opt[mediatype];
show_property_osd(mpctx, prop, MP_ON_OSD_MSG);
} else {
- set_osd_msg(mpctx, OSD_MSG_TEXT, 1, mpctx->opts->osd_duration,
+ set_osd_msg(mpctx, 1, mpctx->opts->osd_duration,
"Changing filters failed!");
}
}
@@ -2604,10 +2596,10 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (r == M_PROPERTY_OK || r == M_PROPERTY_UNAVAILABLE) {
show_property_osd(mpctx, cmd->args[0].v.s, on_osd);
} else if (r == M_PROPERTY_UNKNOWN) {
- set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Unknown property: '%s'", cmd->args[0].v.s);
} else if (r <= 0) {
- set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Failed to set property '%s' to '%s'",
cmd->args[0].v.s, cmd->args[1].v.s);
}
@@ -2633,10 +2625,10 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (r == M_PROPERTY_OK || r == M_PROPERTY_UNAVAILABLE) {
show_property_osd(mpctx, property, on_osd);
} else if (r == M_PROPERTY_UNKNOWN) {
- set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Unknown property: '%s'", property);
} else if (r <= 0) {
- set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Failed to increment property '%s' by %g",
property, s.inc);
}
@@ -2651,10 +2643,10 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (r == M_PROPERTY_OK || r == M_PROPERTY_UNAVAILABLE) {
show_property_osd(mpctx, property, on_osd);
} else if (r == M_PROPERTY_UNKNOWN) {
- set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Unknown property: '%s'", property);
} else if (r <= 0) {
- set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Failed to multiply property '%s' by %g", property, f);
}
break;
@@ -2684,10 +2676,10 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (r == M_PROPERTY_OK || r == M_PROPERTY_UNAVAILABLE) {
show_property_osd(mpctx, property, on_osd);
} else if (r == M_PROPERTY_UNKNOWN) {
- set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Unknown property: '%s'", property);
} else if (r <= 0) {
- set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Failed to set property '%s' to '%s'",
property, value);
}
@@ -2756,7 +2748,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (cmd->id == MP_CMD_SUB_STEP) {
opts->sub_delay -= a[0];
osd_changed_all(mpctx->osd);
- set_osd_msg(mpctx, OSD_MSG_SUB_DELAY, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Sub delay: %d ms", ROUND(opts->sub_delay * 1000));
} else {
// We can easily get stuck by failing to seek to the video
@@ -2788,7 +2780,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
else
opts->osd_level = v > max ? max : v;
if (msg_osd && opts->osd_level <= 1)
- set_osd_msg(mpctx, OSD_MSG_OSD_STATUS, 0, osd_duration,
+ set_osd_msg(mpctx, 0, osd_duration,
"OSD: %s", opts->osd_level ? "yes" : "no");
break;
}
@@ -2800,7 +2792,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_SHOW_TEXT: {
// if no argument supplied use default osd_duration, else <arg> ms.
- set_osd_msg(mpctx, OSD_MSG_TEXT, cmd->args[2].v.i,
+ set_osd_msg(mpctx, cmd->args[2].v.i,
(cmd->args[1].v.i < 0 ? osd_duration : cmd->args[1].v.i),
"%s", cmd->args[0].v.s);
break;
@@ -2904,7 +2896,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
#if HAVE_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_freq(mpctx->stream, ROUND(cmd->args[0].v.f));
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
+ set_osd_msg(mpctx, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
@@ -2917,7 +2909,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
#if HAVE_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_force_freq_step(mpctx->stream, ROUND(cmd->args[0].v.f));
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: f %d",
+ set_osd_msg(mpctx, osdl, osd_duration, "%s: f %d",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_frequency(mpctx->stream));
}
@@ -2938,7 +2930,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
tv_step_channel(get_tvh(mpctx), TV_CHANNEL_LOWER);
}
if (tv_channel_list) {
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Channel: %s", tv_channel_current->name);
}
}
@@ -2946,7 +2938,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
else if (mpctx->stream &&
mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_channel_step(mpctx->stream, cmd->args[0].v.i);
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
+ set_osd_msg(mpctx, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
@@ -2974,14 +2966,14 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (get_tvh(mpctx)) {
tv_set_channel(get_tvh(mpctx), cmd->args[0].v.s);
if (tv_channel_list) {
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Channel: %s", tv_channel_current->name);
}
}
#if HAVE_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_channel(mpctx->stream, cmd->args[0].v.s);
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
+ set_osd_msg(mpctx, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
@@ -3005,14 +2997,14 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
if (get_tvh(mpctx)) {
tv_last_channel(get_tvh(mpctx));
if (tv_channel_list) {
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration,
+ set_osd_msg(mpctx, osdl, osd_duration,
"Channel: %s", tv_channel_current->name);
}
}
#if HAVE_PVR
else if (mpctx->stream && mpctx->stream->type == STREAMTYPE_PVR) {
pvr_set_lastchannel(mpctx->stream);
- set_osd_msg(mpctx, OSD_MSG_TV_CHANNEL, osdl, osd_duration, "%s: %s",
+ set_osd_msg(mpctx, osdl, osd_duration, "%s: %s",
pvr_get_current_channelname(mpctx->stream),
pvr_get_current_stationname(mpctx->stream));
}
@@ -3105,9 +3097,9 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
char *s = cmd->args[0].v.s;
MP_INFO(mpctx, "Setting vo cmd line to '%s'.\n", s);
if (vo_control(mpctx->video_out, VOCTRL_SET_COMMAND_LINE, s) > 0) {
- set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration, "vo='%s'", s);
+ set_osd_msg(mpctx, osdl, osd_duration, "vo='%s'", s);
} else {
- set_osd_msg(mpctx, OSD_MSG_TEXT, osdl, osd_duration, "Failed!");
+ set_osd_msg(mpctx, osdl, osd_duration, "Failed!");
}
}
break;
diff --git a/player/core.h b/player/core.h
index 2c6b41d745..edfdaec2e1 100644
--- a/player/core.h
+++ b/player/core.h
@@ -80,19 +80,6 @@ enum mp_osd_seek_info {
enum {
- OSD_MSG_TEXT = 1,
- OSD_MSG_SUB_DELAY,
- OSD_MSG_SPEED,
- OSD_MSG_OSD_STATUS,
- OSD_MSG_BAR,
- OSD_MSG_PAUSE,
- OSD_MSG_RADIO_CHANNEL,
- OSD_MSG_TV_CHANNEL,
-
- // Base id for messages generated from the commmand to property bridge.
- OSD_MSG_PROPERTY = 0x100,
- OSD_MSG_SUB_BASE = 0x1000,
-
// other constants
MAX_OSD_LEVEL = 3,
MAX_TERM_OSD_LEVEL = 1,
@@ -414,8 +401,8 @@ void stream_dump(struct MPContext *mpctx);
void print_status(struct MPContext *mpctx);
void set_osd_bar(struct MPContext *mpctx, int type, const char* name,
double min, double max, double val);
-void set_osd_msg(struct MPContext *mpctx, int id, int level, int time,
- const char* fmt, ...) PRINTF_ATTRIBUTE(5,6);
+void set_osd_msg(struct MPContext *mpctx, int level, int time,
+ const char* fmt, ...) PRINTF_ATTRIBUTE(4,5);
void set_osd_function(struct MPContext *mpctx, int osd_function);
void set_osd_subtitle(struct MPContext *mpctx, const char *text);
diff --git a/player/osd.c b/player/osd.c
index 05ab509f69..8401f75b36 100644
--- a/player/osd.c
+++ b/player/osd.c
@@ -235,7 +235,7 @@ typedef struct mp_osd_msg mp_osd_msg_t;
struct mp_osd_msg {
/// Message text.
char *msg;
- int id, level, started;
+ int started;
/// Display duration in seconds.
double time;
// Show full OSD for duration of message instead of msg
@@ -244,8 +244,7 @@ struct mp_osd_msg {
};
// time is in ms
-static mp_osd_msg_t *add_osd_msg(struct MPContext *mpctx, int id, int level,
- int time)
+static mp_osd_msg_t *add_osd_msg(struct MPContext *mpctx, int level, int time)
{
struct MPOpts *opts = mpctx->opts;
if (level > opts->osd_level)
@@ -254,29 +253,27 @@ static mp_osd_msg_t *add_osd_msg(struct MPContext *mpctx, int id, int level,
talloc_free(mpctx->osd_msg_stack);
mpctx->osd_msg_stack = talloc_struct(mpctx, mp_osd_msg_t, {
.msg = "",
- .id = id,
- .level = level,
.time = time / 1000.0,
});
return mpctx->osd_msg_stack;
}
-static void set_osd_msg_va(struct MPContext *mpctx, int id, int level, int time,
+static void set_osd_msg_va(struct MPContext *mpctx, int level, int time,
const char *fmt, va_list ap)
{
if (level == OSD_LEVEL_INVISIBLE)
return;
- mp_osd_msg_t *msg = add_osd_msg(mpctx, id, level, time);
+ mp_osd_msg_t *msg = add_osd_msg(mpctx, level, time);
if (msg)
msg->msg = talloc_vasprintf(msg, fmt, ap);
}
-void set_osd_msg(struct MPContext *mpctx, int id, int level, int time,
+void set_osd_msg(struct MPContext *mpctx, int level, int time,
const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- set_osd_msg_va(mpctx, id, level, time, fmt, ap);
+ set_osd_msg_va(mpctx, level, time, fmt, ap);
va_end(ap);
}
@@ -345,7 +342,7 @@ void set_osd_bar(struct MPContext *mpctx, int type, const char *name,
return;
}
- set_osd_msg(mpctx, OSD_MSG_BAR, 1, opts->osd_duration, "%s: %d %%",
+ set_osd_msg(mpctx, 1, opts->osd_duration, "%s: %d %%",
name, ROUND(100 * (val - min) / (max - min)));
}
@@ -453,22 +450,21 @@ static void add_seek_osd_messages(struct MPContext *mpctx)
if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_TEXT) {
// Never in term-osd mode
if (mpctx->video_out && mpctx->opts->term_osd != 1) {
- mp_osd_msg_t *msg = add_osd_msg(mpctx, OSD_MSG_TEXT, 1,
- mpctx->opts->osd_duration);
+ mp_osd_msg_t *msg = add_osd_msg(mpctx, 1, mpctx->opts->osd_duration);
if (msg)
msg->show_position = true;
}
}
if (mpctx->add_osd_seek_info & OSD_SEEK_INFO_CHAPTER_TEXT) {
char *chapter = chapter_display_name(mpctx, get_current_chapter(mpctx));
- set_osd_msg(mpctx, OSD_MSG_TEXT, 1, mpctx->opts->osd_duration,
+ set_osd_msg(mpctx, 1, mpctx->opts->osd_duration,
"Chapter: %s", chapter);
talloc_free(chapter);
}
if ((mpctx->add_osd_seek_info & OSD_SEEK_INFO_EDITION)
&& mpctx->master_demuxer)
{
- set_osd_msg(mpctx, OSD_MSG_TEXT, 1, mpctx->opts->osd_duration,
+ set_osd_msg(mpctx, 1, mpctx->opts->osd_duration,
"Playing edition %d of %d.",
mpctx->master_demuxer->edition + 1,
mpctx->master_demuxer->num_editions);
diff --git a/player/screenshot.c b/player/screenshot.c
index d6aa81af84..d5a6b1b3d0 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -79,10 +79,8 @@ static void screenshot_msg(screenshot_ctx *ctx, int status, const char *msg,
va_end(ap);
MP_MSG(ctx->mpctx, status == SMSG_ERR ? MSGL_ERR : MSGL_INFO, "%s\n", s);
- if (ctx->osd) {
- set_osd_msg(ctx->mpctx, OSD_MSG_TEXT, 1, ctx->mpctx->opts->osd_duration,
- "%s", s);
- }
+ if (ctx->osd)
+ set_osd_msg(ctx->mpctx, 1, ctx->mpctx->opts->osd_duration, "%s", s);
talloc_free(s);
}