- vout_sys_t *sys = vout->p_sys;
- vout_display_t *vd = sys->vd;
-
- while (vout->i_changes & (VOUT_FULLSCREEN_CHANGE |
- VOUT_ASPECT_CHANGE |
- VOUT_ZOOM_CHANGE |
- VOUT_SCALE_CHANGE |
- VOUT_ON_TOP_CHANGE |
- VOUT_CROP_CHANGE)) {
- /* */
- if (vout->i_changes & VOUT_FULLSCREEN_CHANGE) {
- vout->b_fullscreen = !vout->b_fullscreen;
-
- var_SetBool(vout, "fullscreen", vout->b_fullscreen);
- vout_SetDisplayFullscreen(vd, vout->b_fullscreen);
- vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
- }
- if (vout->i_changes & VOUT_ASPECT_CHANGE) {
- vout->output.i_aspect = (int64_t)vout->fmt_in.i_sar_num * vout->fmt_in.i_width * VOUT_ASPECT_FACTOR /
- vout->fmt_in.i_sar_den / vout->fmt_in.i_height;
- vout->fmt_out.i_sar_num = vout->fmt_in.i_sar_num;
- vout->fmt_out.i_sar_den = vout->fmt_in.i_sar_den;
-
- vout_SetDisplayAspect(vd, vout->fmt_in.i_sar_num, vout->fmt_in.i_sar_den);
-
- vout->i_changes &= ~VOUT_ASPECT_CHANGE;
- }
- if (vout->i_changes & VOUT_ZOOM_CHANGE) {
- const float zoom = var_GetFloat(vout, "scale");
-
- unsigned den = ZOOM_FP_FACTOR;
- unsigned num = den * zoom;
- if (num < (ZOOM_FP_FACTOR+9) / 10)
- num = (ZOOM_FP_FACTOR+9) / 10;
- else if (num > ZOOM_FP_FACTOR * 10)
- num = ZOOM_FP_FACTOR * 10;
-
- vout_SetDisplayZoom(vd, num, den);
-
- vout->i_changes &= ~VOUT_ZOOM_CHANGE;
- }
- if (vout->i_changes & VOUT_SCALE_CHANGE) {
- const bool is_display_filled = var_GetBool(vout, "autoscale");
-
- vout_SetDisplayFilled(vd, is_display_filled);
-
- vout->i_changes &= ~VOUT_SCALE_CHANGE;
- }
- if (vout->i_changes & VOUT_ON_TOP_CHANGE) {
- vout_SetWindowState(vd, vout->b_on_top
- ? VOUT_WINDOW_STATE_ABOVE
- : VOUT_WINDOW_STATE_NORMAL);
-
- vout->i_changes &= ~VOUT_ON_TOP_CHANGE;
- }
- if (vout->i_changes & VOUT_CROP_CHANGE) {
- const video_format_t crop = vout->fmt_in;
- const video_format_t org = vout->fmt_render;
- /* FIXME because of rounding errors, the reconstructed ratio is wrong */
- unsigned num = 0;
- unsigned den = 0;
- if (crop.i_x_offset == org.i_x_offset &&
- crop.i_visible_width == org.i_visible_width &&
- crop.i_y_offset == org.i_y_offset + (org.i_visible_height - crop.i_visible_height)/2) {
- vlc_ureduce(&num, &den,
- crop.i_visible_width * crop.i_sar_num,
- crop.i_visible_height * crop.i_sar_den, 0);
- } else if (crop.i_y_offset == org.i_y_offset &&
- crop.i_visible_height == org.i_visible_height &&
- crop.i_x_offset == org.i_x_offset + (org.i_visible_width - crop.i_visible_width)/2) {
- vlc_ureduce(&num, &den,
- crop.i_visible_width * crop.i_sar_num,
- crop.i_visible_height * crop.i_sar_den, 0);
- }
- vout_SetDisplayCrop(vd, num, den,
- crop.i_x_offset, crop.i_y_offset,
- crop.i_visible_width, crop.i_visible_height);
- vout->i_changes &= ~VOUT_CROP_CHANGE;
- }