/* GStreamer * Copyright (C) <2021> Charles Lu * * 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 #include #include 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 CameraPropertyMap_t; typedef map CamerasInfoMap_t; typedef map 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); };