X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fstoresession.cpp;h=a3d745b387834e4f76a2516164ca0aa48540125e;hb=de6e819c8a6b3f61e69bbb53b5c853ee6686641e;hp=1dad2d8052e360e5f3b9ff70e4edf4da04d9b7dd;hpb=adb240c01eb999c0abcafcf92c302b97475f7949;p=pulseview.git diff --git a/pv/storesession.cpp b/pv/storesession.cpp index 1dad2d8..a3d745b 100644 --- a/pv/storesession.cpp +++ b/pv/storesession.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -90,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()) { @@ -113,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; } @@ -132,21 +136,14 @@ bool StoreSession::start() // Begin storing try { const auto context = session_.device_manager().context(); - auto device = session_.device(); + auto device = session_.device()->device(); 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())}}); @@ -204,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();