]> sigrok.org Git - pulseview.git/blame - pv/session.cpp
win32: Re-fix the Windows build (namespace pollution via windows.h).
[pulseview.git] / pv / session.cpp
CommitLineData
2953961c 1/*
b3f22de0 2 * This file is part of the PulseView project.
2953961c 3 *
1bc6525b 4 * Copyright (C) 2012-14 Joel Holdsworth <joel@airwebreathe.org.uk>
2953961c
JH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
35750e4d
UH
21#ifdef _WIN32
22// Windows: Avoid boost/thread namespace pollution (which includes windows.h).
23#define NOGDI
24#define NORESOURCE
25#endif
e71eb81c
JH
26#include <boost/thread/locks.hpp>
27#include <boost/thread/shared_mutex.hpp>
28
269528f5 29#ifdef ENABLE_DECODE
4e5a4405 30#include <libsigrokdecode/libsigrokdecode.h>
269528f5 31#endif
4e5a4405 32
f65cd27b 33#include "session.hpp"
2953961c 34
2acdb232 35#include "devicemanager.hpp"
119aff65 36
2acdb232 37#include "data/analog.hpp"
f3d66e52 38#include "data/analogsegment.hpp"
2acdb232
JH
39#include "data/decoderstack.hpp"
40#include "data/logic.hpp"
f3d66e52 41#include "data/logicsegment.hpp"
2acdb232 42#include "data/decode/decoder.hpp"
82c7f640 43
da30ecb7
JH
44#include "devices/hardwaredevice.hpp"
45#include "devices/sessionfile.hpp"
46
2acdb232
JH
47#include "view/analogsignal.hpp"
48#include "view/decodetrace.hpp"
49#include "view/logicsignal.hpp"
28a4c9c5 50
3b68d03d
JH
51#include <cassert>
52#include <mutex>
e92cd4e4
JH
53#include <stdexcept>
54
728e5ef7
JH
55#include <sys/stat.h>
56
79efbc53
JH
57#include <QDebug>
58
fe3a1c21 59#include <libsigrokcxx/libsigrokcxx.hpp>
e8d00928 60
aca64cac
JH
61using boost::shared_lock;
62using boost::shared_mutex;
63using boost::unique_lock;
64
f9abf97e 65using std::dynamic_pointer_cast;
d2344534 66using std::function;
3b68d03d 67using std::lock_guard;
d873f4d6 68using std::list;
819f4c25 69using std::map;
aca64cac 70using std::mutex;
8524a597 71using std::recursive_mutex;
02412f0b 72using std::set;
f9abf97e 73using std::shared_ptr;
819f4c25 74using std::string;
78b0af3e 75using std::unordered_set;
819f4c25 76using std::vector;
28a4c9c5 77
e8d00928
ML
78using sigrok::Analog;
79using sigrok::Channel;
80using sigrok::ChannelType;
81using sigrok::ConfigKey;
82using sigrok::DatafeedCallbackFunction;
e8d00928 83using sigrok::Error;
e8d00928
ML
84using sigrok::Header;
85using sigrok::Logic;
86using sigrok::Meta;
87using sigrok::Packet;
88using sigrok::PacketPayload;
89using sigrok::Session;
90using sigrok::SessionDevice;
91
92using Glib::VariantBase;
93using Glib::Variant;
51e77110 94
e8d00928 95namespace pv {
2b81ae46 96Session::Session(DeviceManager &device_manager) :
8dbbc7f0 97 device_manager_(device_manager),
ff008de6
JH
98 capture_state_(Stopped),
99 cur_samplerate_(0)
2953961c 100{
2953961c
JH
101}
102
2b81ae46 103Session::~Session()
2953961c 104{
04463625 105 // Stop and join to the thread
5b7cf66c 106 stop_capture();
2953961c
JH
107}
108
2b81ae46 109DeviceManager& Session::device_manager()
4cb0b033 110{
8dbbc7f0 111 return device_manager_;
4cb0b033
JH
112}
113
2b81ae46 114const DeviceManager& Session::device_manager() const
4cb0b033 115{
8dbbc7f0 116 return device_manager_;
4cb0b033
JH
117}
118
da30ecb7 119shared_ptr<sigrok::Session> Session::session() const
1f4caa77 120{
da30ecb7
JH
121 if (!device_)
122 return shared_ptr<sigrok::Session>();
123 return device_->session();
1f4caa77
JH
124}
125
da30ecb7 126shared_ptr<devices::Device> Session::device() const
dc0867ff 127{
8dbbc7f0 128 return device_;
dc0867ff
JH
129}
130
da30ecb7 131void Session::set_device(shared_ptr<devices::Device> device)
d64d1596 132{
da30ecb7
JH
133 assert(device);
134
82596f46
JH
135 // Ensure we are not capturing before setting the device
136 stop_capture();
137
4d6c6ea3
SA
138 if (device_)
139 device_->close();
140
da30ecb7 141 device_ = std::move(device);
4d6c6ea3 142 device_->open();
da30ecb7
JH
143 device_->session()->add_datafeed_callback([=]
144 (shared_ptr<sigrok::Device> device, shared_ptr<Packet> packet) {
145 data_feed_in(device, packet);
146 });
ffe00119 147 update_signals();
ae2d1bc5 148
8dbbc7f0 149 decode_traces_.clear();
85843b14 150
20f81a58 151 device_selected();
ae2d1bc5 152}
85843b14 153
2b81ae46 154void Session::set_default_device()
6fd0b639 155{
da30ecb7 156 const list< shared_ptr<devices::HardwareDevice> > &devices =
8dbbc7f0 157 device_manager_.devices();
6fd0b639 158
da30ecb7
JH
159 if (devices.empty())
160 return;
dc0867ff 161
da30ecb7
JH
162 // Try and find the demo device and select that by default
163 const auto iter = std::find_if(devices.begin(), devices.end(),
164 [] (const shared_ptr<devices::HardwareDevice> &d) {
165 return d->hardware_device()->driver()->name() ==
166 "demo"; });
167 set_device((iter == devices.end()) ? devices.front() : *iter);
dc0867ff
JH
168}
169
2b81ae46 170Session::capture_state Session::get_capture_state() const
5b7cf66c 171{
8dbbc7f0
JH
172 lock_guard<mutex> lock(sampling_mutex_);
173 return capture_state_;
5b7cf66c
JH
174}
175
2b81ae46 176void Session::start_capture(function<void (const QString)> error_handler)
2e2946fe 177{
5b7cf66c
JH
178 stop_capture();
179
6ac6242b 180 // Check that at least one channel is enabled
da30ecb7 181 assert(device_);
e6c1382e
JH
182 const shared_ptr<sigrok::Device> sr_dev = device_->device();
183 if (sr_dev) {
184 const auto channels = sr_dev->channels();
185 if (!std::any_of(channels.begin(), channels.end(),
186 [](shared_ptr<Channel> channel) {
187 return channel->enabled(); })) {
188 error_handler(tr("No channels enabled."));
189 return;
190 }
9c48fa57
JH
191 }
192
53ea4c6c 193 // Clear signal data
33994eb4 194 for (const shared_ptr<data::SignalData> d : get_data())
53ea4c6c
SA
195 d->clear();
196
9c48fa57 197 // Begin the session
8dbbc7f0 198 sampling_thread_ = std::thread(
2b81ae46 199 &Session::sample_thread_proc, this, device_,
19adbc2c 200 error_handler);
2e2946fe
JH
201}
202
2b81ae46 203void Session::stop_capture()
5b7cf66c 204{
04463625 205 if (get_capture_state() != Stopped)
da30ecb7 206 device_->stop();
5b7cf66c
JH
207
208 // Check that sampling stopped
8dbbc7f0
JH
209 if (sampling_thread_.joinable())
210 sampling_thread_.join();
5b7cf66c
JH
211}
212
2b81ae46 213set< shared_ptr<data::SignalData> > Session::get_data() const
02412f0b 214{
8dbbc7f0 215 shared_lock<shared_mutex> lock(signals_mutex_);
02412f0b 216 set< shared_ptr<data::SignalData> > data;
8dbbc7f0 217 for (const shared_ptr<view::Signal> sig : signals_) {
02412f0b
JH
218 assert(sig);
219 data.insert(sig->data());
220 }
221
222 return data;
223}
224
bf914698 225const unordered_set< shared_ptr<view::Signal> > Session::signals() const
2e2946fe 226{
bf914698 227 shared_lock<shared_mutex> lock(signals_mutex_);
8dbbc7f0 228 return signals_;
2e2946fe
JH
229}
230
269528f5 231#ifdef ENABLE_DECODE
2b81ae46 232bool Session::add_decoder(srd_decoder *const dec)
82c7f640 233{
6ac6242b 234 map<const srd_channel*, shared_ptr<view::LogicSignal> > channels;
7491a29f 235 shared_ptr<data::DecoderStack> decoder_stack;
4e5a4405 236
e92cd4e4 237 try
82c7f640 238 {
8dbbc7f0 239 lock_guard<boost::shared_mutex> lock(signals_mutex_);
e0fc5810 240
4e5a4405 241 // Create the decoder
7491a29f 242 decoder_stack = shared_ptr<data::DecoderStack>(
bdc5c3b0 243 new data::DecoderStack(*this, dec));
4e5a4405 244
6ac6242b
ML
245 // Make a list of all the channels
246 std::vector<const srd_channel*> all_channels;
f3290553 247 for (const GSList *i = dec->channels; i; i = i->next)
6ac6242b 248 all_channels.push_back((const srd_channel*)i->data);
f3290553 249 for (const GSList *i = dec->opt_channels; i; i = i->next)
6ac6242b 250 all_channels.push_back((const srd_channel*)i->data);
d2f46d27 251
6ac6242b
ML
252 // Auto select the initial channels
253 for (const srd_channel *pdch : all_channels)
8dbbc7f0 254 for (shared_ptr<view::Signal> s : signals_)
4e5a4405
JH
255 {
256 shared_ptr<view::LogicSignal> l =
257 dynamic_pointer_cast<view::LogicSignal>(s);
8bd26d8b 258 if (l && QString::fromUtf8(pdch->name).
27e8df22 259 toLower().contains(
0a47889b 260 l->name().toLower()))
6ac6242b 261 channels[pdch] = l;
4e5a4405 262 }
4e5a4405 263
7491a29f
JH
264 assert(decoder_stack);
265 assert(!decoder_stack->stack().empty());
266 assert(decoder_stack->stack().front());
6ac6242b 267 decoder_stack->stack().front()->set_channels(channels);
4e5a4405
JH
268
269 // Create the decode signal
b9329558 270 shared_ptr<view::DecodeTrace> d(
7491a29f 271 new view::DecodeTrace(*this, decoder_stack,
8dbbc7f0
JH
272 decode_traces_.size()));
273 decode_traces_.push_back(d);
82c7f640 274 }
e92cd4e4
JH
275 catch(std::runtime_error e)
276 {
277 return false;
278 }
279
82c7f640 280 signals_changed();
e92cd4e4 281
7491a29f
JH
282 // Do an initial decode
283 decoder_stack->begin_decode();
284
e92cd4e4 285 return true;
82c7f640
JH
286}
287
2b81ae46 288vector< shared_ptr<view::DecodeTrace> > Session::get_decode_signals() const
38eeddea 289{
8dbbc7f0
JH
290 shared_lock<shared_mutex> lock(signals_mutex_);
291 return decode_traces_;
38eeddea
JH
292}
293
2b81ae46 294void Session::remove_decode_signal(view::DecodeTrace *signal)
c51482b3 295{
8dbbc7f0 296 for (auto i = decode_traces_.begin(); i != decode_traces_.end(); i++)
c51482b3
JH
297 if ((*i).get() == signal)
298 {
8dbbc7f0 299 decode_traces_.erase(i);
c51482b3
JH
300 signals_changed();
301 return;
302 }
303}
269528f5 304#endif
c51482b3 305
2b81ae46 306void Session::set_capture_state(capture_state state)
6ac96c2e 307{
8dbbc7f0
JH
308 lock_guard<mutex> lock(sampling_mutex_);
309 const bool changed = capture_state_ != state;
310 capture_state_ = state;
f3290553 311 if (changed)
2b49eeb0 312 capture_state_changed(state);
6ac96c2e
JH
313}
314
ffe00119 315void Session::update_signals()
b087ba7f 316{
ffe00119 317 assert(device_);
e6c1382e
JH
318
319 lock_guard<recursive_mutex> lock(data_mutex_);
b087ba7f 320
ffe00119 321 const shared_ptr<sigrok::Device> sr_dev = device_->device();
c6412b47
JH
322 if (!sr_dev) {
323 signals_.clear();
324 logic_data_.reset();
325 return;
326 }
327
b087ba7f 328 // Detect what data types we will receive
c6412b47 329 auto channels = sr_dev->channels();
e8d00928
ML
330 unsigned int logic_channel_count = std::count_if(
331 channels.begin(), channels.end(),
332 [] (shared_ptr<Channel> channel) {
333 return channel->type() == ChannelType::LOGIC; });
b087ba7f 334
f3d66e52 335 // Create data containers for the logic data segments
b087ba7f 336 {
8524a597 337 lock_guard<recursive_mutex> data_lock(data_mutex_);
b087ba7f 338
3917ba77
JH
339 if (logic_channel_count == 0) {
340 logic_data_.reset();
341 } else if (!logic_data_ ||
342 logic_data_->num_channels() != logic_channel_count) {
8dbbc7f0 343 logic_data_.reset(new data::Logic(
6ac6242b 344 logic_channel_count));
8dbbc7f0 345 assert(logic_data_);
b087ba7f 346 }
b087ba7f
JH
347 }
348
349 // Make the Signals list
fbd3e234 350 {
8dbbc7f0 351 unique_lock<shared_mutex> lock(signals_mutex_);
b087ba7f 352
3917ba77 353 unordered_set< shared_ptr<view::Signal> > prev_sigs(signals_);
8dbbc7f0 354 signals_.clear();
b087ba7f 355
c6412b47 356 for (auto channel : sr_dev->channels()) {
39e680c2 357 shared_ptr<view::Signal> signal;
39e680c2 358
3917ba77
JH
359 // Find the channel in the old signals
360 const auto iter = std::find_if(
361 prev_sigs.cbegin(), prev_sigs.cend(),
362 [&](const shared_ptr<view::Signal> &s) {
363 return s->channel() == channel;
364 });
365 if (iter != prev_sigs.end()) {
366 // Copy the signal from the old set to the new
367 signal = *iter;
368 auto logic_signal = dynamic_pointer_cast<
369 view::LogicSignal>(signal);
370 if (logic_signal)
371 logic_signal->set_logic_data(
372 logic_data_);
373 } else {
374 // Create a new signal
375 switch(channel->type()->id()) {
376 case SR_CHANNEL_LOGIC:
377 signal = shared_ptr<view::Signal>(
378 new view::LogicSignal(*this,
ffe00119 379 device_, channel,
3917ba77
JH
380 logic_data_));
381 break;
382
383 case SR_CHANNEL_ANALOG:
384 {
385 shared_ptr<data::Analog> data(
386 new data::Analog());
387 signal = shared_ptr<view::Signal>(
388 new view::AnalogSignal(
389 *this, channel, data));
390 break;
391 }
392
393 default:
394 assert(0);
395 break;
396 }
b087ba7f 397 }
39e680c2
JH
398
399 assert(signal);
78b0af3e 400 signals_.insert(signal);
b087ba7f 401 }
fbd3e234 402 }
b087ba7f
JH
403
404 signals_changed();
405}
406
2b81ae46 407shared_ptr<view::Signal> Session::signal_from_channel(
e8d00928 408 shared_ptr<Channel> channel) const
3ddcc083 409{
8dbbc7f0
JH
410 lock_guard<boost::shared_mutex> lock(signals_mutex_);
411 for (shared_ptr<view::Signal> sig : signals_) {
3ddcc083 412 assert(sig);
6ac6242b 413 if (sig->channel() == channel)
3ddcc083
JH
414 return sig;
415 }
416 return shared_ptr<view::Signal>();
417}
418
da30ecb7 419void Session::sample_thread_proc(shared_ptr<devices::Device> device,
f2edb557 420 function<void (const QString)> error_handler)
274d4f13 421{
e8d00928 422 assert(device);
f2edb557 423 assert(error_handler);
be73bdfa 424
45f0c7c9
UH
425 (void)device;
426
b48daed6 427 cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);
274d4f13 428
e7216ae0
SA
429 out_of_memory_ = false;
430
ae2d1bc5 431 try {
5237f0c5 432 device_->start();
e8d00928
ML
433 } catch(Error e) {
434 error_handler(e.what());
eec446e1
JH
435 return;
436 }
437
da30ecb7 438 set_capture_state(device_->session()->trigger() ?
07dcf561 439 AwaitingTrigger : Running);
eec446e1 440
da30ecb7 441 device_->run();
eec446e1 442 set_capture_state(Stopped);
1a2fe44c
JH
443
444 // Confirm that SR_DF_END was received
f3d66e52 445 if (cur_logic_segment_)
bb2cdfff
JH
446 {
447 qDebug("SR_DF_END was not received.");
448 assert(0);
449 }
e7216ae0
SA
450
451 if (out_of_memory_)
452 error_handler(tr("Out of memory, acquisition stopped."));
eec446e1
JH
453}
454
da30ecb7 455void Session::feed_in_header()
eec446e1 456{
b48daed6 457 cur_samplerate_ = device_->read_config<uint64_t>(ConfigKey::SAMPLERATE);
be73bdfa
JH
458}
459
da30ecb7 460void Session::feed_in_meta(shared_ptr<Meta> meta)
be73bdfa 461{
e8d00928
ML
462 for (auto entry : meta->config()) {
463 switch (entry.first->id()) {
be73bdfa
JH
464 case SR_CONF_SAMPLERATE:
465 /// @todo handle samplerate changes
be73bdfa
JH
466 break;
467 default:
468 // Unknown metadata is not an error.
469 break;
470 }
aba1dd16 471 }
74043039
JH
472
473 signals_changed();
aba1dd16
JH
474}
475
2b81ae46 476void Session::feed_in_frame_begin()
82f50b10 477{
f3d66e52 478 if (cur_logic_segment_ || !cur_analog_segments_.empty())
82f50b10
JH
479 frame_began();
480}
481
2b81ae46 482void Session::feed_in_logic(shared_ptr<Logic> logic)
9c112671 483{
8524a597 484 lock_guard<recursive_mutex> lock(data_mutex_);
79efbc53 485
ff4bf6bd
SA
486 const size_t sample_count = logic->data_length() / logic->unit_size();
487
8dbbc7f0 488 if (!logic_data_)
9c112671 489 {
e6c1382e
JH
490 // The only reason logic_data_ would not have been created is
491 // if it was not possible to determine the signals when the
492 // device was created.
493 update_signals();
79efbc53 494 }
be73bdfa 495
f3d66e52 496 if (!cur_logic_segment_)
79efbc53 497 {
bb2cdfff 498 // This could be the first packet after a trigger
2b49eeb0
JH
499 set_capture_state(Running);
500
f3d66e52
JH
501 // Create a new data segment
502 cur_logic_segment_ = shared_ptr<data::LogicSegment>(
503 new data::LogicSegment(
ff4bf6bd 504 logic, cur_samplerate_, sample_count));
f3d66e52 505 logic_data_->push_segment(cur_logic_segment_);
82f50b10
JH
506
507 // @todo Putting this here means that only listeners querying
508 // for logic will be notified. Currently the only user of
509 // frame_began is DecoderStack, but in future we need to signal
510 // this after both analog and logic sweeps have begun.
511 frame_began();
9c112671
JH
512 }
513 else
514 {
f3d66e52
JH
515 // Append to the existing data segment
516 cur_logic_segment_->append_payload(logic);
9c112671
JH
517 }
518
1f374035 519 data_received();
9c112671
JH
520}
521
2b81ae46 522void Session::feed_in_analog(shared_ptr<Analog> analog)
aba1dd16 523{
8524a597 524 lock_guard<recursive_mutex> lock(data_mutex_);
79efbc53 525
e8d00928
ML
526 const vector<shared_ptr<Channel>> channels = analog->channels();
527 const unsigned int channel_count = channels.size();
528 const size_t sample_count = analog->num_samples() / channel_count;
475f4d08 529 const float *data = static_cast<const float *>(analog->data_pointer());
bb2cdfff 530 bool sweep_beginning = false;
be73bdfa 531
e8d00928 532 for (auto channel : channels)
79efbc53 533 {
f3d66e52 534 shared_ptr<data::AnalogSegment> segment;
2b49eeb0 535
f3d66e52
JH
536 // Try to get the segment of the channel
537 const map< shared_ptr<Channel>, shared_ptr<data::AnalogSegment> >::
538 iterator iter = cur_analog_segments_.find(channel);
539 if (iter != cur_analog_segments_.end())
540 segment = (*iter).second;
bb2cdfff
JH
541 else
542 {
f3d66e52 543 // If no segment was found, this means we havn't
bb2cdfff 544 // created one yet. i.e. this is the first packet
f3d66e52 545 // in the sweep containing this segment.
bb2cdfff
JH
546 sweep_beginning = true;
547
f3d66e52
JH
548 // Create a segment, keep it in the maps of channels
549 segment = shared_ptr<data::AnalogSegment>(
550 new data::AnalogSegment(
ff4bf6bd 551 cur_samplerate_, sample_count));
f3d66e52 552 cur_analog_segments_[channel] = segment;
bb2cdfff 553
ff4bf6bd 554 // Find the analog data associated with the channel
bb2cdfff
JH
555 shared_ptr<view::AnalogSignal> sig =
556 dynamic_pointer_cast<view::AnalogSignal>(
6ac6242b 557 signal_from_channel(channel));
bb2cdfff
JH
558 assert(sig);
559
560 shared_ptr<data::Analog> data(sig->analog_data());
561 assert(data);
562
f3d66e52
JH
563 // Push the segment into the analog data.
564 data->push_segment(segment);
bb2cdfff
JH
565 }
566
f3d66e52 567 assert(segment);
bb2cdfff 568
f3d66e52
JH
569 // Append the samples in the segment
570 segment->append_interleaved_samples(data++, sample_count,
6ac6242b 571 channel_count);
aba1dd16 572 }
bb2cdfff
JH
573
574 if (sweep_beginning) {
575 // This could be the first packet after a trigger
576 set_capture_state(Running);
aba1dd16
JH
577 }
578
1f374035 579 data_received();
aba1dd16 580}
9c112671 581
da30ecb7
JH
582void Session::data_feed_in(shared_ptr<sigrok::Device> device,
583 shared_ptr<Packet> packet)
b0e1d01d 584{
da30ecb7
JH
585 (void)device;
586
e8d00928 587 assert(device);
da30ecb7 588 assert(device == device_->device());
b0e1d01d
JH
589 assert(packet);
590
e8d00928 591 switch (packet->type()->id()) {
b0e1d01d 592 case SR_DF_HEADER:
da30ecb7 593 feed_in_header();
b0e1d01d
JH
594 break;
595
be73bdfa 596 case SR_DF_META:
da30ecb7 597 feed_in_meta(dynamic_pointer_cast<Meta>(packet->payload()));
aba1dd16
JH
598 break;
599
82f50b10
JH
600 case SR_DF_FRAME_BEGIN:
601 feed_in_frame_begin();
602 break;
603
2e2946fe 604 case SR_DF_LOGIC:
e7216ae0
SA
605 try {
606 feed_in_logic(dynamic_pointer_cast<Logic>(packet->payload()));
607 } catch (std::bad_alloc) {
608 out_of_memory_ = true;
609 device_->stop();
610 }
2953961c
JH
611 break;
612
aba1dd16 613 case SR_DF_ANALOG:
e7216ae0
SA
614 try {
615 feed_in_analog(dynamic_pointer_cast<Analog>(packet->payload()));
616 } catch (std::bad_alloc) {
617 out_of_memory_ = true;
618 device_->stop();
619 }
aba1dd16
JH
620 break;
621
2953961c 622 case SR_DF_END:
2e2946fe
JH
623 {
624 {
8524a597 625 lock_guard<recursive_mutex> lock(data_mutex_);
f3d66e52
JH
626 cur_logic_segment_.reset();
627 cur_analog_segments_.clear();
2e2946fe 628 }
1f374035 629 frame_ended();
2953961c
JH
630 break;
631 }
adb0a983
ML
632 default:
633 break;
2e2946fe 634 }
2953961c
JH
635}
636
51e77110 637} // namespace pv