X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fsession.cpp;h=da9c0e9bb4af998abf3a3303eb525536245b3ba9;hp=07405fe4ba79de4a0003c9d08070ed47406c23a0;hb=48257a69ffad409c9893605d99cd6e15161dff4f;hpb=3d79f521396c8e908fd237f5328153165099f5c3
diff --git a/pv/session.cpp b/pv/session.cpp
index 07405fe4..da9c0e9b 100644
--- a/pv/session.cpp
+++ b/pv/session.cpp
@@ -492,6 +492,27 @@ void Session::feed_in_meta(shared_ptr meta)
signals_changed();
}
+void Session::feed_in_trigger()
+{
+ // The channel containing most samples should be most accurate
+ uint64_t sample_count = 0;
+
+ for (const shared_ptr d : get_data()) {
+ assert(d);
+ uint64_t temp_count = 0;
+
+ const vector< shared_ptr > segments =
+ d->segments();
+ for (const shared_ptr &s : segments)
+ temp_count += s->get_sample_count();
+
+ if (temp_count > sample_count)
+ sample_count = temp_count;
+ }
+
+ trigger_event(sample_count / get_samplerate());
+}
+
void Session::feed_in_frame_begin()
{
if (cur_logic_segment_ || !cur_analog_segments_.empty())
@@ -616,6 +637,10 @@ void Session::data_feed_in(shared_ptr device,
feed_in_meta(dynamic_pointer_cast(packet->payload()));
break;
+ case SR_DF_TRIGGER:
+ feed_in_trigger();
+ break;
+
case SR_DF_FRAME_BEGIN:
feed_in_frame_begin();
break;