[vlc-commits] [Git][videolan/vlc][master] 2 commits: caca: don't restart the dither if the source dimension didn't change
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Apr 20 15:03:19 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
78414e39 by Steve Lhomme at 2024-04-20T14:40:12+00:00
caca: don't restart the dither if the source dimension didn't change
Ideally we would just update the dither locally, but we need the pitch of the
picture. Hopefully it's the same when the picture information don't change...
If the values used to create the dither, no need to force a re-creation.
- - - - -
f833a6ed by Steve Lhomme at 2024-04-20T14:40:12+00:00
caca: handle CHANGE_SOURCE_PLACE like a CROP change
The module only works in non windowed mode (dummy window). And it doesn't report any size change.
So if the video placement changes that means:
- the source/user cropping has changed
- the source/user aspect ration has changed (unused here)
- the user zoom has changed (unused here)
- the filling mode has changed (unused here)
- - - - -
1 changed file:
- modules/video_output/caca.c
Changes:
=====================================
modules/video_output/caca.c
=====================================
@@ -54,6 +54,9 @@ typedef struct vout_display_sys_t {
caca_canvas_t *cv;
caca_display_t *dp;
caca_dither_t *dither;
+ unsigned dither_width, dither_height;
+ int dither_pitch;
+ bool update_dither;
bool dead;
vlc_queue_t q;
@@ -133,7 +136,14 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
vout_display_sys_t *sys = vd->sys;
- if (!sys->dither) {
+ if (!sys->dither || (sys->update_dither && (
+ sys->dither_width != vd->source->i_visible_width ||
+ sys->dither_height != vd->source->i_visible_height ||
+ sys->dither_pitch != picture->p[0].i_pitch
+ ) ) ) {
+ if (sys->dither)
+ caca_free_dither(sys->dither);
+
/* Create the libcaca dither object */
sys->dither = caca_create_dither(32,
vd->source->i_visible_width,
@@ -148,6 +158,10 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
msg_Err(vd, "could not create libcaca dither object");
return;
}
+ sys->dither_width = vd->source->i_visible_width;
+ sys->dither_height = vd->source->i_visible_height;
+ sys->dither_pitch = picture->p[0].i_pitch;
+ sys->update_dither = false;
}
caca_set_color_ansi(sys->cv, CACA_DEFAULT, CACA_BLACK);
@@ -182,13 +196,11 @@ static int Control(vout_display_t *vd, int query)
switch (query) {
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
- if (sys->dither)
- caca_free_dither(sys->dither);
- sys->dither = NULL;
- /* fall through */
+ case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
+ sys->update_dither = true;
+ return VLC_SUCCESS;
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
- case VOUT_DISPLAY_CHANGE_SOURCE_PLACE:
return VLC_SUCCESS;
default:
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2a58b2bf9263b33538bca88ab4e5e6a04e73c88e...f833a6edd31c7b79c33d1d115c5ec0136a41a0bc
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2a58b2bf9263b33538bca88ab4e5e6a04e73c88e...f833a6edd31c7b79c33d1d115c5ec0136a41a0bc
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