meta-digi/meta-digi-del/recipes-multimedia/gst-fsl-plugin/gst-fsl-plugin-2.0.3/0009-mfw_v4lsink-Do-not-ign...

57 lines
2.2 KiB
Diff

From: Alex Gonzalez <alex.gonzalez@digi.com>
Date: Wed, 2 May 2012 10:53:19 +0200
Subject: [PATCH] mfw_v4lsink: Do not ignore cropping dimensions.
When the sink issues a S_CROP followed by a S_OUTPUT, the later resets the
crop dimensions to full screen. In order to keep the cropping dimensions,
a new S_CROP needs to be issued after the S_OUTPUT.
This change reuses an init call that was only called in the case of X11
which reissues the crop. It also needs to make sure that the previous
crop information is erased, otherwise the cropping function will decide
that it won't perform a crop if the dimensions have not changed.
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
---
src/misc/v4l_sink/src/mfw_gst_v4lsink.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/misc/v4l_sink/src/mfw_gst_v4lsink.c b/src/misc/v4l_sink/src/mfw_gst_v4lsink.c
index 2227c3d..3ba9c78 100755
--- a/src/misc/v4l_sink/src/mfw_gst_v4lsink.c
+++ b/src/misc/v4l_sink/src/mfw_gst_v4lsink.c
@@ -1848,6 +1848,7 @@ mfw_gst_v4lsink_buffer_alloc (GstBaseSink * bsink, guint64 offset,
gint frame_buffer_size;
gint max_frames;
gint hwbuffernumforcodec;
+ struct v4l2_crop *prevCrop = &v4l_info->prevCrop;
gboolean result = FALSE;
@@ -1985,7 +1986,6 @@ mfw_gst_v4lsink_buffer_alloc (GstBaseSink * bsink, guint64 offset,
return GST_FLOW_ERROR;
}
-#ifdef USE_X11
/* Two cases:
* 1. VPU will request buffer first, when pipeline enter running state,
* every parameter is ready.
@@ -1994,13 +1994,15 @@ mfw_gst_v4lsink_buffer_alloc (GstBaseSink * bsink, guint64 offset,
*/
if (element->current_state == GST_STATE_PLAYING) {
+#ifdef USE_X11
GST_INFO("element state already switch to PLAYING, create event thread");
mfw_gst_v4lsink_create_event_thread(v4l_info);
+#endif
+ // Digi: Force the crop to take effect by losing the previous crop info
+ memset(prevCrop,0,sizeof(struct v4l2_crop));
mfw_gst_v4l2_display_init(v4l_info, v4l_info->disp_width, v4l_info->disp_height);
-
}
-#endif
/*
* The software H264 decoder need check the "num-buffers-required"