summaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxbufferpool-add-helper-to-get-omxbuffer-from-gs.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxbufferpool-add-helper-to-get-omxbuffer-from-gs.patch')
-rw-r--r--meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxbufferpool-add-helper-to-get-omxbuffer-from-gs.patch140
1 files changed, 140 insertions, 0 deletions
diff --git a/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxbufferpool-add-helper-to-get-omxbuffer-from-gs.patch b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxbufferpool-add-helper-to-get-omxbuffer-from-gs.patch
new file mode 100644
index 0000000..ed9da8d
--- /dev/null
+++ b/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0007-gstomxbufferpool-add-helper-to-get-omxbuffer-from-gs.patch
@@ -0,0 +1,140 @@
+From 4abd8ac4f18f5baef5a23c7defdb12469192f9c5 Mon Sep 17 00:00:00 2001
+From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+Date: Thu, 1 Sep 2016 17:51:30 +0300
+Subject: [PATCH 07/10] gstomxbufferpool: add helper to get omxbuffer from
+ gstomxbuffer
+
+
+Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+---
+ omx/gstomxbufferpool.c | 21 +++++++++++++++------
+ omx/gstomxbufferpool.h | 2 ++
+ omx/gstomxvideoenc.c | 26 ++++++++++++++++----------
+ 3 files changed, 33 insertions(+), 16 deletions(-)
+
+diff --git a/omx/gstomxbufferpool.c b/omx/gstomxbufferpool.c
+index d86f9d8..eb2fe9d 100644
+--- a/omx/gstomxbufferpool.c
++++ b/omx/gstomxbufferpool.c
+@@ -361,6 +361,17 @@ wrong_video_caps:
+ }
+ }
+
++GstOMXBuffer *gst_omx_buffer_get_omxbuffer (GstBuffer * buffer)
++{
++ GstOMXBuffer *omx_buf;
++
++ omx_buf =
++ gst_mini_object_get_qdata (GST_MINI_OBJECT_CAST (buffer),
++ gst_omx_buffer_data_quark);
++
++ return omx_buf;
++}
++
+ #if defined (HAVE_MMNGRBUF) && defined (HAVE_VIDEODEC_EXT)
+ static gboolean
+ gst_omx_buffer_pool_export_dmabuf (GstOMXBufferPool * pool,
+@@ -697,9 +708,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool,
+ buf = g_ptr_array_index (pool->buffers, pool->enc_buffer_index);
+ g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
+
+- omx_buf =
+- gst_mini_object_get_qdata (GST_MINI_OBJECT_CAST (buf),
+- gst_omx_buffer_data_quark);
++ omx_buf = gst_omx_buffer_get_omxbuffer(buf);
+ pool->enc_buffer_index++;
+ if (pool->enc_buffer_index == pool->port->port_def.nBufferCountActual)
+ pool->enc_buffer_index = 0;
+@@ -739,11 +748,11 @@ gst_omx_buffer_pool_release_buffer (GstBufferPool * bpool, GstBuffer * buffer)
+ g_assert (pool->component && pool->port);
+
+ if (!pool->allocating && !pool->deactivated) {
+- omx_buf =
+- gst_mini_object_get_qdata (GST_MINI_OBJECT_CAST (buffer),
+- gst_omx_buffer_data_quark);
++ omx_buf = gst_omx_buffer_get_omxbuffer(buffer);
++
+ if (GST_IS_OMX_VIDEO_ENC (pool->element))
+ omx_buf->exported = FALSE;
++
+ if (pool->port->port_def.eDir == OMX_DirOutput && !omx_buf->used) {
+ /* Release back to the port, can be filled again */
+ err = gst_omx_port_release_buffer (pool->port, omx_buf);
+diff --git a/omx/gstomxbufferpool.h b/omx/gstomxbufferpool.h
+index 09cab8d..0c6f18b 100644
+--- a/omx/gstomxbufferpool.h
++++ b/omx/gstomxbufferpool.h
+@@ -101,6 +101,8 @@ GType gst_omx_buffer_pool_get_type (void);
+
+ GstBufferPool *gst_omx_buffer_pool_new (GstElement * element, GstOMXComponent * component, GstOMXPort * port);
+
++GstOMXBuffer *gst_omx_buffer_get_omxbuffer (GstBuffer * buffer);
++
+ G_END_DECLS
+
+ #endif /* __GST_OMX_BUFFER_POOL_H__ */
+diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
+index b36c46e..e96ff28 100644
+--- a/omx/gstomxvideoenc.c
++++ b/omx/gstomxvideoenc.c
+@@ -1786,7 +1786,8 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
+ gst_omx_error_to_string (err), err);
+ }
+
+- if (self->in_port_pool) {
++ if ((self->in_port_pool) &&
++ (frame->input_buffer->pool == self->in_port_pool)) {
+ GstMapInfo in_info;
+ gint count = 0;
+ GstOMXBufferPool *pool = GST_OMX_BUFFER_POOL (self->in_port_pool);
+@@ -1795,13 +1796,15 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
+ * encoder
+ */
+ if (!pool->deactivated) {
+- if (!gst_buffer_map (frame->input_buffer, &in_info, GST_MAP_READ)) {
+- GST_ERROR_OBJECT (self, "Can not map input buffer");
+- gst_omx_port_release_buffer (port, buf);
+- goto flow_error;
++ GstOMXBuffer *omx_buf;
++
++ omx_buf = gst_omx_buffer_get_omxbuffer(frame->input_buffer);
++ if (!omx_buf) {
++ GST_ERROR_OBJECT (self, "Can not get OMXBuffer from GstBuffer");
++ return GST_FLOW_ERROR;
+ }
+
+- if (buf->omx_buf->pBuffer != in_info.data) {
++ if (buf != omx_buf) {
+ gst_omx_port_release_buffer (port, buf);
+ do {
+ acq_ret = gst_omx_port_acquire_buffer (port, &buf);
+@@ -1809,10 +1812,10 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
+ GST_ERROR_OBJECT (self, "Can acquire buffer from input port");
+ return GST_FLOW_ERROR;
+ }
+- if (buf->omx_buf->pBuffer != in_info.data)
++ if (buf != omx_buf)
+ gst_omx_port_release_buffer (port, buf);
+ count += 1;
+- } while (buf->omx_buf->pBuffer != in_info.data
++ } while (buf != omx_buf
+ && count < port->port_def.nBufferCountActual * 3);
+ }
+ if (count == port->port_def.nBufferCountActual * 3) {
+@@ -1820,8 +1823,11 @@ gst_omx_video_enc_handle_frame (GstVideoEncoder * encoder,
+ "Can not get target OMXBuffer after 3 times searching");
+ goto flow_error;
+ }
+- buf->omx_buf->nFilledLen = in_info.size;
+- gst_buffer_unmap (frame->input_buffer, &in_info);
++ GST_DEBUG_OBJECT (self, "found target OMXBuffer %p", buf);
++ //buf->omx_buf->nFilledLen = gst_buffer_get_size (frame->input_buffer);
++ buf->omx_buf->nFilledLen = buf->omx_buf->nAllocLen - buf->omx_buf->nOffset;
++ GST_DEBUG_OBJECT (self, "set nFilledLen = %d", buf->omx_buf->nFilledLen);
++
+ }
+ } else {
+ /* Copy the buffer content in chunks of size as requested
+--
+1.7.10.4
+