summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2011-07-01 13:05:12 +0200
committerMichael Grzeschik <m.grzeschik@pengutronix.de>2011-07-01 13:05:12 +0200
commit15249d89a61851f6e5538993c577b69b92ddc433 (patch)
treefca8c7150b6918106394578c95760888581084c9
parent7c3e8de49852cd0269dc84dd605f199f39d3b2c8 (diff)
downloadgst-plugins-fsl-vpu-15249d89a61851f6e5538993c577b69b92ddc433.tar.gz
gst-plugins-fsl-vpu-15249d89a61851f6e5538993c577b69b92ddc433.tar.xz
vpu_encoder: call VIDIOC_STREAMON after we have enqueued the first buffer
-rw-r--r--src/mfw_gst_vpu_encoder.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mfw_gst_vpu_encoder.c b/src/mfw_gst_vpu_encoder.c
index 48ff6c1..919bbcb 100644
--- a/src/mfw_gst_vpu_encoder.c
+++ b/src/mfw_gst_vpu_encoder.c
@@ -78,6 +78,9 @@ typedef struct _GstVPU_Enc
gint bitrate;
gint gopsize;
gboolean codecTypeProvided; /* Set when the user provides the compression format on the command line */
+
+ int once;
+
int vpu_fd;
struct v4l2_buffer buf_v4l2[NUM_BUFFERS];
unsigned char *buf_data[NUM_BUFFERS];
@@ -244,7 +247,6 @@ static int mfw_gst_vpuenc_init_encoder(GstPad *pad, GstBuffer *buffer)
GstCaps *caps = NULL;
struct v4l2_format fmt;
int retval, i;
- unsigned long type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
printf("%s\n", __func__);
if (!vpu_enc->codecTypeProvided) {
@@ -312,12 +314,6 @@ printf("%s\n", __func__);
gst_pad_set_caps(vpu_enc->srcpad, caps);
- retval = ioctl(vpu_enc->vpu_fd, VIDIOC_STREAMON, &type);
- if (retval) {
- printf("streamon failed with %d", retval);
- return GST_FLOW_ERROR;
- }
-
vpu_enc->init = TRUE;
return GST_FLOW_OK;
@@ -332,6 +328,7 @@ static GstFlowReturn mfw_gst_vpuenc_chain(GstPad * pad, GstBuffer * buffer)
gint i = 0;
int ret;
struct pollfd pollfd;
+ unsigned long type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
GST_DEBUG("mfw_gst_vpuenc_chain");
@@ -371,6 +368,15 @@ static GstFlowReturn mfw_gst_vpuenc_chain(GstPad * pad, GstBuffer * buffer)
return GST_FLOW_ERROR;
}
+ if (!vpu_enc->once) {
+ retval = ioctl(vpu_enc->vpu_fd, VIDIOC_STREAMON, &type);
+ if (retval) {
+ printf("streamon failed with %d", retval);
+ return GST_FLOW_ERROR;
+ }
+ vpu_enc->once = 1;
+ }
+
ret = ioctl(vpu_enc->vpu_fd, VIDIOC_DQBUF, &vpu_enc->buf_v4l2[0]);
if (ret) {
GST_ERROR("VIDIOC_DQBUF failed: %s\n", strerror(errno));