X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fstoresession.cpp;h=c7c2edb0b4eace1e1fcf290770527b35ac6d12fb;hb=35750e4dc619d538f105ed024f3a72b630108234;hp=bf214554250ac6ddf23185aa61bc448bcbf24e09;hpb=ad83f8faadeded7902eb3e25b608f45674b86fa0;p=pulseview.git diff --git a/pv/storesession.cpp b/pv/storesession.cpp index bf21455..c7c2edb 100644 --- a/pv/storesession.cpp +++ b/pv/storesession.cpp @@ -20,6 +20,14 @@ #include +#ifdef _WIN32 +// Windows: Avoid boost/thread namespace pollution (which includes windows.h). +#define NOGDI +#define NORESOURCE +#endif +#include +#include + #include "storesession.hpp" #include @@ -55,6 +63,7 @@ using Glib::VariantBase; using sigrok::ConfigKey; using sigrok::Error; using sigrok::OutputFormat; +using sigrok::OutputFlag; namespace pv { @@ -91,12 +100,14 @@ const QString& StoreSession::error() const bool StoreSession::start() { - set< shared_ptr > data_set = - session_.get_data(); + const unordered_set< shared_ptr > sigs(session_.signals()); + + // Add enabled channels to the data set + set< shared_ptr > data_set; - shared_lock lock(session_.signals_mutex()); - const unordered_set< shared_ptr > &sigs( - session_.signals()); + for (shared_ptr signal : sigs) + if (signal->enabled()) + data_set.insert(signal->data()); // Check we have logic data if (data_set.empty() || sigs.empty()) { @@ -114,7 +125,7 @@ bool StoreSession::start() shared_ptr data; if (!(data = dynamic_pointer_cast(*data_set.begin()))) { error_ = tr("PulseView currently only has support for " - "storing a logic data."); + "storing logic data."); return false; } @@ -137,8 +148,9 @@ bool StoreSession::start() map options = options_; - output_stream_.open(file_name_, ios_base::binary | - ios_base::trunc | ios_base::out); + if (!output_format_->test_flag(OutputFlag::INTERNAL_IO_HANDLING)) + output_stream_.open(file_name_, ios_base::binary | + ios_base::trunc | ios_base::out); output_ = output_format_->create_output(file_name_, device, options); auto meta = context->create_meta_packet( @@ -198,7 +210,7 @@ void StoreSession::store_proc(shared_ptr segment) start_sample + samples_per_block, sample_count); segment->get_samples(data, start_sample, end_sample); - size_t length = end_sample - start_sample; + size_t length = (end_sample - start_sample) * unit_size; try { const auto context = session_.device_manager().context();