SignalData: Moved samplerate into Snapshot
[pulseview.git] / pv / data / decoderstack.cpp
index 5e30faa73c810e7d64e9bfb936e7cb6e8656daa8..a764e452d3d82bc203f88e83cac34bf231fbb699 100644 (file)
@@ -30,7 +30,7 @@
 #include <pv/data/logicsnapshot.hpp>
 #include <pv/data/decode/decoder.hpp>
 #include <pv/data/decode/annotation.hpp>
-#include <pv/sigsession.hpp>
+#include <pv/session.hpp>
 #include <pv/view/logicsignal.hpp>
 
 using std::lock_guard;
@@ -59,9 +59,11 @@ const unsigned int DecoderStack::DecodeNotifyPeriod = 65536;
 
 mutex DecoderStack::global_decode_mutex_;
 
-DecoderStack::DecoderStack(pv::SigSession &session,
+DecoderStack::DecoderStack(pv::Session &session,
        const srd_decoder *const dec) :
        session_(session),
+       start_time_(0),
+       samplerate_(0),
        sample_count_(0),
        frame_complete_(false),
        samples_decoded_(0)
@@ -112,6 +114,16 @@ void DecoderStack::remove(int index)
        stack_.erase(iter);
 }
 
+double DecoderStack::samplerate() const
+{
+       return samplerate_;
+}
+
+double DecoderStack::start_time() const
+{
+       return start_time_;
+}
+
 int64_t DecoderStack::samples_decoded() const
 {
        lock_guard<mutex> decode_lock(output_mutex_);
@@ -245,14 +257,14 @@ void DecoderStack::begin_decode()
 
        // Check we have a snapshot of data
        const deque< shared_ptr<pv::data::LogicSnapshot> > &snapshots =
-               data->get_snapshots();
+               data->logic_snapshots();
        if (snapshots.empty())
                return;
        snapshot_ = snapshots.front();
 
        // Get the samplerate and start time
-       start_time_ = data->get_start_time();
-       samplerate_ = data->samplerate();
+       start_time_ = snapshot_->start_time();
+       samplerate_ = snapshot_->samplerate();
        if (samplerate_ == 0.0)
                samplerate_ = 1.0;
 
@@ -392,7 +404,7 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *decoder)
        assert(decc);
 
        auto row_iter = d->rows_.end();
-       
+
        // Try looking up the sub-row of this class
        const auto r = d->class_rows_.find(make_pair(decc, a.format()));
        if (r != d->class_rows_.end())