2 * This file is part of the libsigrokflow project.
4 * Copyright (C) 2018 Martin Ling <martin-sigrok@earth.li>
5 * Copyright (C) 2018 Uwe Hermann <uwe@hermann-uwe.de>
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include <gstreamermm.h>
23 #include <libsigrokflow/init.hpp>
24 #include <libsigrokflow/legacy_capture_device.hpp>
25 #include <libsigrokflow/legacy_input.hpp>
26 #include <libsigrokflow/legacy_output.hpp>
27 #include <libsigrokflow/legacy_decoder.hpp>
34 static bool srf_initialized_ = false;
39 throw runtime_error("libsigrokflow is already initialized");
41 if (!Gst::is_initialized())
42 throw runtime_error("Gst::init() has not run yet");
44 #ifdef HAVE_LIBSIGROKCXX
45 Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
46 "sigrok_legacy_capture_device",
47 "Wrapper for capture devices using legacy libsigrok APIs",
48 sigc::ptr_fun(&LegacyCaptureDevice::register_element),
49 "0.01", "GPL", "sigrok", "libsigrokflow", "https://sigrok.org");
50 Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
51 "sigrok_legacy_input",
52 "Wrapper for inputs using legacy libsigrok APIs",
53 sigc::ptr_fun(&LegacyInput::register_element),
54 "0.01", "GPL", "sigrok", "libsigrokflow", "https://sigrok.org");
55 Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
56 "sigrok_legacy_output",
57 "Wrapper for outputs using legacy libsigrok APIs",
58 sigc::ptr_fun(&LegacyOutput::register_element),
59 "0.01", "GPL", "sigrok", "libsigrokflow", "https://sigrok.org");
61 #ifdef HAVE_LIBSIGROKDECODE
62 Gst::Plugin::register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
63 "sigrok_legacy_decoder",
64 "Wrapper for protocol decoders using legacy libsigrokdecode APIs",
65 sigc::ptr_fun(&LegacyDecoder::register_element),
66 "0.01", "GPL", "sigrok", "libsigrokflow", "https://sigrok.org");
69 srf_initialized_ = true;
74 if (!srf_initialized_)
75 throw runtime_error("libsigrokflow is not initialized");
77 srf_initialized_ = false;