static int control(struct sd *sd, enum sd_ctrl cmd, void *arg) { struct sd_ass_priv *ctx = sd->priv; switch (cmd) { case SD_CTRL_SUB_STEP: { double *a = arg; long long ts = llrint(a[0] * (1000.0 / ctx->sub_speed)); long long res = ass_step_sub(ctx->ass_track, ts, a[1]); if (!res) return false; a[0] = res / (1000.0 / ctx->sub_speed); return true; } case SD_CTRL_SET_VIDEO_PARAMS: ctx->video_params = *(struct mp_image_params *)arg; return CONTROL_OK; case SD_CTRL_SET_TOP: ctx->on_top = *(bool *)arg; return CONTROL_OK; case SD_CTRL_SET_VIDEO_DEF_FPS: ctx->video_fps = *(double *)arg; update_subtitle_speed(sd); return CONTROL_OK; default: return CONTROL_UNKNOWN; } }
static int control(struct sd *sd, enum sd_ctrl cmd, void *arg) { struct sd_ass_priv *ctx = sd->priv; switch (cmd) { case SD_CTRL_SUB_STEP: { double *a = arg; long long res = ass_step_sub(ctx->ass_track, a[0] * 1000 + 0.5, a[1]); if (!res) return false; a[0] = res / 1000.0; return true; case SD_CTRL_SET_VIDEO_PARAMS: ctx->video_params = *(struct mp_image_params *)arg; return CONTROL_OK; } default: return CONTROL_UNKNOWN; } }