[vlc-commits] access: bluray: use temp var and disambiguate blurayDrawOverlay
Francois Cartegnie
git at videolan.org
Mon Mar 9 10:40:38 CET 2020
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Mar 6 16:04:27 2020 +0100| [5dba375c4c5d1f8eeb7ff355265ed7355d974abb] | committer: Francois Cartegnie
access: bluray: use temp var and disambiguate blurayDrawOverlay
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5dba375c4c5d1f8eeb7ff355265ed7355d974abb
---
modules/access/bluray.c | 75 +++++++++++++++++++++++++------------------------
1 file changed, 38 insertions(+), 37 deletions(-)
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 2796f099ea..39606d75c6 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -1882,36 +1882,37 @@ static void blurayClearOverlay(demux_t *p_demux, int plane)
* This will draw to the overlay by adding a region to our region list
* This will have to be copied to the subpicture used to render the overlay.
*/
-static void blurayDrawOverlay(demux_t *p_demux, const BD_OVERLAY* const ov)
+static void blurayDrawOverlay(demux_t *p_demux, const BD_OVERLAY* const eventov)
{
demux_sys_t *p_sys = p_demux->p_sys;
+ bluray_overlay_t *ov = p_sys->bdj.p_overlays[eventov->plane];
/*
* Compute a subpicture_region_t.
* It will be copied and sent to the vout later.
*/
- vlc_mutex_lock(&p_sys->bdj.p_overlays[ov->plane]->lock);
+ vlc_mutex_lock(&ov->lock);
/* Find a region to update */
- subpicture_region_t **pp_reg = &p_sys->bdj.p_overlays[ov->plane]->p_regions;
- subpicture_region_t *p_reg = p_sys->bdj.p_overlays[ov->plane]->p_regions;
+ subpicture_region_t **pp_reg = &ov->p_regions;
+ subpicture_region_t *p_reg = ov->p_regions;
subpicture_region_t *p_last = NULL;
while (p_reg != NULL) {
p_last = p_reg;
- if (p_reg->i_x == ov->x && p_reg->i_y == ov->y &&
- p_reg->fmt.i_width == ov->w && p_reg->fmt.i_height == ov->h)
+ if (p_reg->i_x == eventov->x && p_reg->i_y == eventov->y &&
+ p_reg->fmt.i_width == eventov->w && p_reg->fmt.i_height == eventov->h)
break;
pp_reg = &p_reg->p_next;
p_reg = p_reg->p_next;
}
- if (!ov->img) {
+ if (!eventov->img) {
if (p_reg) {
/* drop region */
*pp_reg = p_reg->p_next;
subpicture_region_Delete(p_reg);
}
- vlc_mutex_unlock(&p_sys->bdj.p_overlays[ov->plane]->lock);
+ vlc_mutex_unlock(&ov->lock);
return;
}
@@ -1919,41 +1920,41 @@ static void blurayDrawOverlay(demux_t *p_demux, const BD_OVERLAY* const ov)
if (!p_reg) {
video_format_t fmt;
video_format_Init(&fmt, 0);
- video_format_Setup(&fmt, VLC_CODEC_YUVP, ov->w, ov->h, ov->w, ov->h, 1, 1);
+ video_format_Setup(&fmt, VLC_CODEC_YUVP, eventov->w, eventov->h, eventov->w, eventov->h, 1, 1);
p_reg = subpicture_region_New(&fmt);
if (p_reg) {
- p_reg->i_x = ov->x;
- p_reg->i_y = ov->y;
+ p_reg->i_x = eventov->x;
+ p_reg->i_y = eventov->y;
/* Append it to our list. */
if (p_last != NULL)
p_last->p_next = p_reg;
else /* If we don't have a last region, then our list empty */
- p_sys->bdj.p_overlays[ov->plane]->p_regions = p_reg;
+ ov->p_regions = p_reg;
}
}
/* Now we can update the region, regardless it's an update or an insert */
- const BD_PG_RLE_ELEM *img = ov->img;
- for (int y = 0; y < ov->h; y++)
- for (int x = 0; x < ov->w;) {
+ const BD_PG_RLE_ELEM *img = eventov->img;
+ for (int y = 0; y < eventov->h; y++)
+ for (int x = 0; x < eventov->w;) {
plane_t *p = &p_reg->p_picture->p[0];
memset(&p->p_pixels[y * p->i_pitch + x], img->color, img->len);
x += img->len;
img++;
}
- if (ov->palette) {
+ if (eventov->palette) {
p_reg->fmt.p_palette->i_entries = 256;
for (int i = 0; i < 256; ++i) {
- p_reg->fmt.p_palette->palette[i][0] = ov->palette[i].Y;
- p_reg->fmt.p_palette->palette[i][1] = ov->palette[i].Cb;
- p_reg->fmt.p_palette->palette[i][2] = ov->palette[i].Cr;
- p_reg->fmt.p_palette->palette[i][3] = ov->palette[i].T;
+ p_reg->fmt.p_palette->palette[i][0] = eventov->palette[i].Y;
+ p_reg->fmt.p_palette->palette[i][1] = eventov->palette[i].Cb;
+ p_reg->fmt.p_palette->palette[i][2] = eventov->palette[i].Cr;
+ p_reg->fmt.p_palette->palette[i][3] = eventov->palette[i].T;
}
}
- vlc_mutex_unlock(&p_sys->bdj.p_overlays[ov->plane]->lock);
+ vlc_mutex_unlock(&ov->lock);
/*
* /!\ The region is now stored in our internal list, but not in the subpicture /!\
*/
@@ -2009,14 +2010,14 @@ static void blurayInitArgbOverlay(demux_t *p_demux, int plane, int width, int he
blurayInitOverlay(p_demux, plane, width, height);
}
-static void blurayDrawArgbOverlay(demux_t *p_demux, const BD_ARGB_OVERLAY* const ov)
+static void blurayDrawArgbOverlay(demux_t *p_demux, const BD_ARGB_OVERLAY* const eventov)
{
demux_sys_t *p_sys = p_demux->p_sys;
- bluray_overlay_t *bdov = p_sys->bdj.p_overlays[ov->plane];
- vlc_mutex_lock(&bdov->lock);
+ bluray_overlay_t *ov = p_sys->bdj.p_overlays[eventov->plane];
+ vlc_mutex_lock(&ov->lock);
- if (!bdov->p_regions)
+ if (!ov->p_regions)
{
video_format_t fmt;
video_format_Init(&fmt, 0);
@@ -2027,32 +2028,32 @@ static void blurayDrawArgbOverlay(demux_t *p_demux, const BD_ARGB_OVERLAY* const
#else
VLC_CODEC_BGRA,
#endif
- ov->stride, bdov->height,
- bdov->width, bdov->height, 1, 1);
- bdov->p_regions = subpicture_region_New(&fmt);
+ eventov->stride, ov->height,
+ ov->width, ov->height, 1, 1);
+ ov->p_regions = subpicture_region_New(&fmt);
}
/* Find a region to update */
- subpicture_region_t *p_reg = bdov->p_regions;
+ subpicture_region_t *p_reg = ov->p_regions;
if (!p_reg) {
- vlc_mutex_unlock(&bdov->lock);
+ vlc_mutex_unlock(&ov->lock);
return;
}
/* Now we can update the region */
- const uint32_t *src0 = ov->argb;
+ const uint32_t *src0 = eventov->argb;
uint8_t *dst0 = p_reg->p_picture->p[0].p_pixels +
- p_reg->p_picture->p[0].i_pitch * ov->y +
- ov->x * 4;
+ p_reg->p_picture->p[0].i_pitch * eventov->y +
+ eventov->x * 4;
- for (int y = 0; y < ov->h; y++)
+ for (int y = 0; y < eventov->h; y++)
{
- memcpy(dst0, src0, ov->w * 4);
- src0 += ov->stride;
+ memcpy(dst0, src0, eventov->w * 4);
+ src0 += eventov->stride;
dst0 += p_reg->p_picture->p[0].i_pitch;
}
- vlc_mutex_unlock(&bdov->lock);
+ vlc_mutex_unlock(&ov->lock);
/*
* /!\ The region is now stored in our internal list, but not in the subpicture /!\
*/
More information about the vlc-commits
mailing list