From 6f1486b397d632feaa71f88b980491aea7b69256 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 17 Sep 2012 08:38:19 +0200 Subject: commands: replace --hardframedrop, change framedropping property Replace --hardframedrop with --framedrop=hard. Rename the framedrop property from "framedropping" to "framedrop" for the sake of making command line options have the same name as their corresponding property. Change the property to accept choice values instead of numeric values. Remove unused/forgotten auto_quality variable. --- DOCS/man/en/changes.rst | 3 ++- DOCS/man/en/options.rst | 12 ++++++------ cfg-mplayer.h | 6 ++++-- command.c | 24 ++++++------------------ etc/input.conf | 2 +- input/input.c | 2 +- mplayer.c | 3 +-- mplayer.h | 4 ---- options.h | 2 +- 9 files changed, 22 insertions(+), 36 deletions(-) diff --git a/DOCS/man/en/changes.rst b/DOCS/man/en/changes.rst index c4fc3a0812..ee66c5048a 100644 --- a/DOCS/man/en/changes.rst +++ b/DOCS/man/en/changes.rst @@ -87,7 +87,7 @@ Command line switches ``-no-opt``, or better ``--no-opt``. * Per-file options are not the default anymore. You can explicitly specify file local options. See ``Usage`` section. -* Table of renamed switches: +* Table of renamed/replaced switches: =================================== =================================== Old New @@ -95,6 +95,7 @@ Command line switches -nosound --no-audio -use-filename-title --title="${filename}" -loop 0 --loop=inf + -hardframedrop --framedrop=hard =================================== =================================== input.conf and slave commands diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 431ff1a7de..59ce49a308 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -643,11 +643,14 @@ --fps= Override video framerate. Useful if the original value is wrong or missing. ---framedrop +--framedrop= Skip displaying some frames to maintain A/V sync on slow systems. Video filters are not applied to such frames. For B-frames even decoding is - skipped completely. May produce unwatchably choppy output. See also - ``--hardframedrop``. + skipped completely. May produce unwatchably choppy output. With ``hard``, + decoding and output of any frame can be skipped, and will lead to an even + worse playback experience. + + Practical use of this feature is questionable. Disabled by default. --frames= Play/convert only first frames, then quit. @@ -753,9 +756,6 @@ ``--no-grabpointer`` tells the player to not grab the mouse pointer after a video mode change (``--vm``). Useful for multihead setups. ---hardframedrop - More intense frame dropping (breaks decoding). Leads to image distortion! - --heartbeat-cmd Command that is executed every 30 seconds during playback via *system()* - i.e. using the shell. diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 304c60f194..d9d78082ac 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -678,8 +678,10 @@ const m_option_t mplayer_opts[]={ {"sstep", &step_sec, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, - {"framedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL}, - {"hardframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, NULL}, + OPT_CHOICE("framedrop", frame_dropping, 0, + ({"no", 0}, + {"yes", 1}, {"", 1}, + {"hard", 2})), OPT_FLAG_ON("untimed", untimed, 0), diff --git a/command.c b/command.c index 708d4b8d2d..cdfeb835bf 100644 --- a/command.c +++ b/command.c @@ -1280,26 +1280,13 @@ static int mp_property_border(m_option_t *prop, int action, void *arg, &vo_border, mpctx); } -/// Framedropping state (RW) -static int mp_property_framedropping(m_option_t *prop, int action, +static int mp_property_framedrop(m_option_t *prop, int action, void *arg, MPContext *mpctx) { - if (!mpctx->sh_video) return M_PROPERTY_UNAVAILABLE; - switch (action) { - case M_PROPERTY_PRINT: - if (!arg) - return M_PROPERTY_ERROR; - *(char **) arg = talloc_strdup(NULL, frame_dropping == 1 ? - mp_gtext("enabled") : - (frame_dropping == 2 ? mp_gtext("hard") : - mp_gtext("disabled"))); - return M_PROPERTY_OK; - default: - return m_property_choice(prop, action, arg, &frame_dropping); - } + return mp_property_generic_option(prop, action, arg, mpctx); } /// Color settings, try to use vf/vo then fall back on TV. (RW) @@ -1752,8 +1739,8 @@ static const m_option_t mp_properties[] = { M_OPT_RANGE, 0, 1, NULL }, { "border", mp_property_border, CONF_TYPE_FLAG, M_OPT_RANGE, 0, 1, NULL }, - { "framedropping", mp_property_framedropping, CONF_TYPE_INT, - M_OPT_RANGE, 0, 2, NULL }, + { "framedrop", mp_property_framedrop, &m_option_type_choice, + 0, 0, 0, "framedrop" }, { "gamma", mp_property_gamma, CONF_TYPE_INT, M_OPT_RANGE, -100, 100, .offset = offsetof(struct MPOpts, vo_gamma_gamma)}, { "brightness", mp_property_gamma, CONF_TYPE_INT, @@ -1828,6 +1815,7 @@ static const struct legacy_prop legacy_props[] = { {"switch_video", "video"}, {"switch_audio", "audio"}, {"switch_program", "program"}, + {"framedropping", "framedrop"}, {0} }; @@ -1916,7 +1904,7 @@ static struct property_osd_display { { "ontop", _("Stay on top: %s") }, { "rootwin", _("Rootwin: %s") }, { "border", _("Border: %s") }, - { "framedropping", _("Framedropping: %s") }, + { "framedrop", _("Framedrop: %s") }, { "deinterlace", _("Deinterlace: %s") }, { "colormatrix", _("YUV colormatrix: %s") }, { "colormatrix-input-range", _("YUV input range: %s") }, diff --git a/etc/input.conf b/etc/input.conf index 269a8a3a8e..2fd24080a6 100644 --- a/etc/input.conf +++ b/etc/input.conf @@ -83,7 +83,7 @@ m switch mute 6 switch hue 1 7 switch saturation -1 8 switch saturation 1 -d switch frame_drop # cycle through framedrop modes +d switch framedrop # cycle through framedrop modes # toggle deinterlacer; requires either vdpau output, -vf yadif or kerndeint D switch deinterlace c switch colormatrix diff --git a/input/input.c b/input/input.c index 10747b0891..d783f53aca 100644 --- a/input/input.c +++ b/input/input.c @@ -173,7 +173,7 @@ static const struct legacy_cmd legacy_cmds[] = { {"vo_ontop", "switch ontop"}, {"vo_rootwin", "switch rootwin"}, {"vo_border", "switch border"}, - {"frame_drop", "switch framedropping"}, + {"frame_drop", "switch framedrop"}, {"gamma", "switch gamma"}, {"brightness", "switch brightness"}, {"contrast", "switch contrast"}, diff --git a/mplayer.c b/mplayer.c index d910611d71..c90812e871 100644 --- a/mplayer.c +++ b/mplayer.c @@ -230,7 +230,6 @@ static int ignore_start = 0; double force_fps = 0; static int force_srate = 0; -int frame_dropping = 0; // option 0=no drop 1= drop vo 2= drop decode static int play_n_frames = -1; static int play_n_frames_mf = -1; @@ -1797,7 +1796,7 @@ static int check_framedrop(struct MPContext *mpctx, double frame_time) && !mpctx->restart_playback) { ++drop_frame_cnt; ++dropped_frames; - return frame_dropping; + return mpctx->opts.frame_dropping; } else dropped_frames = 0; } diff --git a/mplayer.h b/mplayer.h index d1618bf929..651ab7b9d1 100644 --- a/mplayer.h +++ b/mplayer.h @@ -31,10 +31,6 @@ extern float audio_delay; extern double force_fps; -extern int frame_dropping; - -extern int auto_quality; - extern int vobsub_id; struct MPContext; diff --git a/options.h b/options.h index 6438f0e97b..1297b67b04 100644 --- a/options.h +++ b/options.h @@ -41,7 +41,6 @@ typedef struct MPOpts { int osd_duration; int osd_fractions; char *vobsub_name; - int auto_quality; int untimed; int loop_times; int ordered_chapters; @@ -61,6 +60,7 @@ typedef struct MPOpts { float hr_seek_demuxer_offset; int autosync; int softsleep; + int frame_dropping; int term_osd; char *term_osd_esc; char *playing_msg; -- cgit v1.2.3