Browse Source

Linux_SDK_V1.1.2

thead_admin 1 year ago
parent
commit
9172f23770

+ 0 - 36
README.en.md

@@ -1,36 +0,0 @@
-# gst1-plugins-thead-proprietary
-
-#### Description
-THead GStreamer闭源发布
-
-#### Software Architecture
-Software architecture description
-
-#### Installation
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-#### Instructions
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-#### Contribution
-
-1.  Fork the repository
-2.  Create Feat_xxx branch
-3.  Commit your code
-4.  Create Pull Request
-
-
-#### Gitee Feature
-
-1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
-2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
-3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
-4.  The most valuable open source project [GVP](https://gitee.com/gvp)
-5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
-6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

+ 0 - 37
README.md

@@ -1,37 +0,0 @@
-# gst1-plugins-thead-proprietary
-
-#### 介绍
-THead GStreamer闭源发布
-
-#### 软件架构
-软件架构说明
-
-
-#### 安装教程
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-#### 使用说明
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-#### 参与贡献
-
-1.  Fork 本仓库
-2.  新建 Feat_xxx 分支
-3.  提交代码
-4.  新建 Pull Request
-
-
-#### 特技
-
-1.  使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
-2.  Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
-3.  你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
-4.  [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
-5.  Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
-6.  Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

+ 1 - 0
csi-camera-hal/README.me

@@ -0,0 +1 @@
+Compile from thead-linux/csi_hal TAG: 2193870e57ee4e8b5d407a80ca427a00ccfe764e

BIN
csi-camera-hal/libcommon.so


BIN
csi-camera-hal/libhal_camera.so


+ 76 - 0
include/gst-plugin/thead_camera/gsttheadcamera.h

@@ -0,0 +1,76 @@
+/* GStreamer
+ * Copyright (C) <2021> Charles Lu <chongzhi.lcz@alibaba-inc.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#pragma once
+
+#include <gst/gst.h>
+#include <gst/base/gstpushsrc.h>
+
+#include <gst/video/gstvideometa.h>
+#include <gst/video/gstvideopool.h>
+
+#include "thead_camera.h"
+
+G_BEGIN_DECLS
+#define GST_TYPE_THEAD_CAMERA \
+  (gst_thead_camera_get_type())
+#define GST_THEAD_CAMERA(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_THEAD_CAMERA,GstTHeadCamera))
+#define GST_THEAD_CAMERA_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_THEAD_CAMERA,GstTHeadCameraClass))
+#define GST_IS_THEAD_CAMERA(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_THEAD_CAMERA))
+#define GST_IS_THEAD_CAMERA_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_THEAD_CAMERA))
+typedef struct _GstTHeadCamera GstTHeadCamera;
+typedef struct _GstTHeadCameraClass GstTHeadCameraClass;
+
+/**
+ * GstTHeadCamera:
+ *
+ * Opaque data structure.
+ */
+struct _GstTHeadCamera
+{
+  GstPushSrc element;
+
+  /* video state */
+  GstVideoInfo info;            /* protected by the object or stream lock */
+  gboolean bayer;
+
+  THeadCamera *theadCamera;
+
+  /* running time and frames for current caps */
+  GstClockTime running_time;      // total running time
+  gint64 timestamp_offset;        // PROP_TIMESTAMP_OFFSET
+  gint64 n_frames;                // total frames sent
+  gboolean reverse;
+
+  /* previous caps running time and frames */
+  GstClockTime accum_rtime;       // accumulated running_time
+  gint64 accum_frames;            // accumulated frames
+};
+
+struct _GstTHeadCameraClass
+{
+  GstPushSrcClass parent_class;
+};
+
+GType gst_thead_camera_get_type (void);
+
+G_END_DECLS

+ 46 - 0
include/gst-plugin/thead_camera/gsttheadcamera_priv.h

@@ -0,0 +1,46 @@
+/* GStreamer
+ * Copyright (C) <2021> Charles Lu <chongzhi.lcz@alibaba-inc.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#pragma once
+
+G_BEGIN_DECLS
+
+#define gst_thead_camera_parent_class parent_class
+G_DEFINE_TYPE (GstTHeadCamera, gst_thead_camera, GST_TYPE_PUSH_SRC);
+
+static void gst_thead_camera_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * pspec);
+static void gst_thead_camera_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * pspec);
+static void gst_thead_camera_finalize (GObject * object);
+
+static gboolean gst_thead_camera_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
+static GstCaps *gst_thead_camera_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
+
+static gboolean gst_thead_camera_query (GstBaseSrc * bsrc, GstQuery * query);
+
+static void gst_thead_camera_get_times (GstBaseSrc * bsrc,
+    GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
+static gboolean gst_thead_camera_decide_allocation (GstBaseSrc * bsrc,
+    GstQuery * query);
+static GstFlowReturn gst_thead_camera_fill (GstPushSrc * psrc,
+    GstBuffer * buffer);
+static gboolean gst_thead_camera_start (GstBaseSrc * bsrc);
+static gboolean gst_thead_camera_stop (GstBaseSrc * bsrc);
+
+G_END_DECLS

+ 53 - 0
include/gst-plugin/thead_camera/gsttheadcamera_property.h

@@ -0,0 +1,53 @@
+/* GStreamer
+ * Copyright (C) <2021> Charles Lu <chongzhi.lcz@alibaba-inc.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#pragma once
+
+typedef enum gst_thead_camera_prop
+{
+  PROP_0,
+
+  /* GStreamer extended properties */
+  PROP_IS_LIVE,
+  PROP_TIMESTAMP_OFFSET,
+
+  /* CSI Camera non-runtime properties */
+  PROP_CAMERAS_INFO,
+  PROP_MODES,
+  PROP_SENSOR_CALIB_FILE,
+  PROP_ISP_3ALIB_FILE,
+  PROP_IO_MODE,
+
+  /* CSI Camera multi-channal properties */
+  PROP_CHANNEL_ID,
+  PROP_CHANNEL_IMAGE_WIDTH,
+  PROP_CHANNEL_IMAGE_HEIGHT,
+  PROP_CHANNEL_IMAGE_PIXEL_FORMAT,
+
+  /* CSI Camera runtime properties */
+  PROP_HFLIP = CSI_CAMERA_PID_HFLIP,
+  PROP_VFLIP = CSI_CAMERA_PID_VFLIP,
+  PROP_ROTATE = CSI_CAMERA_PID_ROTATE,
+  PROP_EXPOSURE_MODE = CSI_CAMERA_PID_EXPOSURE_MODE,
+  PROP_EXPOSURE_ABSOLUTE = CSI_CAMERA_PID_EXPOSURE_ABSOLUTE,
+  PROP_EXPOSURE_AUTO_PRIORITY = CSI_CAMERA_PID_EXPOSURE_AUTO_PRIORITY,
+  PROP_EXPOSURE_BIAS = CSI_CAMERA_PID_EXPOSURE_BIAS,
+  PROP_FOCUS_ABSOLUTE = CSI_CAMERA_PID_FOCUS_ABSOLUTE,
+  PROP_3A_LOCK = CSI_CAMERA_PID_3A_LOCK,
+} gst_thead_camera_prop_e;
+

+ 88 - 0
include/gst-plugin/thead_camera/thead_camera.h

@@ -0,0 +1,88 @@
+/* GStreamer
+ * Copyright (C) <2021> Charles Lu <chongzhi.lcz@alibaba-inc.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#pragma once
+#include <map>
+
+#include <gst/gst.h>
+#include <camera_manager.h>
+
+using namespace std;
+
+#define DEFAULT_TIMESTAMP_OFFSET 0
+
+typedef struct gst_property_info
+{
+  int id;
+  const char *name;
+  const char *nick;
+  const char *blurb;
+} gst_property_names_t;
+
+typedef struct camera_mode_info {
+	int mode_id;
+	char description[128];
+} camera_mode_info_t;
+
+/* Use map manage csi_camera properties */
+typedef map<int, csi_camera_property_description_s> CameraPropertyMap_t;
+typedef map<int, csi_camera_info_s> CamerasInfoMap_t;
+typedef map<int, camera_mode_info_t> CameraModeMap_t;
+
+class THeadCamera
+{
+public:
+  THeadCamera ();
+  ~THeadCamera ();
+
+  CameraPropertyMap_t m_CurrPropMap;
+  CameraPropertyMap_t m_TempPropMap;
+
+  static int InstallProperties(GObjectClass * gobject_class);
+  static int CameraEventAction(cams_t *session, csi_camera_event_s *event);
+  static int ChannelEventAction(cams_t *session, csi_camera_event_s *event);
+  static int GetGstPropertyInfo(int id, const gst_property_names_t ** info);
+
+  bool IsOpened ();
+  int Init();
+  int GetProperty(int propId);
+  int FetchProperty();
+  int ApplyProperty(bool fullApply = false);
+  int OpenChannel();
+  int SubscribeEvent();
+  int RegisterEventAction();
+  int Start();
+  int Stop();
+  csi_cam_handle_t get_CamHandle(){
+    return m_CamSession->camera_handle;
+  }
+  cams_t *get_CamSession(){
+    return m_CamSession;
+  }
+
+private:
+  cams_t *m_CamSession;
+  static const gst_property_names_t camera_property_names[];
+  static CamerasInfoMap_t m_CamerasInfoMap;
+  static CameraModeMap_t m_CameraModeMap;
+
+  static GType BuildExposureModeEnumTypes(void);
+  static GType BuildCamerasInfoEnumTypes(void);
+  static GType BuildModeEnumTypes(void);
+  void DumpProperties(CameraPropertyMap_t &propMap);
+};

+ 36 - 0
include/gst-plugin/thead_camera/thead_camera_utils.h

@@ -0,0 +1,36 @@
+/* GStreamer
+ * Copyright (C) <2021> Charles Lu <chongzhi.lcz@alibaba-inc.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#pragma once
+
+#include <gst/video/video-info.h>
+
+#include <csi_camera.h>
+#include <camera_string.h>
+
+class THeadCameraUtil
+{
+public:
+  static void dump_backtrace ();
+  static void dump_gst_video_info (GstVideoInfo * info);
+  static void dump_gstvideo_frame (GstVideoFrame * frame);
+  static void dump_gst_buffer (GstBuffer * buffer);
+  static void dump_channel_event(csi_camera_event_s *event);
+
+  static void fill_1280x720_yv12 (GstVideoFrame * frame);
+};

BIN
lib/gstreamer-1.0/libthead_camera.so


+ 2 - 0
releasenotes.txt

@@ -0,0 +1,2 @@
+Version: Linux_SDK_V1.1.2
+Compile from thead-linux-private/gst1-plugins-thead TAG: 5b4f3343a15995fd1fef2391fc2d1961b960b645

+ 10 - 0
share/gst-app/thead_camera/run_thead_camera_app1.sh

@@ -0,0 +1,10 @@
+clear
+cd `dirname $0`
+BUILDDIR=`pwd`/../../builddir
+
+ulimit -c unlimited
+export GST_PLUGIN_PATH=$BUILDDIR/gst-plugin/thead_camera/
+
+#GST_DEBUG=2,thead_camera:7 GST_DEBUG_NO_COLOR=0 $BUILDDIR/gst-app/thead_camera_app1 > debug_app1.log 2>&1
+GST_DEBUG=2,thead_camera:7 $BUILDDIR/gst-app/thead_camera/thead_camera_app1
+#GST_DEBUG=2,thead_camera:7 G_DEBUG=fatal-warnings gdb $BUILDDIR/gst-app/thead_camera/thead_camera_app1

BIN
share/gst-app/thead_camera/thead_camera_app1