Thursday, July 9, 2015

Re: [Discuss-gnuradio] Question about the "ninput_items"

Hi Zswx,

ninput_items[0] is really the number of items that you can consume in a work call (on input stream 0). It's usually > 1.

Best regards,
Marcus

On 07/09/2015 03:29 PM, zs wrote:
Hi,

    Thank you in advance.I have a question about the "ninput_items".I find the meaning of it is "vector of items available on all input buffers".

    When I read the source code of "crc32_bb_impl.cc",I see the code below,

"
int
 65     crc32_bb_impl::work (int noutput_items,
 66                        gr_vector_int &ninput_items,
 67                        gr_vector_const_void_star &input_items,
 68                        gr_vector_void_star &output_items)
 69     {
 70       const unsigned char *in = (const unsigned char *) input_items[0];
 71       unsigned char *out = (unsigned char *) output_items[0];
 72       long packet_length = ninput_items[0];
"
I think the ninput_items[0]=1,because the item input is 1 every times.But when I write the code "std::cout<<ninput_items[0]<<std::endl;",It display the packet_length.I think the ninput_items[0]=1 no matter what pack_length is.Why I'm wrong?


Thank you.
Best regards,
zswx




_______________________________________________  Discuss-gnuradio mailing list  Discuss-gnuradio@gnu.org  https://lists.gnu.org/mailman/listinfo/discuss-gnuradio  

No comments:

Post a Comment