- psz_parser = strchr( ++psz_end, '+' );
- i_crop_height = strtol( psz_end, &psz_end, 10 );
- if( psz_end != psz_parser ) goto crop_end;
-
- psz_parser = strchr( ++psz_end, '+' );
- i_crop_left = strtol( psz_end, &psz_end, 10 );
- if( psz_end != psz_parser ) goto crop_end;
-
- psz_end++;
- i_crop_top = strtol( psz_end, &psz_end, 10 );
- if( *psz_end != '\0' ) goto crop_end;
-
- i_width = i_crop_width;
- p_vout->fmt_in.i_visible_width = i_width;
-
- i_height = i_crop_height;
- p_vout->fmt_in.i_visible_height = i_height;
-
- p_vout->fmt_in.i_x_offset = i_crop_left;
- p_vout->fmt_in.i_y_offset = i_crop_top;
- }
- else
- {
- /* Maybe we're using the <left>+<top>+<right>+<bottom> syntax */
- unsigned int i_crop_top, i_crop_left, i_crop_bottom, i_crop_right;
-
- psz_parser = strchr( newval.psz_string, '+' );
- i_crop_left = strtol( newval.psz_string, &psz_end, 10 );
- if( psz_end != psz_parser ) goto crop_end;
-
- psz_parser = strchr( ++psz_end, '+' );
- i_crop_top = strtol( psz_end, &psz_end, 10 );
- if( psz_end != psz_parser ) goto crop_end;
-
- psz_parser = strchr( ++psz_end, '+' );
- i_crop_right = strtol( psz_end, &psz_end, 10 );
- if( psz_end != psz_parser ) goto crop_end;
-
- psz_end++;
- i_crop_bottom = strtol( psz_end, &psz_end, 10 );
- if( *psz_end != '\0' ) goto crop_end;
-
- i_width = p_vout->fmt_render.i_visible_width
- - i_crop_left - i_crop_right;
- p_vout->fmt_in.i_visible_width = i_width;
-
- i_height = p_vout->fmt_render.i_visible_height
- - i_crop_top - i_crop_bottom;
- p_vout->fmt_in.i_visible_height = i_height;
-
- p_vout->fmt_in.i_x_offset = i_crop_left;
- p_vout->fmt_in.i_y_offset = i_crop_top;
- }
- }
- }
- else if( !strcmp( psz_cmd, "crop-top" )
- || !strcmp( psz_cmd, "crop-left" )
- || !strcmp( psz_cmd, "crop-bottom" )
- || !strcmp( psz_cmd, "crop-right" ) )
- {
- unsigned int i_crop_top, i_crop_left, i_crop_bottom, i_crop_right;
-
- i_crop_top = var_GetInteger( p_vout, "crop-top" );
- i_crop_left = var_GetInteger( p_vout, "crop-left" );
- i_crop_right = var_GetInteger( p_vout, "crop-right" );
- i_crop_bottom = var_GetInteger( p_vout, "crop-bottom" );
-
- i_width = p_vout->fmt_render.i_visible_width
- - i_crop_left - i_crop_right;
- p_vout->fmt_in.i_visible_width = i_width;
-
- i_height = p_vout->fmt_render.i_visible_height
- - i_crop_top - i_crop_bottom;
- p_vout->fmt_in.i_visible_height = i_height;
-
- p_vout->fmt_in.i_x_offset = i_crop_left;
- p_vout->fmt_in.i_y_offset = i_crop_top;
- }
-
- crop_end:
- InitWindowSize( p_vout, &p_vout->i_window_width,
- &p_vout->i_window_height );
-
- p_vout->i_changes |= VOUT_CROP_CHANGE;
-
- msg_Dbg( p_vout, "cropping picture %ix%i to %i,%i,%ix%i",
- p_vout->fmt_in.i_width, p_vout->fmt_in.i_height,
- p_vout->fmt_in.i_x_offset, p_vout->fmt_in.i_y_offset,
- p_vout->fmt_in.i_visible_width,
- p_vout->fmt_in.i_visible_height );
-
- var_SetVoid( p_vout, "crop-update" );