[v4l2videodecoder] Post message for number of buffers
[platform/upstream/gst-plugins-good.git] / sys / v4l2 / gstv4l2videodec.c
index b43a6c9..f1c32e8 100644 (file)
@@ -612,6 +612,8 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
 #ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
   GstStructure *structure = NULL;
   const gchar *caps_format = NULL;
+  GstMessage *msg = NULL;
+  GstV4l2BufferPool *capture_pool = NULL;
 #endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
 
   GST_DEBUG_OBJECT (self, "Handling frame %d", frame->system_frame_number);
@@ -751,6 +753,18 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
     if (!gst_buffer_pool_set_active (GST_BUFFER_POOL (self->v4l2capture->pool),
             TRUE))
       goto activate_failed;
+#ifdef TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER
+    capture_pool = GST_V4L2_BUFFER_POOL (self->v4l2capture->pool);
+
+    msg = gst_message_new_element (GST_OBJECT_CAST (decoder),
+        gst_structure_new ("prepare-decode-buffers",
+            "num_buffers", G_TYPE_INT, capture_pool->num_allocated,
+            "extra_num_buffers", G_TYPE_INT, capture_pool->num_allocated - 2, NULL));
+
+    gst_element_post_message (GST_ELEMENT_CAST (decoder), msg);
+
+    GST_WARNING_OBJECT (self, "output buffer[%d]", capture_pool->num_allocated);
+#endif /* TIZEN_FEATURE_TBM_SUPPORT_FOR_V4L2_DECODER */
   }
 
   task_state = gst_pad_get_task_state (GST_VIDEO_DECODER_SRC_PAD (self));