Updated: October 28, 2024 |
Set the play speed
#include <mm/renderer.h>
int mmr_speed_set(mmr_context_t *ctxt, int speed)
Set the play speed, in units of 1/1000 of normal speed. If the context is playing (including if it's paused), the new speed is applied immediately. If the context is stopped, the speed setting is stored in the context and applied the next time mmr_play() is called.
Use a speed of 0 to pause playback. Depending on the input media, trick play, which entails playing at speeds other than normal speed (1000), may be unsupported or forbidden, either completely or only for some portions of the media.
If the caller requests a speed for trick play but the exact value is unsupported by the attached input, the speed may be rounded to a supported value in the same category (i.e., negative, slow, or fast). If the category is unsupported, the call fails. After the rounding, if the speed is still unsupported or forbidden at the current position, the speed is changed to an allowed value and the call succeeds.
The input parameters may specify other circumstances that cause the speed to change during playback. In particular, the transition_speed parameter lets you enable autopause, in which mm-renderer pauses playback when a track boundary is reached even though mmr_speed_set() wasn't called. This feature and autoresume can be controlled also through the audio configuration. The Audio Developer's Guide explains how to define these and other audio management policies.
Zero on success, -1 on failure (use mmr_error_info())