summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-10-02 01:32:03 +0200
committerwm4 <wm4@nowhere>2013-10-02 01:39:28 +0200
commit886c3ef999598c68686d8194a74aa1d431b76ca5 (patch)
tree74a0a29c449c6320c02a9d04bd29da9149636e31
parentf01744ac4e1da514aedbb51e6fad42fdb308937e (diff)
downloadmpv-886c3ef999598c68686d8194a74aa1d431b76ca5.tar.bz2
mpv-886c3ef999598c68686d8194a74aa1d431b76ca5.tar.xz
command: subtitle support depends on VO, not video decoding
We can render subtitles if a VO is open. Whether we're decoding video (i.e. if mpctx->sh_video is set) doesn't really matter. Subtitle display with --force-window still doesn't quite work yet, because there's nothing to actually force redrawing of subtitles in this mode.
-rw-r--r--mpvcore/command.c18
-rw-r--r--mpvcore/mplayer.c4
2 files changed, 9 insertions, 13 deletions
diff --git a/mpvcore/command.c b/mpvcore/command.c
index 24b4fe8985..a7dab8be8a 100644
--- a/mpvcore/command.c
+++ b/mpvcore/command.c
@@ -1502,7 +1502,7 @@ static int mp_property_aspect(m_option_t *prop, int action, void *arg,
static int property_osd_helper(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
- if (!mpctx->sh_video)
+ if (!mpctx->video_out)
return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_SET)
osd_changed_all(mpctx->osd);
@@ -1521,7 +1521,7 @@ static int mp_property_sub_delay(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
- if (!mpctx->sh_video)
+ if (!mpctx->video_out)
return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_PRINT:
@@ -1535,7 +1535,7 @@ static int mp_property_sub_pos(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
- if (!mpctx->sh_video)
+ if (!mpctx->video_out)
return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_PRINT) {
*(char **)arg = talloc_asprintf(NULL, "%d/100", opts->sub_pos);
@@ -2205,7 +2205,6 @@ static int edit_filters_osd(struct MPContext *mpctx, enum stream_type mediatype,
void run_command(MPContext *mpctx, mp_cmd_t *cmd)
{
struct MPOpts *opts = mpctx->opts;
- sh_video_t *const sh_video = mpctx->sh_video;
int osd_duration = opts->osd_duration;
bool auto_osd = cmd->on_osd == MP_ON_OSD_AUTO;
bool msg_osd = auto_osd || (cmd->on_osd & MP_ON_OSD_MSG);
@@ -2364,8 +2363,8 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_OSD: {
int v = cmd->args[0].v.i;
- int max = (opts->term_osd
- && !sh_video) ? MAX_TERM_OSD_LEVEL : MAX_OSD_LEVEL;
+ int max = (opts->term_osd && !mpctx->video_out) ? MAX_TERM_OSD_LEVEL
+ : MAX_OSD_LEVEL;
if (opts->osd_level > max)
opts->osd_level = max;
if (v < 0)
@@ -2657,9 +2656,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
#endif /* CONFIG_TV */
case MP_CMD_SUB_ADD:
- if (sh_video) {
- mp_add_subtitles(mpctx, cmd->args[0].v.s);
- }
+ mp_add_subtitles(mpctx, cmd->args[0].v.s);
break;
case MP_CMD_SUB_REMOVE: {
@@ -2671,8 +2668,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_SUB_RELOAD: {
struct track *sub = mp_track_by_tid(mpctx, STREAM_SUB, cmd->args[0].v.i);
- if (sh_video && sub && sub->is_external && sub->external_filename)
- {
+ if (sub && sub->is_external && sub->external_filename) {
struct track *nsub = mp_add_subtitles(mpctx, sub->external_filename);
if (nsub) {
mp_remove_track(mpctx, sub);
diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c
index 98af9d4e37..6a6c2dfb34 100644
--- a/mpvcore/mplayer.c
+++ b/mpvcore/mplayer.c
@@ -1454,7 +1454,7 @@ static void set_osd_subtitle(struct MPContext *mpctx, const char *text)
text = "";
if (strcmp(mpctx->osd->sub_text, text) != 0) {
osd_set_sub(mpctx->osd, text);
- if (!mpctx->sh_video) {
+ if (!mpctx->video_out) {
rm_osd_msg(mpctx, OSD_MSG_SUB_BASE);
if (text && text[0])
set_osd_msg(mpctx, OSD_MSG_SUB_BASE, 1, INT_MAX, "%s", text);
@@ -1860,7 +1860,7 @@ static void update_subtitles(struct MPContext *mpctx)
}
}
- if (!mpctx->osd->render_bitmap_subs || !mpctx->sh_video)
+ if (!mpctx->osd->render_bitmap_subs || !mpctx->video_out)
set_osd_subtitle(mpctx, sub_get_text(dec_sub, curpts_s));
}