summaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-omx-videodec-add-planebuf-to-allocation-request.patch
blob: d863414d1d856085d69e475878005c09782fb3f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
index c5b69ab..647ac88 100644
--- a/omx/gstomxvideodec.c
+++ b/omx/gstomxvideodec.c
@@ -581,7 +581,7 @@ gst_omx_buffer_pool_free_buffer (GstBufferPool * bpool, GstBuffer * buffer)
 #ifdef HAVE_MMNGRBUF
 static GstBuffer *
 gst_omx_buffer_pool_request_videosink_buffer_creation (GstOMXBufferPool * pool,
-    gint dmabuf_fd[GST_VIDEO_MAX_PLANES], gint stride[GST_VIDEO_MAX_PLANES])
+    gint dmabuf_fd[GST_VIDEO_MAX_PLANES], gpointer plane_buf[GST_VIDEO_MAX_PLANES], gint stride[GST_VIDEO_MAX_PLANES])
 {
   GstQuery *query;
   GValue val = { 0, };
@@ -590,6 +590,7 @@ gst_omx_buffer_pool_request_videosink_buffer_creation (GstOMXBufferPool * pool,
   GstBuffer *buffer;
   GArray *dmabuf_array;
   GArray *stride_array;
+  GArray *planebuf_array;
   gint n_planes;
   gint i;
 
@@ -598,11 +599,13 @@ gst_omx_buffer_pool_request_videosink_buffer_creation (GstOMXBufferPool * pool,
 
   dmabuf_array = g_array_new (FALSE, FALSE, sizeof (gint));
   stride_array = g_array_new (FALSE, FALSE, sizeof (gint));
+  planebuf_array = g_array_new (FALSE, FALSE, sizeof (gpointer));
 
   n_planes = GST_VIDEO_INFO_N_PLANES (&pool->video_info);
   for (i = 0; i < n_planes; i++) {
     g_array_append_val (dmabuf_array, dmabuf_fd[i]);
     g_array_append_val (stride_array, stride[i]);
+    g_array_append_val (planebuf_array, plane_buf[i]);
   }
 
   structure = gst_structure_new ("videosink_buffer_creation_request",
@@ -610,6 +613,7 @@ gst_omx_buffer_pool_request_videosink_buffer_creation (GstOMXBufferPool * pool,
       "height", G_TYPE_INT, pool->port->port_def.format.video.nFrameHeight,
       "stride", G_TYPE_ARRAY, stride_array,
       "dmabuf", G_TYPE_ARRAY, dmabuf_array,
+      "planebuf", G_TYPE_ARRAY, planebuf_array,
       "allocator", G_TYPE_POINTER, &val,
       "format", G_TYPE_STRING,
       gst_video_format_to_string (pool->video_info.finfo->format),
@@ -704,6 +708,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool,
         gint i;
         gint dmabuf_fd[GST_VIDEO_MAX_PLANES];
         gint plane_size[GST_VIDEO_MAX_PLANES];
+        gpointer plane_buf[GST_VIDEO_MAX_PLANES];
         guint phys_addr;
         OMXR_MC_VIDEO_DECODERESULTTYPE *decode_res =
                (OMXR_MC_VIDEO_DECODERESULTTYPE *) omx_buf->
@@ -730,6 +735,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool,
 
         plane_size[0] = vmeta->stride[0] *
             GST_VIDEO_INFO_COMP_HEIGHT (&pool->video_info, 0);
+        plane_buf[0] = omx_buf->omx_buf->pBuffer;
 
         /* Export dmabuf file descriptors from second and subsequent planes */
         n_planes = GST_VIDEO_INFO_N_PLANES (&pool->video_info);
@@ -737,6 +743,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool,
           phys_addr = (guint) decode_res->pvPhysImageAddressY + vmeta->offset[i];
           plane_size[i] = vmeta->stride[i] *
               GST_VIDEO_INFO_COMP_HEIGHT (&pool->video_info, i);
+          plane_buf[i] = omx_buf->omx_buf->pBuffer + vmeta->offset[i];
 
           if (!gst_omx_buffer_pool_export_dmabuf (pool, phys_addr, plane_size[i],
                   page_size, &vdbuf_data->id_export[i], &dmabuf_fd[i])) {
@@ -747,7 +754,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool,
 
         if (pool->vsink_buf_req_supported)
           new_buf = gst_omx_buffer_pool_request_videosink_buffer_creation (pool,
-              dmabuf_fd, vmeta->stride);
+              dmabuf_fd, plane_buf, vmeta->stride);
         else {
           GstVideoMeta *new_meta;
 
@@ -1947,6 +1954,8 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
       goto caps_failed;
     }
 
+    /* ...force clearing of reconfiguration flag to prevent subsequent buffers allocation */
+    gst_pad_check_reconfigure(GST_VIDEO_DECODER_SRC_PAD(self));
     gst_video_codec_state_unref (state);
 
     GST_VIDEO_DECODER_STREAM_UNLOCK (self);