]> sigrok.org Git - pulseview.git/blobdiff - pv/sigsession.cpp
Moved signal creation into feed_in_header
[pulseview.git] / pv / sigsession.cpp
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: