diff options
author | wm4 <wm4@nowhere> | 2012-08-02 02:36:26 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-08-02 02:37:00 +0200 |
commit | d5315a678ea93110f8bde10fe83eca64202988d1 (patch) | |
tree | 9f6212fb1192ef42658a98c31f746cbf28af054e | |
parent | c7a15ed0ddf56b80a962a6aeb5da7981472ceaf2 (diff) | |
download | mpv-d5315a678ea93110f8bde10fe83eca64202988d1.tar.bz2 mpv-d5315a678ea93110f8bde10fe83eca64202988d1.tar.xz |
mplayer: expand --title as property, remove --use-filename-title
The --title option, which sets the GUI window caption, is now expanded
as slave mode property string (like osd_show_property_text). Make the
default value for --title include the filename. This makes a behavior
similar to --use-filename-title the default.
Remove the --use-filename-title option, as it's redundant now.
-rw-r--r-- | cfg-mplayer.h | 1 | ||||
-rw-r--r-- | defaultopts.c | 1 | ||||
-rw-r--r-- | libvo/video_out.c | 7 | ||||
-rw-r--r-- | libvo/video_out.h | 2 | ||||
-rw-r--r-- | mplayer.c | 15 |
5 files changed, 17 insertions, 9 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h index ac5ac0c75a..6a341e01c1 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -739,7 +739,6 @@ const m_option_t mplayer_opts[]={ //---------------------- mplayer-only options ------------------------ {"use-filedir-conf", &use_filedir_conf, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, - {"use-filename-title", &use_filename_title, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL}, OPT_INTRANGE("osdlevel", osd_level, 0, 0, 3), OPT_INTRANGE("osd-duration", osd_duration, 0, 0, 3600000), OPT_MAKE_FLAGS("osd-fractions", osd_fractions, 0), diff --git a/defaultopts.c b/defaultopts.c index 261c84bcba..96768f605a 100644 --- a/defaultopts.c +++ b/defaultopts.c @@ -13,6 +13,7 @@ void set_default_mplayer_options(struct MPOpts *opts) .softvol = 1, .softvol_max = 200, .ao_buffersize = -1, + .vo_wintitle = "mplayer - ${filename}", .monitor_pixel_aspect = 1.0, .vo_panscanrange = 1.0, .cursor_autohide_delay = 1000, diff --git a/libvo/video_out.c b/libvo/video_out.c index 7f78a2d07c..1063876640 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -345,6 +345,7 @@ struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11, .input_ctx = input_ctx, .event_fd = -1, .registered_fd = -1, + .window_title = talloc_strdup(vo, ""), }; // first try the preferred drivers, with their optional subdevice param: if (vo_list && vo_list[0]) @@ -526,11 +527,7 @@ void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, // you need to keep the string for an extended period of time. const char *vo_get_window_title(struct vo *vo) { - if (vo->opts->vo_wintitle) { - return vo->opts->vo_wintitle; - } else { - return "mplayer2"; - } + return vo->window_title; } /** diff --git a/libvo/video_out.h b/libvo/video_out.h index e9d9e69202..3fcb420d2a 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -293,6 +293,8 @@ struct vo { int scrh; // vertical resolution float asp; } aspdat; + + char *window_title; }; struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11, @@ -247,7 +247,6 @@ FILE *edl_fd; // file to write to when in -edlout mode. char *edl_output_filename; // file to put EDL entries in (-edlout) int use_filedir_conf; -int use_filename_title; #include "mpcommon.h" #include "command.h" @@ -2311,6 +2310,16 @@ static int fill_audio_out_buffers(struct MPContext *mpctx, double endpts) return -partial_fill; } +static void vo_update_window_title(struct MPContext *mpctx) +{ + if (!mpctx->video_out) + return; + char *title = property_expand_string(mpctx, mpctx->opts.vo_wintitle); + talloc_free(mpctx->video_out->window_title); + mpctx->video_out->window_title = talloc_strdup(mpctx->video_out, title); + free(title); +} + int reinit_video_chain(struct MPContext *mpctx) { struct MPOpts *opts = &mpctx->opts; @@ -2334,6 +2343,8 @@ int reinit_video_chain(struct MPContext *mpctx) mpctx->initialized_flags |= INITIALIZED_VO; } + vo_update_window_title(mpctx); + if (stream_control(mpctx->demuxer->stream, STREAM_CTRL_GET_ASPECT_RATIO, &ar) != STREAM_UNSUPPORTED) mpctx->sh_video->stream_aspect = ar; @@ -3750,8 +3761,6 @@ play_next_file: vo_control(mpctx->video_out, VOCTRL_RESUME, NULL); mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Playing %s.\n", mpctx->filename); - if (use_filename_title && opts->vo_wintitle == NULL) - opts->vo_wintitle = talloc_strdup(NULL, mp_basename(mpctx->filename)); if (edl_output_filename) { if (edl_fd) |