]>
Commit | Line | Data |
---|---|---|
d59dd5ff 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_DECODER_HPP | |
22 | #define LIBSIGROKFLOW_LEGACY_DECODER_HPP | |
23 | ||
24 | /* Temporary workaround, will be dropped later. */ | |
25 | #define HAVE_LIBSIGROKDECODE 1 | |
26 | ||
27 | #include <gstreamermm.h> | |
28 | #ifdef HAVE_LIBSIGROKDECODE | |
29 | #include <libsigrokdecode/libsigrokdecode.h> | |
30 | #endif | |
31 | #include <libsigrokflow/main.hpp> | |
32 | ||
33 | namespace Srf | |
34 | { | |
35 | ||
f638442b | 36 | using std::shared_ptr; |
d59dd5ff UH |
37 | |
38 | #ifdef HAVE_LIBSIGROKDECODE | |
39 | class LegacyDecoder : | |
40 | public Sink | |
41 | { | |
42 | public: | |
43 | static Glib::RefPtr<LegacyDecoder> create( | |
44 | struct srd_session *libsigrokdecode_session, uint64_t unitsize); | |
45 | ||
46 | /* Retrieve libsigrokdecode session. */ | |
47 | struct srd_session *libsigrokdecode_session(); | |
48 | ||
49 | /* Override start. */ | |
50 | bool start_vfunc() override; | |
51 | ||
52 | /* Override render. */ | |
53 | Gst::FlowReturn render_vfunc(const Glib::RefPtr<Gst::Buffer> &buffer) override; | |
54 | ||
55 | /* Override stop. */ | |
56 | bool stop_vfunc() override; | |
57 | ||
58 | /* Gst class init. */ | |
59 | static void class_init(Gst::ElementClass<LegacyDecoder> *klass); | |
60 | ||
61 | /* Register class with plugin. */ | |
62 | static bool register_element(Glib::RefPtr<Gst::Plugin> plugin); | |
63 | ||
64 | /* Constructor used by element factory. */ | |
65 | explicit LegacyDecoder(GstBaseSink *gobj); | |
66 | ||
67 | private: | |
68 | struct srd_session *session_; | |
69 | uint64_t abs_ss_; | |
70 | uint64_t unitsite_; | |
71 | }; | |
72 | #endif | |
73 | ||
74 | } | |
75 | #endif |