[vlc-devel] [vlc-commits] commit: vmem: By default keep the original image aspect ratio. (Pierre d' Herbemont )
Laurent Aimar
fenrir at elivagar.org
Sun Oct 31 12:32:25 CET 2010
Hi
> @@ -266,6 +294,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
> return VLC_EGENERIC;
> if (cfg->is_fullscreen)
> return VLC_EGENERIC;
> +
Cosmetics changes...
> - for (int i = 0; i < picture->i_planes; i++)
> - picture->p[i].p_pixels = planes[i];
> + const int y = sys->place.y;
> + const int x = sys->place.x;
> + const int pitch = sys->vmem_pitch;
> + const int bbp = pitch / sys->vmem_width;
This is wrong, the pitch is not a multiple of the width.
Use picture->p[i].i_pixel_pitch instead.
> + for (int i = 0; i < picture->i_planes; i++) {
> + uint8_t *p = planes[i];
Why keeping the intermediate planes[] buffer? You should be able to
simplify by using picsys->original_planes, no?
> + picsys->original_planes[i] = p;
> + picture->p[i].p_pixels = p + x * bbp + y * pitch;
> + picture->p[i].i_lines = sys->place.height;
> + }
Also, it seems that you suppose that the vmem users initializes the picture
to a sensible color for the border. You should at least document it.
> return VLC_SUCCESS;
> }
> @@ -300,7 +338,7 @@ static void Unlock(picture_t *picture)
> void *planes[PICTURE_PLANE_MAX];
>
> for (int i = 0; i < picture->i_planes; i++)
> - planes[i] = picture->p[i].p_pixels;
> + planes[i] = picsys->original_planes[i];
>
> if (sys->unlock != NULL)
> sys->unlock(sys->opaque, picsys->id, planes);
Same there (planes[]).
--
fenrir
More information about the vlc-devel
mailing list