- while (sys->i_changes & (VOUT_ASPECT_CHANGE |
- VOUT_CROP_CHANGE)) {
- /* */
- if (sys->i_changes & VOUT_ASPECT_CHANGE) {
- 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);
-
- sys->i_changes &= ~VOUT_ASPECT_CHANGE;
- }
- if (sys->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);
- sys->i_changes &= ~VOUT_CROP_CHANGE;
- }
-
- }
-