Hey Merlin,

> The tagged_stream_mux uses the packet_len tags to determine the input
> lengths. It outputs a new packet_len that is the sum of the input
> packet_lens. So here you also loose information about the streams that were
> muxed.
>
> What sense would the standard tag propagation make in this case?

I have adjusted the tag propagation policy to at match least your example. But
it should be able to handle tag propagation in general preserving tag position
relative to its original stream.

If you have installed GNU Radio from git-master you should be able to apply
this patch and compile GNU Radio with it. I will submit a pull request, maybe
this patch will be in master soon.

Best Regards,
Andrej


From 512bd5d2b082807c6687a546d5fe096c9c9b7af6 Mon Sep 17 00:00:00 2001
From: Andrej Rode <[email protected]>
Date: Mon, 25 Apr 2016 14:33:17 +0200
Subject: [PATCH] gr-blocks: fix tag propagation policy for stream mux block

---
 gr-blocks/lib/stream_mux_impl.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gr-blocks/lib/stream_mux_impl.cc b/gr-blocks/lib/stream_mux_impl.cc
index 698cf89..4d5e71b 100644
--- a/gr-blocks/lib/stream_mux_impl.cc
+++ b/gr-blocks/lib/stream_mux_impl.cc
@@ -53,6 +53,7 @@ namespace gr {
         }
       }
       d_residual = d_lengths[d_stream];
+      set_tag_propagation_policy(TPP_DONT);
     }

     void
@@ -76,6 +77,7 @@ namespace gr {
       const char *in;
       int out_index = 0; // Items written
       gr_vector_int input_index(d_lengths.size(), 0); // Items read
+      std::vector<gr::tag_t> stream_t;

       while (out_index < noutput_items) {
         if (ninput_items[d_stream] <= input_index[d_stream]) {
@@ -91,6 +93,12 @@ namespace gr {
         );
         in = (const char *) input_items[d_stream] + input_index[d_stream]*d_itemsize;
         memcpy(&out[out_index*d_itemsize], in, items_to_copy*d_itemsize);
+        get_tags_in_window(stream_t, d_stream,input_index[d_stream],input_index[d_stream] + items_to_copy);
+        BOOST_FOREACH(gr::tag_t t, stream_t){
+          t.offset = t.offset - nitems_read(d_stream) - input_index[d_stream] + nitems_written(0) + out_index;
+          add_item_tag(0, t);
+        }
+
         out_index += items_to_copy;
         input_index[d_stream] += items_to_copy;
         d_residual -= items_to_copy;
--
2.7.3

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to