+ // Try looking up the sub-row of this class
+ const auto r = d->class_rows_.find(make_pair(decc, a.format()));
+ if (r != d->class_rows_.end())
+ row_iter = d->rows_.find((*r).second);
+ else {
+ // Failing that, use the decoder as a key
+ row_iter = d->rows_.find(Row(decc));
+ }
+
+ assert(row_iter != d->rows_.end());
+ if (row_iter == d->rows_.end()) {
+ qDebug() << "Unexpected annotation: decoder = " << decc <<
+ ", format = " << a.format();
+ assert(0);
+ return;
+ }
+
+ // Add the annotation
+ (*row_iter).second.push_annotation(a);
+}
+
+void DecoderStack::on_new_frame()
+{
+ begin_decode();
+}
+
+void DecoderStack::on_data_received()
+{
+ {
+ unique_lock<mutex> lock(input_mutex_);
+ if (segment_)
+ sample_count_ = segment_->get_sample_count();
+ }
+ input_cond_.notify_one();
+}
+
+void DecoderStack::on_frame_ended()
+{
+ {
+ unique_lock<mutex> lock(input_mutex_);
+ if (segment_)
+ frame_complete_ = true;
+ }
+ input_cond_.notify_one();