Commit 66142747 authored by Wim Taymans's avatar Wim Taymans

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.
parent 27e622b9
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment