[MPlayer-dev-eng] [PATCH 2/2] playback_speed limits: MP_CMD_SPEED_*

Robert Juliano juliano.1 at osu.edu
Sat Jun 2 21:10:37 CEST 2007


Patch 2: prevent non-positive playback_speed

While -speed and mp_property_playback_speed clamp playback_speed,
MP_CMD_SPEED_* didn't.  Ex. with input.conf "[ speed_incr -0.1",
playback_speed could still become non-positive.

Robert

Index: command.c
===================================================================
--- command.c   (revision 23455)
+++ command.c   (working copy)
@@ -1836,6 +1836,7 @@
        case MP_CMD_SPEED_INCR:{
                float v = cmd->args[0].v.f;
                playback_speed += v;
+               if (playback_speed <= 0) playback_speed = .01;
                build_afilter_chain(sh_audio, &ao_data);
                set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed,
                            playback_speed);
@@ -1844,6 +1845,7 @@
        case MP_CMD_SPEED_MULT:{
                float v = cmd->args[0].v.f;
                playback_speed *= v;
+               if (playback_speed <= 0) playback_speed = .01;
                build_afilter_chain(sh_audio, &ao_data);
                set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed,
                            playback_speed);
@@ -1852,6 +1854,7 @@
        case MP_CMD_SPEED_SET:{
                float v = cmd->args[0].v.f;
                playback_speed = v;
+               if (playback_speed <= 0) playback_speed = .01;
                build_afilter_chain(sh_audio, &ao_data);
                set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed,
                            playback_speed);





More information about the MPlayer-dev-eng mailing list