mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
xv: apply cropping on padded images
Store the dimensions of the unpadded image in the metadata and use that info to display the valid region of the image.
This commit is contained in:
parent
27e622b99e
commit
66142747bd
3 changed files with 11 additions and 7 deletions
|
@ -107,8 +107,10 @@ gst_buffer_add_meta_xvimage (GstBuffer * buffer, GstXvImageBufferPool * xvpool)
|
|||
meta->SHMInfo.shmaddr = ((void *) -1);
|
||||
meta->SHMInfo.shmid = -1;
|
||||
#endif
|
||||
meta->width = width;
|
||||
meta->height = height;
|
||||
meta->x = priv->align.padding_left;
|
||||
meta->y = priv->align.padding_top;
|
||||
meta->width = priv->info.width;
|
||||
meta->height = priv->info.height;
|
||||
meta->sink = gst_object_ref (xvimagesink);
|
||||
meta->im_format = im_format;
|
||||
|
||||
|
|
|
@ -76,7 +76,9 @@ struct _GstMetaXvImage
|
|||
XShmSegmentInfo SHMInfo;
|
||||
#endif /* HAVE_XSHM */
|
||||
|
||||
gint width, height, im_format;
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
gint im_format;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
|
|
|
@ -313,13 +313,13 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, GstBuffer * xvimage)
|
|||
crop = gst_buffer_get_meta_video_crop (xvimage);
|
||||
|
||||
if (crop) {
|
||||
src.x = crop->x;
|
||||
src.y = crop->y;
|
||||
src.x = crop->x + meta->x;
|
||||
src.y = crop->y + meta->y;
|
||||
src.w = crop->width;
|
||||
src.h = crop->height;
|
||||
} else {
|
||||
src.x = 0;
|
||||
src.y = 0;
|
||||
src.x = meta->x;
|
||||
src.y = meta->y;
|
||||
src.w = meta->width;
|
||||
src.h = meta->height;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue