title: How to create GstBuffer Pool in custom plugin
body: <p>I having a GST pipeline as shown below.</p>
  <pre><code>SRC -&gt;A -&gt;ROI -&gt;B-&gt; SINK
  </code></pre>
  <p>The <strong>custom elements (A, ROI and B)</strong> I has created by using the Gstreamer bad plugin tool <strong>element-maker</strong> as shown below.</p>
  <p><strong>./element-maker  videofilter</strong></p>
  <p>I have removed the <strong>transform_frame()</strong> function from the above custom plugin source code and using transform_frame_ip() in order to use these plugin as a pass-through.</p>
  <p>The above pipeline is working fine as a pass-through.</p>
  <p><strong>Requirement</strong></p>
  <p>Here, the 'ROI' element will produce multiple frames that will be passed to the element 'B' for further processing.</p>
  <p>To implement this algorithm I have seen <strong>GstBuffer Pool concept</strong> in Gstreamer from the link mentioned below.</p>
  <p><a href="https://gstreamer.freedesktop.org/documentation/gstreamer/gstbufferpool.html?gi-language=c" rel="nofollow noreferrer">https://gstreamer.freedesktop.org/documentation/gstreamer/gstbufferpool.html?gi-language=c</a></p>
  <p>My ROI function is acting like an <strong>Upstream element</strong> and below is the <strong>pool configuration</strong> inside the init_ROI element.</p>
  <pre><code> static void gst_ROI_init (GstROI *ROI){
      
    /* GstBuffer Pool Config.*/
    pool = gst_buffer_pool_new();
    config = gst_buffer_pool_get_config(pool);
    size = 420*420*3; // For RGB fromat.
    min_ = 1;
    max_ = 10;
    caps = gst_caps_from_string(&quot;video/x-raw&quot;);
  
    gst_buffer_pool_config_set_params (config, caps, 
    size, min_, max_);
    gst_caps_unref(caps);
    if ( gst_buffer_pool_set_config (pool, config)){
       std::cout &lt;&lt; &quot;[INFO] Pool configuration done 
      successfully\n&quot;;
    if( gst_buffer_pool_set_active( pool, TRUE )){   
        std::cout &lt;&lt; &quot;Successfully activated the pool 
       buffer\n&quot;; 
     }
     else{    
      std::cout &lt;&lt; &quot;[ERROR] Failed to activate the 
  buffer pool\n&quot;;
  }
  
  } //end if
  else {
  std::cout &lt;&lt; &quot;[ERROR] Failed to set the pool 
  config.\n&quot;; 
    } 
  }
  </code></pre>
  <p>My **'B' element ** is working as a downstream element and below is the code to acquire the frames from pool.</p>
  <pre><code>  gst_B_transform_frame_ip (GstVideoFilter * filter, 
    GstVideoFrame * frame)
    { 
    /* GstBufferPool */ 
   /*if (gst_buffer_pool_acquire_buffer(pool, &amp;buf, 
     NULL) == GST_FLOW_EOS){ // pool variable is shared 
   variable ascross the ROI and B element.
  std::cout &lt;&lt; &quot;[ERROR] Failed to acquire the frame\n&quot;;      
   } 
  </code></pre>
  <p>Problem:
  But the above implementation is not working as expected. It seems something I did wrong.</p>
  <p><strong>I have some doubts about the GstBuffer pool.</strong></p>
  <p>1- How to add the frames inside the buffer pool in the upstream element?</p>
  <p>2- Is there any alternative and simple way to do the same. like I can create a <strong>sharable array of GstBuffer</strong> to <strong>store the n-cropped images</strong> and the same array I will <strong>access</strong> inside the <strong>B element</strong> instead of implementing the GstBuffer pool?</p>
  <p>very new to this environment. any feedback will be useful for me.</p>
  <p>thank you in advance.</p>
  <p>Can any give their feedback on the above implementation and I will be great If anyone can <strong>share the reference code to implement the same</strong> GstBufferPool.</p>