+void DecodeSignal::create_segments()
+{
+ // Make sure we have as many segments as we need
+ const uint32_t input_segment_count = get_input_segment_count();
+
+ for (uint32_t i = logic_mux_data_->logic_segments().size(); i < input_segment_count; i++) {
+ shared_ptr<LogicSegment> segment =
+ make_shared<LogicSegment>(*logic_mux_data_, logic_mux_unit_size_, 0);
+ logic_mux_data_->push_segment(segment);
+ }
+
+ for (uint32_t i = segments_.size(); i < input_segment_count; i++) {
+ // Create annotation segment
+ segments_.emplace_back(DecodeSegment());
+
+ // Add annotation classes
+ for (const shared_ptr<decode::Decoder> &dec : stack_) {
+ assert(dec);
+ const srd_decoder *const decc = dec->decoder();
+ assert(dec->decoder());
+
+ // Add a row for the decoder if it doesn't have a row list
+ if (!decc->annotation_rows)
+ (segments_.back().annotation_rows)[Row(decc)] =
+ decode::RowData();
+
+ // Add the decoder rows
+ for (const GSList *l = decc->annotation_rows; l; l = l->next) {
+ const srd_decoder_annotation_row *const ann_row =
+ (srd_decoder_annotation_row *)l->data;
+ assert(ann_row);
+
+ const Row row(decc, ann_row);
+
+ // Add a new empty row data object
+ (segments_.back().annotation_rows)[row] =
+ decode::RowData();
+ }
+ }
+ }
+}
+