]>
Commit | Line | Data |
---|---|---|
bf71e84f UH |
1 | /* |
2 | * This file is part of the libsigrokflow project. | |
3 | * | |
4 | * Copyright (C) 2018 Martin Ling <martin-sigrok@earth.li> | |
5 | * Copyright (C) 2018 Uwe Hermann <uwe@hermann-uwe.de> | |
6 | * | |
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. | |
11 | * | |
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. | |
16 | * | |
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/>. | |
19 | */ | |
20 | ||
21 | #ifndef LIBSIGROKFLOW_LEGACY_OUTPUT_HPP | |
22 | #define LIBSIGROKFLOW_LEGACY_OUTPUT_HPP | |
23 | ||
24 | /* Temporary workaround, will be dropped later. */ | |
25 | #define HAVE_LIBSIGROKCXX 1 | |
26 | ||
27 | #include <gstreamermm.h> | |
28 | #ifdef HAVE_LIBSIGROKCXX | |
29 | #include <libsigrokcxx/libsigrokcxx.hpp> | |
30 | #endif | |
31 | #include <libsigrokflow/main.hpp> | |
32 | ||
33 | namespace Srf | |
34 | { | |
35 | ||
36 | using namespace std; | |
37 | ||
38 | #ifdef HAVE_LIBSIGROKCXX | |
39 | class LegacyOutput : | |
40 | public Sink | |
41 | { | |
42 | public: | |
43 | /* Create from libsigrok output object. */ | |
44 | static Glib::RefPtr<LegacyOutput> create( | |
45 | shared_ptr<sigrok::OutputFormat> libsigrok_output_format, | |
46 | map<string, Glib::VariantBase> options = map<string, Glib::VariantBase>()); | |
47 | ||
48 | /* Override start. */ | |
49 | bool start_vfunc() override; | |
50 | ||
51 | /* Override render. */ | |
52 | Gst::FlowReturn render_vfunc(const Glib::RefPtr<Gst::Buffer> &buffer) override; | |
53 | ||
54 | /* Override stop. */ | |
55 | bool stop_vfunc() override; | |
56 | ||
57 | /* Gst class init. */ | |
58 | static void class_init(Gst::ElementClass<LegacyOutput> *klass); | |
59 | ||
60 | /* Register class with plugin. */ | |
61 | static bool register_element(Glib::RefPtr<Gst::Plugin> plugin); | |
62 | ||
63 | /* Constructor used by element factory. */ | |
64 | explicit LegacyOutput(GstBaseSink *gobj); | |
65 | ||
66 | private: | |
67 | shared_ptr<sigrok::OutputFormat> libsigrok_output_format_; | |
68 | shared_ptr<sigrok::UserDevice> libsigrok_device_; | |
69 | shared_ptr<sigrok::Output> libsigrok_output_; | |
70 | map<string, Glib::VariantBase> options_; | |
71 | }; | |
72 | #endif | |
73 | ||
74 | } | |
75 | #endif |