From 8a2b9a96d109f450e8f51766a55d7ca6f924a236 Mon Sep 17 00:00:00 2001
From: Changtao Hu <changtao.hu@mediatek.com>
Date: Mon, 7 Aug 2017 14:38:26 +0800
Subject: [PATCH] gstreamer: rm rpr feature

Support rm rpr feature.
Test: OK

Signed-off-by: Changtao Hu <changtao.hu@mediatek.com>
---
 sys/v4l2/gstv4l2videodec.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)
 mode change 100755 => 100644 sys/v4l2/gstv4l2videodec.c

diff --git a/sys/v4l2/gstv4l2videodec.c b/sys/v4l2/gstv4l2videodec.c
old mode 100755
new mode 100644
index 9992cc4..f251ff4
--- a/sys/v4l2/gstv4l2videodec.c
+++ b/sys/v4l2/gstv4l2videodec.c
@@ -527,6 +527,21 @@ gst_v4l2_update_caps (GstVideoDecoder * decoder, guint width, guint height, guin
   }
   return;
 }
+
+static gboolean
+gst_v4l2_video_codec_is_rm (GstVideoDecoder * decoder)
+{
+  gboolean rtn = FALSE;
+  GstV4l2VideoDec *self = GST_V4L2_VIDEO_DEC (decoder);
+
+  if (self->v4l2output->format.fmt.pix.pixelformat == V4L2_PIX_FMT_RV30
+    ||self->v4l2output->format.fmt.pix.pixelformat == V4L2_PIX_FMT_RV40) {
+    rtn = TRUE;
+  }
+
+  return rtn;
+}
+
 static void
 gst_v4l2_video_dec_loop (GstVideoDecoder * decoder)
 {
@@ -567,9 +582,11 @@ gst_v4l2_video_dec_loop (GstVideoDecoder * decoder)
       guint crop_width = 0;
       guint crop_height = 0;
 
-      if (self->v4l2capture->pool) {
-        GST_INFO_OBJECT (decoder, "deactivating pool");
-        gst_buffer_pool_set_active (self->v4l2capture->pool, FALSE);
+      if (!gst_v4l2_video_codec_is_rm (decoder)) {
+        if (self->v4l2capture->pool) {
+          GST_INFO_OBJECT (decoder, "deactivating pool");
+          gst_buffer_pool_set_active (self->v4l2capture->pool, FALSE);
+        }
       }
 
       if (!gst_v4l2_object_acquire_format (self->v4l2capture, &info)) {
@@ -590,9 +607,11 @@ gst_v4l2_video_dec_loop (GstVideoDecoder * decoder)
         goto beach;
       }
 
-      if (self->v4l2capture->pool) {
-        GST_INFO_OBJECT (decoder, "activating pool");
-        gst_buffer_pool_set_active (GST_BUFFER_POOL (self->v4l2capture->pool), TRUE);
+      if (!gst_v4l2_video_codec_is_rm (decoder)) {
+        if (self->v4l2capture->pool) {
+          GST_INFO_OBJECT (decoder, "activating pool");
+          gst_buffer_pool_set_active (GST_BUFFER_POOL (self->v4l2capture->pool), TRUE);
+        }
       }
     }
     pool = gst_video_decoder_get_buffer_pool (decoder);
-- 
1.9.1