Hi Subrata, while what you plan to do is possible if you build a block with a general_work method and a forecast. In fact, here the forecast implementation will probably be pretty crucial, but also be pretty simple -- just always require the same amount of samples from input0 as you're asked to produce output, and don't require anything from input1.
However, I'm pretty certain GNU Radio won't schedule your block as you want to (in fact, I just wrote a minimal test case to verify[1]). My general recommendation would be to write a minimal block that takes a stream and converts it to messages, and passes those to gr-eventstream[2]. gr-eventstream has blocks to do exactly that: produce a zero-signal when there's no (message) input, produce the content of the message input otherwise; you could just take that output and add it to your input1, and be done :) Best regards, Marcus [1] https://github.com/marcusmueller/gr-demo_assymetric_input clone, and run ./qa_prioritizer.py in the python/ folder [2] http://oshearesearch.com/tag/gr-eventstream/ On 28.10.2015 21:26, [email protected] wrote: > I am trying to create a block that has two input and one output. Its like a > priority multiplexer; if input0 is empty then output = input1 else output = > input0 ( input0 always has samples) its a stream based block. > How do I declare the work function, because the number of samples needed from > each input to produce noutput_items depends on whether input0 is empty. > Any help in the general work function is also greatly appreciated. > > Thanks > _______________________________________________ > Discuss-gnuradio mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio _______________________________________________ Discuss-gnuradio mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
