enable trustzone config in gstbasesrc 59/96859/1
authorfscherry <js4716.chun@samsung.com>
Thu, 10 Nov 2016 11:23:31 +0000 (20:23 +0900)
committerfscherry <js4716.chun@samsung.com>
Thu, 10 Nov 2016 11:24:18 +0000 (20:24 +0900)
Change-Id: I82885012ac14ed19a2e4bfb8cdc9ed11eda7d305
Signed-off-by: fscherry <js4716.chun@samsung.com>
libs/gst/base/gstbasesrc.c
libs/gst/base/gstbasesrc.h
packaging/gstreamer.spec

index 31ac75e..70f48c9 100644 (file)
@@ -2503,7 +2503,17 @@ again:
   if (G_UNLIKELY (g_atomic_int_get (&src->priv->has_pending_eos))) {
     if (ret == GST_FLOW_OK) {
       if (*buf == NULL)
+      {
+#ifdef TIZEN_FEATURE_TRUSTZONE
+        /*tzappsrc patch : release handle when unref res_buf*/
+        if(bclass->tz_src_release_handle)
+        {
+          GST_INFO_OBJECT (src, "tzappsrc release the handle");
+          bclass->tz_src_release_handle(src,res_buf);
+        }
+#endif
         gst_buffer_unref (res_buf);
+      }
     }
     src->priv->forced_eos = TRUE;
     goto eos;
@@ -2562,7 +2572,18 @@ again:
        * it got unlocked because we did a state change. In any case, get rid of
        * the buffer. */
       if (*buf == NULL)
+      {
+#ifdef TIZEN_FEATURE_TRUSTZONE
+        /*tzappsrc patch : release handle when unref res_buf*/
+        GstBaseSrcClass *klass = GST_BASE_SRC_GET_CLASS(src);
+        if(klass->tz_src_release_handle)
+        {
+          GST_INFO_OBJECT (src, "tzappsrc release the handle");
+          klass->tz_src_release_handle(src,res_buf);
+        }
+#endif
         gst_buffer_unref (res_buf);
+      }
 
       if (!src->live_running) {
         /* We return FLUSHING when we are not running to stop the dataflow also
@@ -2584,7 +2605,18 @@ again:
           (_("Internal clock error.")),
           ("clock returned unexpected return value %d", status));
       if (*buf == NULL)
+      {
+#ifdef TIZEN_FEATURE_TRUSTZONE
+        /*tzappsrc patch : release handle when unref res_buf*/
+        GstBaseSrcClass *klass = GST_BASE_SRC_GET_CLASS(src);
+        if(klass->tz_src_release_handle)
+        {
+          GST_INFO_OBJECT (src, "tzappsrc release the handle");
+          klass->tz_src_release_handle(src,res_buf);
+        }
+#endif
         gst_buffer_unref (res_buf);
+      }
       ret = GST_FLOW_ERROR;
       break;
   }
@@ -2612,7 +2644,18 @@ map_failed:
         (_("Failed to map buffer.")),
         ("failed to map result buffer in WRITE mode"));
     if (*buf == NULL)
+    {
+#ifdef TIZEN_FEATURE_TRUSTZONE
+      /*tzappsrc patch : release handle when unref res_buf*/
+      GstBaseSrcClass *klass = GST_BASE_SRC_GET_CLASS(src);
+      if(klass->tz_src_release_handle)
+      {
+        GST_INFO_OBJECT (src, "tzappsrc release the handle");
+        klass->tz_src_release_handle(src,res_buf);
+      }
+#endif
       gst_buffer_unref (res_buf);
+    }
     return GST_FLOW_ERROR;
   }
 not_started:
@@ -2640,7 +2683,18 @@ flushing:
   {
     GST_DEBUG_OBJECT (src, "we are flushing");
     if (*buf == NULL)
+    {
+#ifdef TIZEN_FEATURE_TRUSTZONE
+      /*tzappsrc patch : release handle when unref res_buf*/
+      GstBaseSrcClass *klass = GST_BASE_SRC_GET_CLASS(src);
+      if(klass->tz_src_release_handle)
+      {
+        GST_INFO_OBJECT (src, "tzappsrc release the handle");
+        klass->tz_src_release_handle(src,res_buf);
+      }
+#endif
       gst_buffer_unref (res_buf);
+    }
     return GST_FLOW_FLUSHING;
   }
 eos:
@@ -2887,6 +2941,15 @@ gst_base_src_loop (GstPad * pad)
 
   ret = gst_pad_push (pad, buf);
   if (G_UNLIKELY (ret != GST_FLOW_OK)) {
+#ifdef TIZEN_FEATURE_TRUSTZONE
+    /*tzappsrc patch : release handle when unref res_buf*/
+    GstBaseSrcClass *klass = GST_BASE_SRC_GET_CLASS(src);
+    if(klass->tz_src_release_handle)
+    {
+      GST_INFO_OBJECT (src, "tzappsrc release the handle");
+      klass->tz_src_release_handle(src,buf);
+    }
+#endif
     if (ret == GST_FLOW_NOT_NEGOTIATED) {
       goto not_negotiated;
     }
index 1167cd3..190dc48 100644 (file)
@@ -231,6 +231,12 @@ struct _GstBaseSrcClass {
 
   /*< private >*/
   gpointer       _gst_reserved[GST_PADDING_LARGE];
+#ifdef TIZEN_FEATURE_TRUSTZONE
+  /*tzappsrc patch*/
+  int (*tz_flush) (GstBaseSrc *src, unsigned int handle);
+  int (*tz_src_flush) (GstBaseSrc *src);
+  int (*tz_src_release_handle) (GstBaseSrc *src, GstBuffer *buf);
+#endif
 };
 
 GType gst_base_src_get_type (void);
index 1442e42..9b146a1 100644 (file)
@@ -73,6 +73,7 @@ export CFLAGS="%{optflags} \
        -DTIZEN_FEATURE_QUEUE_MODIFICATION\
 %if "%{?profile}" == "tv"
        -DTIZEN_PROFILE_TV\
+       -DTIZEN_FEATURE_TRUSTZONE\
 %endif
        -fno-strict-aliasing"