Browse Source

android/display: tell libvlcjni where we want the video to be in the window

Requires https://code.videolan.org/robUx4/libvlcjni/-/commits/core-video-place
pull/200/head
Steve Lhomme 8 months ago
committed by Felix Paul Kühne
parent
commit
107a237963
  1. 10
      modules/video_output/android/display.c
  2. 13
      modules/video_output/android/utils.c
  3. 5
      modules/video_output/android/utils.h

10
modules/video_output/android/display.c

@ -543,12 +543,8 @@ static void SetVideoLayout(vout_display_t *vd)
if (!sys->can_set_video_layout)
return;
video_format_t rot_fmt;
video_format_ApplyRotation(&rot_fmt, vd->source);
AWindowHandler_setVideoLayout(sys->awh, rot_fmt.i_width, rot_fmt.i_height,
rot_fmt.i_visible_width,
rot_fmt.i_visible_height,
rot_fmt.i_sar_num, rot_fmt.i_sar_den);
AWindowHandler_setVideoLayout(sys->awh, vd->cfg->display.width, vd->cfg->display.height,
vd->place);
}
static void UpdateASCGeometry(vout_display_t *vd)
@ -632,7 +628,7 @@ static void Close(vout_display_t *vd)
struct sys *sys = vd->sys;
if (sys->can_set_video_layout)
AWindowHandler_setVideoLayout(sys->awh, 0, 0, 0, 0, 0, 0);
AWindowHandler_setVideoLayout(sys->awh, 0, 0, vd->place);
if (sys->asc.sc != NULL)
{

13
modules/video_output/android/utils.c

@ -1168,17 +1168,20 @@ AWindowHandler_getCapabilities(AWindowHandler *p_awh)
int
AWindowHandler_setVideoLayout(AWindowHandler *p_awh,
int i_width, int i_height,
int i_visible_width, int i_visible_height,
int i_sar_num, int i_sar_den)
int i_display_width, int i_display_height,
const vout_display_place_t *place)
{
assert(p_awh->capabilities & AWH_CAPS_SET_VIDEO_LAYOUT);
JNIEnv *p_env = AWindowHandler_getEnv(p_awh);
if (!p_env)
return VLC_EGENERIC;
JNI_ANWCALL(CallVoidMethod, setVideoLayout, i_width, i_height,
i_visible_width,i_visible_height, i_sar_num, i_sar_den);
vout_display_place_t zero = {0};
if (place == NULL)
place = &zero;
JNI_ANWCALL(CallVoidMethod, setVideoLayout, i_display_width, i_display_height,
(int)place->width, (int)place->height, place->x, place->y);
return VLC_SUCCESS;
}

5
modules/video_output/android/utils.h

@ -331,9 +331,8 @@ int AWindowHandler_getCapabilities(AWindowHandler *p_awh);
* Should be called only if AWindowHandler_getCapabilities() has AWH_CAPS_SET_VIDEO_LAYOUT
*/
int AWindowHandler_setVideoLayout(AWindowHandler *p_awh,
int i_width, int i_height,
int i_visible_width, int i_visible_height,
int i_sar_num, int i_sar_den);
int i_display_width, int i_display_height,
const vout_display_place_t *);
/**
* Attach a SurfaceTexture to the OpenGL ES context that is current on the

Loading…
Cancel
Save