From: Uwe Hermann Date: Fri, 11 Jan 2019 00:35:18 +0000 (+0100) Subject: Factor out legacy_decoder.hpp. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d59dd5fff355f665819c823336cab301ac6497c8;p=libsigrokflow.git Factor out legacy_decoder.hpp. --- diff --git a/Makefile.am b/Makefile.am index 85a0f95..8b6b55e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,7 +45,8 @@ library_include_HEADERS = \ include/libsigrokflow/init.hpp \ include/libsigrokflow/legacy_capture_device.hpp \ include/libsigrokflow/legacy_input.hpp \ - include/libsigrokflow/legacy_output.hpp + include/libsigrokflow/legacy_output.hpp \ + include/libsigrokflow/legacy_decoder.hpp pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libsigrokflow.pc diff --git a/include/libsigrokflow/legacy_decoder.hpp b/include/libsigrokflow/legacy_decoder.hpp new file mode 100644 index 0000000..fecff05 --- /dev/null +++ b/include/libsigrokflow/legacy_decoder.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_DECODER_HPP +#define LIBSIGROKFLOW_LEGACY_DECODER_HPP + +/* Temporary workaround, will be dropped later. */ +#define HAVE_LIBSIGROKDECODE 1 + +#include +#ifdef HAVE_LIBSIGROKDECODE +#include +#endif +#include + +namespace Srf +{ + +using namespace std; + +#ifdef HAVE_LIBSIGROKDECODE +class LegacyDecoder : + public Sink +{ +public: + static Glib::RefPtr create( + struct srd_session *libsigrokdecode_session, uint64_t unitsize); + + /* Retrieve libsigrokdecode session. */ + struct srd_session *libsigrokdecode_session(); + + /* 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 LegacyDecoder(GstBaseSink *gobj); + +private: + struct srd_session *session_; + uint64_t abs_ss_; + uint64_t unitsite_; +}; +#endif + +} +#endif diff --git a/include/libsigrokflow/libsigrokflow.hpp b/include/libsigrokflow/libsigrokflow.hpp index f7b5274..6ce7d70 100644 --- a/include/libsigrokflow/libsigrokflow.hpp +++ b/include/libsigrokflow/libsigrokflow.hpp @@ -21,66 +21,11 @@ #ifndef LIBSIGROKFLOW_LIBSIGROKFLOW_HPP #define LIBSIGROKFLOW_LIBSIGROKFLOW_HPP -/* Temporary workaround, will be dropped later. */ -#define HAVE_LIBSIGROKCXX 1 -#define HAVE_LIBSIGROKDECODE 1 - -#include -#include -#include -#ifdef HAVE_LIBSIGROKCXX -#include -#endif -#ifdef HAVE_LIBSIGROKDECODE -#include -#endif - #include #include #include #include #include +#include -namespace Srf -{ - -using namespace std; - -#ifdef HAVE_LIBSIGROKDECODE -class LegacyDecoder : - public Sink -{ -public: - static Glib::RefPtr create( - struct srd_session *libsigrokdecode_session, uint64_t unitsize); - - /* Retrieve libsigrokdecode session. */ - struct srd_session *libsigrokdecode_session(); - - /* 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 LegacyDecoder(GstBaseSink *gobj); - -private: - struct srd_session *session_; - uint64_t abs_ss_; - uint64_t unitsite_; -}; -#endif - -} #endif diff --git a/src/legacy_decoder.cpp b/src/legacy_decoder.cpp index 82d6f8b..e1ff552 100644 --- a/src/legacy_decoder.cpp +++ b/src/legacy_decoder.cpp @@ -19,7 +19,8 @@ */ #include -#include +#include +#include namespace Srf {