diff options
-rw-r--r-- | gr-qtgui/lib/time_sink_c_impl.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gr-qtgui/lib/time_sink_c_impl.cc b/gr-qtgui/lib/time_sink_c_impl.cc index 98f603a8b0..209f03340f 100644 --- a/gr-qtgui/lib/time_sink_c_impl.cc +++ b/gr-qtgui/lib/time_sink_c_impl.cc @@ -698,6 +698,7 @@ namespace gr { { size_t len; pmt::pmt_t dict, samples; + std::vector< std::vector<gr::tag_t> > t(1); // Test to make sure this is either a PDU or a uniform vector of // samples. Get the samples PMT and the dictionary if it's a PDU. @@ -714,6 +715,29 @@ namespace gr { "a PDU or a uniform vector of samples."); } + // add tag info if it is present in metadata + if(pmt::is_dict(dict)){ + if(pmt::dict_has_key(dict, pmt::mp("tags"))){ + d_tags.clear(); + pmt::pmt_t tags = pmt::dict_ref(dict, pmt::mp("tags"), pmt::PMT_NIL); + int len = pmt::length(tags); + for(int i=0; i<len; i++){ + // get tag info from list + pmt::pmt_t tup = pmt::vector_ref(tags, i); + int tagval = pmt::to_long(pmt::tuple_ref(tup,0)); + pmt::pmt_t k = pmt::tuple_ref(tup,1); + pmt::pmt_t v = pmt::tuple_ref(tup,2); + + // add the tag + t[0].push_back( gr::tag_t() ); + t[0][t[0].size()-1].offset = tagval; + t[0][t[0].size()-1].key = k; + t[0][t[0].size()-1].value = v; + t[0][t[0].size()-1].srcid = pmt::PMT_NIL; + } + } + } + len = pmt::length(samples); const gr_complex *in; @@ -735,7 +759,6 @@ namespace gr { d_buffers[2*d_nconnections+1], in, len); - std::vector< std::vector<gr::tag_t> > t; d_qApplication->postEvent(d_main_gui, new TimeUpdateEvent(d_buffers, len, t)); } |