]> sigrok.org Git - pulseview.git/commitdiff
Moved signal creation into feed_in_header
authorJoel Holdsworth <redacted>
Sun, 27 Jan 2013 16:35:11 +0000 (16:35 +0000)
committerJoel Holdsworth <redacted>
Mon, 28 Jan 2013 20:36:00 +0000 (20:36 +0000)
pv/sigsession.cpp
pv/sigsession.h

index 348d40c1e5b3b09da676184fb12f49ce48b6c566..5b9630631a1fe9c1e104e9f8437745c49d2c61ba 100644 (file)
@@ -140,10 +140,6 @@ void SigSession::load_thread_proc(const string name)
 void SigSession::sample_thread_proc(struct sr_dev_inst *sdi,
        uint64_t record_length)
 {
-       shared_ptr<view::Signal> signal;
-       unsigned int logic_probe_count = 0;
-       unsigned int analog_probe_count = 0;
-
        assert(sdi);
 
        sr_session_new();
@@ -174,6 +170,25 @@ void SigSession::sample_thread_proc(struct sr_dev_inst *sdi,
                }
        }
 
+       if (sr_session_start() != SR_OK) {
+               qDebug() << "Failed to start session.";
+               return;
+       }
+
+       set_capture_state(Running);
+
+       sr_session_run();
+       sr_session_destroy();
+
+       set_capture_state(Stopped);
+}
+
+void SigSession::feed_in_header(const sr_dev_inst *sdi)
+{
+       shared_ptr<view::Signal> signal;
+       unsigned int logic_probe_count = 0;
+       unsigned int analog_probe_count = 0;
+
        // Detect what data types we will receive
        for (const GSList *l = sdi->probes; l; l = l->next) {
                const sr_probe *const probe = (const sr_probe *)l->data;
@@ -240,18 +255,6 @@ void SigSession::sample_thread_proc(struct sr_dev_inst *sdi,
 
                signals_changed();
        }
-
-       if (sr_session_start() != SR_OK) {
-               qDebug() << "Failed to start session.";
-               return;
-       }
-
-       set_capture_state(Running);
-
-       sr_session_run();
-       sr_session_destroy();
-
-       set_capture_state(Stopped);
 }
 
 void SigSession::feed_in_meta(const sr_dev_inst *sdi,
@@ -321,6 +324,7 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi,
 
        switch (packet->type) {
        case SR_DF_HEADER:
+               feed_in_header(sdi);
                break;
 
        case SR_DF_META:
index 177e47c9b0ccc1d3cc20385f16b9d5e1e75426d9..5bdd23456cfbdf88e7044d638ef434897efe2557 100644 (file)
@@ -85,6 +85,8 @@ private:
        void sample_thread_proc(struct sr_dev_inst *sdi,
                uint64_t record_length);
 
+       void feed_in_header(const sr_dev_inst *sdi);
+
        void feed_in_meta(const sr_dev_inst *sdi,
                const sr_datafeed_meta &meta);