Commit d9e1ff01 authored by Steve Lhomme's avatar Steve Lhomme Committed by Rémi Denis-Courmont

display: no need to pass the video_format_t for CROP/ASPECT_RATIO changes

It's always found in vd->source.
Signed-off-by: Rémi Denis-Courmont's avatarRémi Denis-Courmont <remi@remlab.net>
parent d024d13e
......@@ -167,13 +167,13 @@ enum {
/* Ask the module to acknowledge/refuse source aspect ratio after being
* requested externally */
VOUT_DISPLAY_CHANGE_SOURCE_ASPECT, /* const video_format_t *p_source */
VOUT_DISPLAY_CHANGE_SOURCE_ASPECT,
/* Ask the module to acknowledge/refuse source crop change after being
* requested externally.
* The cropping requested is stored by video_format_t::i_x/y_offset and
* video_format_t::i_visible_width/height */
VOUT_DISPLAY_CHANGE_SOURCE_CROP, /* const video_format_t *p_source */
VOUT_DISPLAY_CHANGE_SOURCE_CROP,
/* Ask the module to acknowledge/refuse VR/360° viewing direction after
* being requested externally */
......
......@@ -610,7 +610,6 @@ static int vd_control(vout_display_t *vd, int query, va_list args)
vout_display_sys_t *sys = vd->sys;
vout_display_cfg_t cfg;
const vout_display_cfg_t *tmp_cfg;
const video_format_t *tmp_fmt;
int ret = VLC_EGENERIC;
switch (query) {
......@@ -632,8 +631,7 @@ static int vd_control(vout_display_t *vd, int query, va_list args)
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
tmp_fmt = va_arg(args, const video_format_t *);
if (configure_display(vd, NULL, tmp_fmt) >= 0)
if (configure_display(vd, NULL, &vd->source) >= 0)
ret = VLC_SUCCESS;
break;
......
......@@ -1185,13 +1185,12 @@ static int Control(vout_display_t *vd, int query, va_list args)
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
{
msg_Dbg(vd, "change source crop/aspect");
const video_format_t *source = va_arg(args, const video_format_t *);
if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP) {
video_format_CopyCrop(&sys->p_window->fmt, source);
video_format_CopyCrop(&sys->p_window->fmt, &vd->source);
AndroidWindow_UpdateCrop(sys, sys->p_window);
} else
CopySourceAspect(&sys->p_window->fmt, source);
CopySourceAspect(&sys->p_window->fmt, &vd->source);
UpdateVideoSize(sys, &sys->p_window->fmt, sys->p_window->b_use_priv);
FixSubtitleFormat(sys);
......
......@@ -744,15 +744,12 @@ Control( vout_display_t *vd, int i_query, va_list ap )
{
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
{
const video_format_t *p_source;
vout_display_place_t place;
video_format_t fmt;
msg_Dbg( vd, "VOUT_DISPLAY_CHANGE_SOURCE_ASPECT" );
p_source = va_arg( ap, const video_format_t * );
video_format_ApplyRotation( &fmt, p_source );
video_format_ApplyRotation( &fmt, &vd->source );
vout_display_PlacePicture( &place, &fmt, vd->cfg, false );
if( place.width != (unsigned) sys->i_width
......
......@@ -466,12 +466,10 @@ static int Control( vout_display_t *vd, int query, va_list args )
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
{
const video_format_t *src = va_arg(args, const video_format_t *);
if( query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT )
{
vout_display_place_t place;
vout_display_PlacePicture(&place, src, vd->cfg, false);
vout_display_PlacePicture(&place, &vd->source, vd->cfg, false);
sys->kvas.ulAspectWidth = place.width;
sys->kvas.ulAspectHeight = place.height;
......@@ -479,7 +477,7 @@ static int Control( vout_display_t *vd, int query, va_list args )
else
{
video_format_t src_rot;
video_format_ApplyRotation(&src_rot, src);
video_format_ApplyRotation(&src_rot, &vd->source);
sys->kvas.rclSrcRect.xLeft = src_rot.i_x_offset;
sys->kvas.rclSrcRect.yTop = src_rot.i_y_offset;
......
......@@ -234,10 +234,9 @@ static int Control (vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
{
const vout_display_cfg_t *cfg = vd->cfg;
const video_format_t *src = va_arg (ap, const video_format_t *);
vout_display_place_t place;
vout_display_PlacePicture (&place, src, cfg, false);
vout_display_PlacePicture (&place, &vd->source, cfg, false);
if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
return VLC_EGENERIC;
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
......
......@@ -518,20 +518,17 @@ static int Control(vout_display_t *vd, int query, va_list args)
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: {
const vout_display_cfg_t *cfg;
const video_format_t *source;
if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) {
source = va_arg(args, const video_format_t *);
cfg = vd->cfg;
} else {
source = &vd->source;
cfg = va_arg(args, const vout_display_cfg_t *);
}
if (sys->overlay) {
sys->display = SDL_SetVideoMode(cfg->display.width, cfg->display.height,
sys->display_bpp, sys->display_flags);
vout_display_PlacePicture(&sys->place, source, cfg, !sys->overlay);
vout_display_PlacePicture(&sys->place, &vd->source, cfg, !sys->overlay);
} else {
vout_display_SendEventPicturesInvalid(vd);
}
......
......@@ -294,17 +294,14 @@ static int Control(vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
{
const vout_display_cfg_t *cfg;
const video_format_t *src;
if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT
|| query == VOUT_DISPLAY_CHANGE_SOURCE_CROP)
{
src = va_arg(ap, const video_format_t *);
cfg = vd->cfg;
}
else
{
src = &vd->source;
cfg = va_arg(ap, const vout_display_cfg_t *);
}
......@@ -314,7 +311,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
sys->x += place.width / 2;
sys->y += place.height / 2;
vout_display_PlacePicture(&place, src, cfg, false);
vout_display_PlacePicture(&place, &vd->source, cfg, false);
sys->x -= place.width / 2;
sys->y -= place.height / 2;
......@@ -322,7 +319,7 @@ static int Control(vout_display_t *vd, int query, va_list ap)
{
video_format_t fmt;
video_format_ApplyRotation(&fmt, src);
video_format_ApplyRotation(&fmt, &vd->source);
wp_viewport_set_source(sys->viewport,
wl_fixed_from_int(fmt.i_x_offset),
wl_fixed_from_int(fmt.i_y_offset),
......
......@@ -652,19 +652,17 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
switch (query) {
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */
case VOUT_DISPLAY_CHANGE_ZOOM: /* const vout_display_cfg_t *p_cfg */
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: /* const video_format_t *p_source */
case VOUT_DISPLAY_CHANGE_SOURCE_CROP: { /* const video_format_t *p_source */
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
const vout_display_cfg_t *cfg;
if (query == VOUT_DISPLAY_CHANGE_SOURCE_CROP ||
query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) {
const video_format_t *source = va_arg(args, const video_format_t *);
cfg = vd->cfg;
UpdateRects(vd, cfg, source, true);
} else {
cfg = va_arg(args, const vout_display_cfg_t *);
UpdateRects(vd, cfg, NULL, true);
}
UpdateRects(vd, cfg, NULL, true);
return VLC_SUCCESS;
}
#if !VLC_WINSTORE_APP
......
......@@ -724,22 +724,19 @@ static int Control (vout_display_t *vd, int query, va_list ap)
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
{
const vout_display_cfg_t *cfg;
const video_format_t *source;
if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT
|| query == VOUT_DISPLAY_CHANGE_SOURCE_CROP)
{
source = va_arg(ap, const video_format_t *);
cfg = vd->cfg;
}
else
{
source = &vd->source;
cfg = va_arg(ap, const vout_display_cfg_t *);
}
vout_display_place_t place;
vout_display_PlacePicture (&place, source, cfg, false);
vout_display_PlacePicture (&place, &vd->source, cfg, false);
p_sys->width = place.width;
p_sys->height = place.height;
......
......@@ -956,7 +956,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
vd->source.i_sar_den = osys->source.i_sar_den;
}
if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_ASPECT, &vd->source)) {
if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_ASPECT)) {
/* There nothing much we can do. The only reason a vout display
* does not support it is because it need the core to add black border
* to the video for it.
......@@ -1017,7 +1017,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
vd->source.i_visible_height = bottom - top;
video_format_Print(VLC_OBJECT(vd), "SOURCE ", &osys->source);
video_format_Print(VLC_OBJECT(vd), "CROPPED", &vd->source);
if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_CROP, &vd->source)) {
if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_CROP)) {
msg_Err(vd, "Failed to change source crop TODO implement crop at core");
vd->source.i_x_offset = i_x_offset;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment