On Sun, Oct 07, 2007 at 04:09:48PM -0700, seph 004 wrote:
I was wondering if someone could perhaps clarify how the gr_message_sink works . I’m trying to make a modified version of the fft_sink. I noticed that the sample stream is turned into a vector streasm and then sent to a message sink.
When the data is unpacked from the messages, then it seems there
are a varying number of fft frames in each message. How does this
happen? Why isn’t there only one frame per message?
It builds a message that contains however many items were handed it by
work. It could be changed such that each item was placed into it’s
own message, but that didn’t seem to make sense. Consider what would
happen if the items were floats.
Also, what exactly are msg.arg(1) and msg.arg(2). Are they part of
the message payload or part a special frame? Lastly, what does
A quick look at the source:
const char *in = (const char *) input_items;
// if we’d block, drop the data on the floor and say everything is OK
if (d_dont_block && d_msgq->full_p())
// build a message to hold whatever we’ve got
gr_message_sptr msg = gr_make_message(0, // msg type
d_itemsize, // arg1 for other end
noutput_items, // arg2 for other end (redundant)
noutput_items * d_itemsize); // len of msg
memcpy(msg->msg(), in, noutput_items * d_itemsize);
d_msgq->handle(msg); // send it