X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=include%2Flibsigrokflow%2Flibsigrokflow.hpp;h=8154951c86966e1ffc3d203a9088ae6370984d43;hb=31b3babdb6de8e5aa887049faf519d1fb4f9924a;hp=c13e1c65203b96215e0a7c5c14ad740eff575311;hpb=15c57e97c5e98a2c795c305bbff1eac49c93d0ee;p=libsigrokflow.git diff --git a/include/libsigrokflow/libsigrokflow.hpp b/include/libsigrokflow/libsigrokflow.hpp index c13e1c6..8154951 100644 --- a/include/libsigrokflow/libsigrokflow.hpp +++ b/include/libsigrokflow/libsigrokflow.hpp @@ -42,175 +42,181 @@ using namespace std; void init(); +void deinit(); + class Block { - /* Config API etc goes here */ + /* Config API etc. goes here. */ }; class Sink : - public Gst::BaseSink + public Gst::BaseSink { protected: - explicit Sink(GstBaseSink *gobj); + explicit Sink(GstBaseSink *gobj); }; class Device : - public Gst::Element + public Gst::Element { - /* Operations specific to hardware devices go here */ + /* Operations specific to hardware devices go here. */ protected: - explicit Device(GstElement *gobj); + explicit Device(GstElement *gobj); }; class CaptureDevice : - public Device + public Device { - /* Operations specific to capture (source) devices go here */ + /* Operations specific to capture (source) devices go here. */ protected: - explicit CaptureDevice(GstElement *gobj); + explicit CaptureDevice(GstElement *gobj); }; #ifdef HAVE_LIBSIGROKCXX class LegacyCaptureDevice : - public CaptureDevice + public CaptureDevice { public: - /* Create from libsigrok device object */ - static Glib::RefPtr create( - shared_ptr libsigrok_device); + /* Create from libsigrok device object. */ + static Glib::RefPtr create( + shared_ptr libsigrok_device); + + /* Retrieve libsigrok device object. */ + shared_ptr libsigrok_device(); - /* Retrieve libsigrok device object */ - shared_ptr libsigrok_device(); + /* Override state change. */ + Gst::StateChangeReturn change_state_vfunc(Gst::StateChange transition); - /* Override state change */ - Gst::StateChangeReturn change_state_vfunc(Gst::StateChange transition); + /* Gst class init. */ + static void class_init(Gst::ElementClass *klass); - /* Gst class init */ - static void class_init(Gst::ElementClass *klass); + /* Register class with plugin. */ + static bool register_element(Glib::RefPtr plugin); - /* Register class with plugin */ - static bool register_element(Glib::RefPtr plugin); + /* Constructor used by element factory. */ + explicit LegacyCaptureDevice(GstElement *gobj); - /* Construcor used by element factory */ - explicit LegacyCaptureDevice(GstElement *gobj); private: - shared_ptr _libsigrok_device; - Glib::RefPtr _src_pad; - Glib::Threads::RecMutex _mutex; - Glib::RefPtr _task; - shared_ptr _session; - - void _datafeed_callback(shared_ptr device, - shared_ptr packet); - void _run(); + shared_ptr _libsigrok_device; + Glib::RefPtr _src_pad; + Glib::Threads::RecMutex _mutex; + Glib::RefPtr _task; + shared_ptr _session; + + void _datafeed_callback(shared_ptr device, + shared_ptr packet); + void _run(); }; class LegacyInput : - public Gst::Element + public Gst::Element { public: - /* Create from libsigrok input */ - static Glib::RefPtr create( - shared_ptr format, - map options = map()); + /* Create from libsigrok input. */ + static Glib::RefPtr create( + shared_ptr format, + map options = map()); + + /* Override start. */ + bool start_vfunc(); - /* Override start */ - bool start_vfunc(); + /* Chain function. */ + Gst::FlowReturn chain(const Glib::RefPtr &pad, + const Glib::RefPtr &buf); - /* Chain function */ - Gst::FlowReturn chain(const Glib::RefPtr &pad, - const Glib::RefPtr &buf); + /* Override stop. */ + bool stop_vfunc(); - /* Override stop */ - bool stop_vfunc(); + /* Gst class init. */ + static void class_init(Gst::ElementClass *klass); - /* Gst class init */ - static void class_init(Gst::ElementClass *klass); + /* Register class with plugin. */ + static bool register_element(Glib::RefPtr plugin); - /* Register class with plugin */ - static bool register_element(Glib::RefPtr plugin); + /* Constructor used by element factory. */ + explicit LegacyInput(GstElement *gobj); - /* Construcor used by element factory */ - explicit LegacyInput(GstElement *gobj); private: - shared_ptr _libsigrok_input_format; - shared_ptr _libsigrok_input; - shared_ptr _session; - map _options; - Glib::RefPtr _sink_pad; - Glib::RefPtr _src_pad; - - void _datafeed_callback(shared_ptr device, - shared_ptr packet); + shared_ptr _libsigrok_input_format; + shared_ptr _libsigrok_input; + shared_ptr _session; + map _options; + Glib::RefPtr _sink_pad; + Glib::RefPtr _src_pad; + + void _datafeed_callback(shared_ptr device, + shared_ptr packet); }; class LegacyOutput : - public Sink + public Sink { public: - /* Create from libsigrok output object */ - static Glib::RefPtr create( - shared_ptr libsigrok_output_format, - shared_ptr libsigrok_device, - map options = map()); + /* Create from libsigrok output object. */ + static Glib::RefPtr create( + shared_ptr libsigrok_output_format, + shared_ptr libsigrok_device, + map options = map()); - /* Override start */ - bool start_vfunc(); + /* Override start. */ + bool start_vfunc().; - /* Override render */ - Gst::FlowReturn render_vfunc(const Glib::RefPtr &buffer); + /* Override render. */ + Gst::FlowReturn render_vfunc(const Glib::RefPtr &buffer); - /* Override stop */ - bool stop_vfunc(); + /* Override stop. */ + bool stop_vfunc(); - /* Gst class init */ - static void class_init(Gst::ElementClass *klass); + /* Gst class init. */ + static void class_init(Gst::ElementClass *klass); - /* Register class with plugin */ - static bool register_element(Glib::RefPtr plugin); + /* Register class with plugin. */ + static bool register_element(Glib::RefPtr plugin); + + /* Constructor used by element factory. */ + explicit LegacyOutput(GstBaseSink *gobj); - /* Constructor used by element factory */ - explicit LegacyOutput(GstBaseSink *gobj); private: - shared_ptr _libsigrok_output_format; - shared_ptr _libsigrok_device; - shared_ptr _libsigrok_output; - map _options; + shared_ptr _libsigrok_output_format; + shared_ptr _libsigrok_device; + shared_ptr _libsigrok_output; + map _options; }; #endif #ifdef HAVE_LIBSIGROKDECODE class LegacyDecoder : - public Sink + public Sink { public: - static Glib::RefPtr create( - struct srd_session *libsigrokdecode_session, uint64_t unitsize); + static Glib::RefPtr create( + struct srd_session *libsigrokdecode_session, uint64_t unitsize); + + /* Retrieve libsigrokdecode session. */ + struct srd_session *libsigrokdecode_session(); - /* Retrieve libsigrokdecode session */ - struct srd_session *libsigrokdecode_session(); + /* Override start. */ + bool start_vfunc(); - /* Override start */ - bool start_vfunc(); + /* Override render. */ + Gst::FlowReturn render_vfunc(const Glib::RefPtr &buffer); - /* Override render */ - Gst::FlowReturn render_vfunc(const Glib::RefPtr &buffer); + /* Override stop. */ + bool stop_vfunc(); - /* Override stop */ - bool stop_vfunc(); + /* Gst class init. */ + static void class_init(Gst::ElementClass *klass); - /* Gst class init */ - static void class_init(Gst::ElementClass *klass); + /* Register class with plugin. */ + static bool register_element(Glib::RefPtr plugin); - /* Register class with plugin */ - static bool register_element(Glib::RefPtr plugin); + /* Constructor used by element factory. */ + explicit LegacyDecoder(GstBaseSink *gobj); - /* Constructor used by element factory */ - explicit LegacyDecoder(GstBaseSink *gobj); private: - struct srd_session *_session; - uint64_t _abs_ss; - uint64_t _unitsize; + struct srd_session *_session; + uint64_t _abs_ss; + uint64_t _unitsize; }; #endif