X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fstoresession.cpp;h=a3d745b387834e4f76a2516164ca0aa48540125e;hp=1a27e5654dd9e8e66ec96fb0d773a96ad83536f0;hb=de6e819c8a6b3f61e69bbb53b5c853ee6686641e;hpb=da30ecb7e72bd2547e524258efa5ec642988b70b diff --git a/pv/storesession.cpp b/pv/storesession.cpp index 1a27e565..a3d745b3 100644 --- a/pv/storesession.cpp +++ b/pv/storesession.cpp @@ -91,12 +91,15 @@ const QString& StoreSession::error() const bool StoreSession::start() { - set< shared_ptr > data_set = - session_.get_data(); - shared_lock lock(session_.signals_mutex()); - const unordered_set< shared_ptr > &sigs( - session_.signals()); + unordered_set< shared_ptr > sigs(session_.signals()); + + // Add enabled channels to the data set + set< shared_ptr > data_set; + + 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 +117,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,17 +140,10 @@ bool StoreSession::start() map options = options_; - // If the output has the capability to write files, use it. - // Otherwise, open the output stream. - const auto opt_list = output_format_->options(); - if (opt_list.find("filename") != opt_list.end()) - options["filename"] = - Glib::Variant::create(file_name_); - else - output_stream_.open(file_name_, ios_base::binary | - ios_base::trunc | ios_base::out); - - output_ = output_format_->create_output(device, options); + 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( {{ConfigKey::SAMPLERATE, Glib::Variant::create( segment->samplerate())}}); @@ -205,7 +201,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();