From: Joel Holdsworth Date: Sun, 27 Jan 2013 16:35:11 +0000 (+0000) Subject: Moved signal creation into feed_in_header X-Git-Tag: pulseview-0.1.0~134 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=eec446e1588c41eb14de5e21a8383d10653c15bd Moved signal creation into feed_in_header --- diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index 348d40c1..5b963063 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -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 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 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: diff --git a/pv/sigsession.h b/pv/sigsession.h index 177e47c9..5bdd2345 100644 --- a/pv/sigsession.h +++ b/pv/sigsession.h @@ -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);