From: Uwe Hermann Date: Fri, 11 Jan 2019 00:30:07 +0000 (+0100) Subject: Factor out legacy_output.hpp. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=bf71e84f7ab1ab9c12c2b851b74e0841aeac1442;p=libsigrokflow.git Factor out legacy_output.hpp. --- diff --git a/Makefile.am b/Makefile.am index a131850..85a0f95 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,7 +44,8 @@ library_include_HEADERS = \ include/libsigrokflow/main.hpp \ include/libsigrokflow/init.hpp \ include/libsigrokflow/legacy_capture_device.hpp \ - include/libsigrokflow/legacy_input.hpp + include/libsigrokflow/legacy_input.hpp \ + include/libsigrokflow/legacy_output.hpp pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libsigrokflow.pc diff --git a/include/libsigrokflow/legacy_output.hpp b/include/libsigrokflow/legacy_output.hpp new file mode 100644 index 0000000..7e78bda --- /dev/null +++ b/include/libsigrokflow/legacy_output.hpp @@ -0,0 +1,75 @@ +/* + * This file is part of the libsigrokflow project. + * + * Copyright (C) 2018 Martin Ling + * Copyright (C) 2018 Uwe Hermann + * + * 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 . + */ + +#ifndef LIBSIGROKFLOW_LEGACY_OUTPUT_HPP +#define LIBSIGROKFLOW_LEGACY_OUTPUT_HPP + +/* Temporary workaround, will be dropped later. */ +#define HAVE_LIBSIGROKCXX 1 + +#include +#ifdef HAVE_LIBSIGROKCXX +#include +#endif +#include + +namespace Srf +{ + +using namespace std; + +#ifdef HAVE_LIBSIGROKCXX +class LegacyOutput : + public Sink +{ +public: + /* Create from libsigrok output object. */ + static Glib::RefPtr create( + shared_ptr libsigrok_output_format, + map options = map()); + + /* Override start. */ + bool start_vfunc() override; + + /* Override render. */ + Gst::FlowReturn render_vfunc(const Glib::RefPtr &buffer) override; + + /* Override stop. */ + bool stop_vfunc() override; + + /* Gst class init. */ + static void class_init(Gst::ElementClass *klass); + + /* Register class with plugin. */ + static bool register_element(Glib::RefPtr plugin); + + /* 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_; +}; +#endif + +} +#endif diff --git a/include/libsigrokflow/libsigrokflow.hpp b/include/libsigrokflow/libsigrokflow.hpp index 50c5eea..f7b5274 100644 --- a/include/libsigrokflow/libsigrokflow.hpp +++ b/include/libsigrokflow/libsigrokflow.hpp @@ -39,48 +39,13 @@ #include #include #include +#include namespace Srf { using namespace std; -#ifdef HAVE_LIBSIGROKCXX -class LegacyOutput : - public Sink -{ -public: - /* Create from libsigrok output object. */ - static Glib::RefPtr create( - shared_ptr libsigrok_output_format, - map options = map()); - - /* Override start. */ - bool start_vfunc() override; - - /* Override render. */ - Gst::FlowReturn render_vfunc(const Glib::RefPtr &buffer) override; - - /* Override stop. */ - bool stop_vfunc() override; - - /* Gst class init. */ - static void class_init(Gst::ElementClass *klass); - - /* Register class with plugin. */ - static bool register_element(Glib::RefPtr plugin); - - /* 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_; -}; -#endif - #ifdef HAVE_LIBSIGROKDECODE class LegacyDecoder : public Sink diff --git a/src/legacy_output.cpp b/src/legacy_output.cpp index 21d8c2f..fc83c8c 100644 --- a/src/legacy_output.cpp +++ b/src/legacy_output.cpp @@ -20,7 +20,8 @@ #include #include -#include +#include +#include namespace Srf {