[vlc-commits] [Git][videolan/vlc][master] 10 commits: android/display: factorize the Crop/Aspect code
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun Sep 8 12:21:49 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
1e7364ec by Steve Lhomme at 2024-09-08T12:05:11+00:00
android/display: factorize the Crop/Aspect code
- - - - -
f916a439 by Steve Lhomme at 2024-09-08T12:05:11+00:00
android/display: always copy the crop/SAR info on crop/aspect change
VOUT_DISPLAY_CHANGE_SOURCE_ASPECT only changes the SAR values
VOUT_DISPLAY_CHANGE_SOURCE_CROP only changes offset+visible values
But the values always valid during each call.
- - - - -
286ffc88 by Steve Lhomme at 2024-09-08T12:05:11+00:00
android/display: always pass the SAR when cropping
If it's 0/0 then the code is equivalent.
If it has an actual crop value it's valid even during crop.
onNewVideoLayout() in libvlcjni [1] will apply the values regardless
if the crop is passed or not. And it will discard it if one SAR value is 0.
[1] https://code.videolan.org/videolan/libvlcjni/-/blob/5076ef767eb4126c74a496033ace54649ac200e7/libvlc/src/main/java/org/videolan/libvlc/VideoHelper.java#L323
- - - - -
232aaf6c by Steve Lhomme at 2024-09-08T12:05:11+00:00
android/display: always pass the crop/visible area when applying a SAR
The value is valid when we get a SAR event.
onNewVideoLayout() in libvlcjni [1] will apply the values regardless
if the SAR is passed or not.
[1] https://code.videolan.org/videolan/libvlcjni/-/blob/5076ef767eb4126c74a496033ace54649ac200e7/libvlc/src/main/java/org/videolan/libvlc/VideoHelper.java#L323
- - - - -
1a957350 by Steve Lhomme at 2024-09-08T12:05:11+00:00
android/display: factorize SetVideoLayout code
The AWindowHandler_setVideoLayout() is the same with or without crop.
- - - - -
71aa5958 by Steve Lhomme at 2024-09-08T12:05:11+00:00
android/display: always pass the source dimensions
They will likely not change but the value in vd->source is always the
most up to date.
- - - - -
bd9ef557 by Steve Lhomme at 2024-09-08T12:05:11+00:00
android/display: intialize sys->fmt from vd->source
When opening a display module, vd->source is the same as the output video format.
- - - - -
2bca9fee by Steve Lhomme at 2024-09-08T12:05:11+00:00
android/display: remove internal video format
It's always the same as the source format.
Sometimes it had the rotation of vd->source applied and sometimes not.
In both cases it's used to get a rotated version of vd->source.
- - - - -
525af6c9 by Steve Lhomme at 2024-09-08T12:05:11+00:00
android/display: use SetVideoLayout() to init the video layout on open
- - - - -
cc464b29 by Steve Lhomme at 2024-09-08T12:05:11+00:00
android/display: group VOUT_DISPLAY_CHANGE_SOURCE_CROP/ASPECT control
- - - - -
1 changed file:
- modules/video_output/android/display.c
Changes:
=====================================
modules/video_output/android/display.c
=====================================
@@ -63,7 +63,6 @@ struct sys
{
AWindowHandler *awh;
android_video_context_t *avctx;
- video_format_t fmt;
struct subpicture sub;
};
@@ -276,8 +275,8 @@ static int subpicture_OpenDisplay(vout_display_t *vd)
const vlc_window_cfg_t win_cfg = {
.is_fullscreen = true,
.is_decorated = false,
- .width = sys->fmt.i_width,
- .height = sys->fmt.i_height,
+ .width = vd->source->i_width,
+ .height = vd->source->i_height,
};
const vlc_window_owner_t win_owner = {
@@ -375,6 +374,18 @@ static void Display(vout_display_t *vd, picture_t *picture)
subpicture_Display(vd);
}
+static void SetVideoLayout(vout_display_t *vd)
+{
+ struct sys *sys = vd->sys;
+
+ 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);
+}
+
static int Control(vout_display_t *vd, int query)
{
struct sys *sys = vd->sys;
@@ -384,35 +395,16 @@ static int Control(vout_display_t *vd, int query)
switch (query) {
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
+ case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
{
- msg_Dbg(vd, "change source crop: %ux%u @ %ux%u",
+ msg_Dbg(vd, "change source crop: %ux%u @ %ux%u aspect: %u/%u",
vd->source->i_x_offset, vd->source->i_y_offset,
vd->source->i_visible_width,
- vd->source->i_visible_height);
-
- video_format_CopyCrop(&sys->fmt, vd->source);
-
- video_format_t rot_fmt;
- video_format_ApplyRotation(&rot_fmt, &sys->fmt);
- AWindowHandler_setVideoLayout(sys->awh, 0, 0,
- rot_fmt.i_visible_width,
- rot_fmt.i_visible_height,
- 0, 0);
- return VLC_SUCCESS;
- }
- case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- {
- msg_Dbg(vd, "change source aspect: %d/%d", vd->source->i_sar_num,
+ vd->source->i_visible_height,
+ vd->source->i_sar_num,
vd->source->i_sar_den);
- sys->fmt.i_sar_num = vd->source->i_sar_num;
- sys->fmt.i_sar_den = vd->source->i_sar_den;
- video_format_t rot_fmt;
- video_format_ApplyRotation(&rot_fmt, &sys->fmt);
- if (rot_fmt.i_sar_num != 0 && rot_fmt.i_sar_den != 0)
- AWindowHandler_setVideoLayout(sys->awh, 0, 0, 0, 0,
- rot_fmt.i_sar_num, rot_fmt.i_sar_den);
-
+ SetVideoLayout(vd);
return VLC_SUCCESS;
}
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
@@ -464,8 +456,6 @@ static int Open(vout_display_t *vd,
if (sys == NULL)
return VLC_ENOMEM;
- video_format_ApplyRotation(&sys->fmt, fmtp);
-
sys->awh = awh;
sys->avctx = vlc_video_context_GetPrivate(context, VLC_VIDEO_CONTEXT_AWINDOW);
assert(sys->avctx);
@@ -495,13 +485,7 @@ static int Open(vout_display_t *vd,
sys->sub.window = NULL;
}
- video_format_t rot_fmt;
- video_format_ApplyRotation(&rot_fmt, &sys->fmt);
-
- 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);
+ SetVideoLayout(vd);
static const struct vlc_display_operations ops = {
.close = Close,
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/da23e939a5595de6fe123fb54a7d41a9833e0b3f...cc464b2975178e5bb56fd499ff9195d3e0263411
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/da23e939a5595de6fe123fb54a7d41a9833e0b3f...cc464b2975178e5bb56fd499ff9195d3e0263411
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list