gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstBuffer * ximage)
{
GstMetaXImage *meta;
+ GstMetaVideoCrop *crop;
GstVideoRectangle src, dst, result;
gboolean draw_border = FALSE;
}
meta = gst_buffer_get_meta_ximage (ximage);
+ crop = gst_buffer_get_meta_video_crop (ximage);
- src.w = meta->width;
- src.h = meta->height;
+ if (crop) {
+ src.x = crop->x;
+ src.y = crop->y;
+ src.w = crop->width;
+ src.h = crop->height;
+ } else {
+ src.x = 0;
+ src.y = 0;
+ src.w = meta->width;
+ src.h = meta->height;
+ }
dst.w = ximagesink->xwindow->width;
dst.h = ximagesink->xwindow->height;
ximage, 0, 0, result.x, result.y, result.w, result.h,
ximagesink->xwindow->width, ximagesink->xwindow->height);
XShmPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
- ximagesink->xwindow->gc, meta->ximage, 0, 0, result.x, result.y,
+ ximagesink->xwindow->gc, meta->ximage, src.x, src.y, result.x, result.y,
result.w, result.h, FALSE);
} else
#endif /* HAVE_XSHM */
ximage, 0, 0, result.x, result.y, result.w, result.h,
ximagesink->xwindow->width, ximagesink->xwindow->height);
XPutImage (ximagesink->xcontext->disp, ximagesink->xwindow->win,
- ximagesink->xwindow->gc, meta->ximage, 0, 0, result.x, result.y,
+ ximagesink->xwindow->gc, meta->ximage, src.x, src.y, result.x, result.y,
result.w, result.h);
}
gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, GstBuffer * xvimage)
{
GstMetaXvImage *meta;
+ GstMetaVideoCrop *crop;
GstVideoRectangle result;
gboolean draw_border = FALSE;
+ GstVideoRectangle src, dst;
/* We take the flow_lock. If expose is in there we don't want to run
concurrently from the data flow thread */
meta = gst_buffer_get_meta_xvimage (xvimage);
- if (xvimagesink->keep_aspect) {
- GstVideoRectangle src, dst;
+ crop = gst_buffer_get_meta_video_crop (xvimage);
- /* We use the calculated geometry from _setcaps as a source to respect
- source and screen pixel aspect ratios. */
- src.w = GST_VIDEO_SINK_WIDTH (xvimagesink);
- src.h = GST_VIDEO_SINK_HEIGHT (xvimagesink);
+ if (crop) {
+ src.x = crop->x;
+ src.y = crop->y;
+ src.w = crop->width;
+ src.h = crop->height;
+ } else {
+ src.x = 0;
+ src.y = 0;
+ src.w = meta->width;
+ src.h = meta->height;
+ }
+
+ if (xvimagesink->keep_aspect) {
dst.w = xvimagesink->render_rect.w;
dst.h = xvimagesink->render_rect.h;
xvimagesink->xcontext->xv_port_id,
xvimagesink->xwindow->win,
xvimagesink->xwindow->gc, meta->xvimage,
- xvimagesink->disp_x, xvimagesink->disp_y,
- xvimagesink->disp_width, xvimagesink->disp_height,
+ src.x, src.y, src.w, src.h,
result.x, result.y, result.w, result.h, FALSE);
} else
#endif /* HAVE_XSHM */
xvimagesink->xcontext->xv_port_id,
xvimagesink->xwindow->win,
xvimagesink->xwindow->gc, meta->xvimage,
- xvimagesink->disp_x, xvimagesink->disp_y,
- xvimagesink->disp_width, xvimagesink->disp_height,
- result.x, result.y, result.w, result.h);
+ src.x, src.y, src.w, src.h, result.x, result.y, result.w, result.h);
}
XSync (xvimagesink->xcontext->disp, FALSE);
GstBufferPool *newpool, *oldpool;
GstVideoInfo info;
guint32 im_format = 0;
- gint disp_x, disp_y;
- gint disp_width, disp_height;
gint video_par_n, video_par_d; /* video's PAR */
gint display_par_n, display_par_d; /* display's PAR */
- const GValue *caps_disp_reg;
guint num, den;
gint size;
display_par_d = 1;
}
- /* get the display region */
- caps_disp_reg = gst_structure_get_value (structure, "display-region");
- if (caps_disp_reg) {
- disp_x = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 0));
- disp_y = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 1));
- disp_width = g_value_get_int (gst_value_array_get_value (caps_disp_reg, 2));
- disp_height =
- g_value_get_int (gst_value_array_get_value (caps_disp_reg, 3));
- } else {
- disp_x = disp_y = 0;
- disp_width = info.width;
- disp_height = info.height;
- }
-
if (!gst_video_calculate_display_ratio (&num, &den, info.width,
info.height, video_par_n, video_par_d, display_par_n, display_par_d))
goto no_disp_ratio;
- xvimagesink->disp_x = disp_x;
- xvimagesink->disp_y = disp_y;
- xvimagesink->disp_width = disp_width;
- xvimagesink->disp_height = disp_height;
-
GST_DEBUG_OBJECT (xvimagesink,
"video width/height: %dx%d, calculated display ratio: %d/%d",
info.width, info.height, num, den);