]> sigrok.org Git - libsigrokflow.git/commitdiff
Factor out legacy_input.hpp.
authorUwe Hermann <redacted>
Fri, 11 Jan 2019 00:26:21 +0000 (01:26 +0100)
committerUwe Hermann <redacted>
Fri, 11 Jan 2019 01:44:15 +0000 (02:44 +0100)
Makefile.am
include/libsigrokflow/legacy_input.hpp [new file with mode: 0644]
include/libsigrokflow/libsigrokflow.hpp
src/legacy_input.cpp

index 7d2409ef9b6c8fc5803d2b0fa22f833a8c7f7503..a1318508d0cfc0c3cacdc238983e0a2560d4a47b 100644 (file)
@@ -43,7 +43,8 @@ library_include_HEADERS = \
        include/libsigrokflow/libsigrokflow.hpp \
        include/libsigrokflow/main.hpp \
        include/libsigrokflow/init.hpp \
-       include/libsigrokflow/legacy_capture_device.hpp
+       include/libsigrokflow/legacy_capture_device.hpp \
+       include/libsigrokflow/legacy_input.hpp
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libsigrokflow.pc
diff --git a/include/libsigrokflow/legacy_input.hpp b/include/libsigrokflow/legacy_input.hpp
new file mode 100644 (file)
index 0000000..2516adc
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * This file is part of the libsigrokflow project.
+ *
+ * Copyright (C) 2018 Martin Ling <martin-sigrok@earth.li>
+ * Copyright (C) 2018 Uwe Hermann <uwe@hermann-uwe.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LIBSIGROKFLOW_LEGACY_INPUT_HPP
+#define LIBSIGROKFLOW_LEGACY_INPUT_HPP
+
+/* Temporary workaround, will be dropped later. */
+#define HAVE_LIBSIGROKCXX 1
+
+#include <gstreamermm.h>
+#ifdef HAVE_LIBSIGROKCXX
+#include <libsigrokcxx/libsigrokcxx.hpp>
+#endif
+#include <libsigrokflow/main.hpp>
+
+namespace Srf
+{
+
+using namespace std;
+
+#ifdef HAVE_LIBSIGROKCXX
+class LegacyInput :
+       public Gst::Element
+{
+public:
+       /* Create from libsigrok input. */
+       static Glib::RefPtr<LegacyInput> create(
+               shared_ptr<sigrok::InputFormat> format,
+               map<string, Glib::VariantBase> options = map<string, Glib::VariantBase>());
+
+       /* Chain function (not an override). */
+       Gst::FlowReturn chain(const Glib::RefPtr<Gst::Pad> &pad,
+                       const Glib::RefPtr<Gst::Buffer> &buf);
+
+       /* Event function (not an override). */
+       bool event(const Glib::RefPtr<Gst::Pad> &pad,
+                       Glib::RefPtr<Gst::Event> &event);
+
+       /* Gst class init. */
+       static void class_init(Gst::ElementClass<LegacyInput> *klass);
+
+       /* Register class with plugin. */
+       static bool register_element(Glib::RefPtr<Gst::Plugin> plugin);
+
+       /* Constructor used by element factory. */
+       explicit LegacyInput(GstElement *gobj);
+
+private:
+       shared_ptr<sigrok::InputFormat> libsigrok_input_format_;
+       shared_ptr<sigrok::Input> libsigrok_input_;
+       shared_ptr<sigrok::Session> session_;
+       map<string, Glib::VariantBase> options_;
+       Glib::RefPtr<Gst::Pad> sink_pad_;
+       Glib::RefPtr<Gst::Pad> src_pad_;
+
+       void datafeed_callback(shared_ptr<sigrok::Device> device,
+                       shared_ptr<sigrok::Packet> packet);
+};
+#endif
+
+}
+#endif
index 1a561a2cffbe478e79f04dbc251f7070e6e5be6a..50c5eea1ef578cc14726dd566f720cd433ac7269 100644 (file)
@@ -38,6 +38,7 @@
 #include <libsigrokflow/main.hpp>
 #include <libsigrokflow/init.hpp>
 #include <libsigrokflow/legacy_capture_device.hpp>
+#include <libsigrokflow/legacy_input.hpp>
 
 namespace Srf
 {
@@ -45,44 +46,6 @@ namespace Srf
 using namespace std;
 
 #ifdef HAVE_LIBSIGROKCXX
-class LegacyInput :
-       public Gst::Element
-{
-public:
-       /* Create from libsigrok input. */
-       static Glib::RefPtr<LegacyInput> create(
-               shared_ptr<sigrok::InputFormat> format,
-               map<string, Glib::VariantBase> options = map<string, Glib::VariantBase>());
-
-       /* Chain function (not an override). */
-       Gst::FlowReturn chain(const Glib::RefPtr<Gst::Pad> &pad,
-                       const Glib::RefPtr<Gst::Buffer> &buf);
-
-       /* Event function (not an override). */
-       bool event(const Glib::RefPtr<Gst::Pad> &pad,
-                       Glib::RefPtr<Gst::Event> &event);
-
-       /* Gst class init. */
-       static void class_init(Gst::ElementClass<LegacyInput> *klass);
-
-       /* Register class with plugin. */
-       static bool register_element(Glib::RefPtr<Gst::Plugin> plugin);
-
-       /* Constructor used by element factory. */
-       explicit LegacyInput(GstElement *gobj);
-
-private:
-       shared_ptr<sigrok::InputFormat> libsigrok_input_format_;
-       shared_ptr<sigrok::Input> libsigrok_input_;
-       shared_ptr<sigrok::Session> session_;
-       map<string, Glib::VariantBase> options_;
-       Glib::RefPtr<Gst::Pad> sink_pad_;
-       Glib::RefPtr<Gst::Pad> src_pad_;
-
-       void datafeed_callback(shared_ptr<sigrok::Device> device,
-                       shared_ptr<sigrok::Packet> packet);
-};
-
 class LegacyOutput :
        public Sink
 {
index 8a7c47ca99b7218d82e88790dcc5cba86e743ebc..084bf2722541bb0425057f6d61c81460c3c7f31d 100644 (file)
@@ -19,7 +19,8 @@
  */
 
 #include <config.h>
-#include <libsigrokflow/libsigrokflow.hpp>
+#include <libsigrokflow/legacy_input.hpp>
+#include <gstreamermm/private/element_p.h>
 
 namespace Srf
 {