diff options
author | Matt Ettus | 2009-11-26 11:20:30 -0800 |
---|---|---|
committer | Matt Ettus | 2009-11-26 11:20:30 -0800 |
commit | 770ee2b2b3e53f9b4d4e1d09bbf2c87b579ba4c4 (patch) | |
tree | 6f498d810f2fb3f2d7894d625a58b7ec9909c92c | |
parent | 7081879769829e49623adb68dc8c228082a91dda (diff) | |
parent | cc2e4dcc71648f1c981ab236efbae7739499728f (diff) | |
download | gnuradio-770ee2b2b3e53f9b4d4e1d09bbf2c87b579ba4c4.tar.gz gnuradio-770ee2b2b3e53f9b4d4e1d09bbf2c87b579ba4c4.tar.bz2 gnuradio-770ee2b2b3e53f9b4d4e1d09bbf2c87b579ba4c4.zip |
Merge branch 'master' of http://gnuradio.org/git/gnuradio
-rw-r--r-- | vrt/lib/expanded_header.cc | 6 | ||||
-rw-r--r-- | vrt/lib/rx.cc | 36 |
2 files changed, 20 insertions, 22 deletions
diff --git a/vrt/lib/expanded_header.cc b/vrt/lib/expanded_header.cc index 0eb2042d8..bd1d92e53 100644 --- a/vrt/lib/expanded_header.cc +++ b/vrt/lib/expanded_header.cc @@ -112,12 +112,6 @@ namespace vrt { #include "expanded_header_switch_body.h" } - /* is this a if context packet? */ - if (h->if_context_p()){ - *payload = p; - *n32_bit_words_payload = n32_bit_words_packet; - } - return true; } diff --git a/vrt/lib/rx.cc b/vrt/lib/rx.cc index f75db3111..2d741e908 100644 --- a/vrt/lib/rx.cc +++ b/vrt/lib/rx.cc @@ -30,7 +30,7 @@ #include <stdexcept> static void -print_words(FILE *fp, size_t offset, uint32_t *buf, size_t n) +print_words(FILE *fp, size_t offset, const uint32_t *buf, size_t n) { size_t i; for (i = 0; i < n; i++){ @@ -85,27 +85,31 @@ namespace vrt { vrt_data_handler::~vrt_data_handler(){} + // N.B., There may be more than 1 VRT packet in a frame (usually IF-Context packets) data_handler::result vrt_data_handler::operator()(const void *base, size_t len) { -#if 0 - print_words(0, (uint32_t *)base, len/(sizeof(uint32_t))); - return 0; -#else - const uint32_t *payload; - size_t n32_bit_words; - expanded_header hdr; - if (!expanded_header::parse((const uint32_t*) base, len/(sizeof(uint32_t)), - &hdr, &payload, &n32_bit_words)){ - if (1){ - fprintf(stderr, "vrt_data_handler: malformed VRT packet!\n"); - print_words(stderr, 0, (uint32_t *)base, len/(sizeof(uint32_t))); + const uint32_t *word_base = (const uint32_t *) base; + size_t word_len = len/(sizeof(uint32_t)); + + bool want_more = true; + while (word_len > 0 && want_more){ + const uint32_t *payload; + size_t n32_bit_words; + expanded_header hdr; + if (!expanded_header::parse(word_base, word_len, + &hdr, &payload, &n32_bit_words)){ + if (1){ + fprintf(stderr, "vrt_data_handler: malformed VRT packet!\n"); + print_words(stderr, 0, word_base, word_len); + } + return 0; } - return 0; + want_more = (*d_handler)(payload, n32_bit_words, &hdr); + word_base += hdr.pkt_size(); + word_len -= hdr.pkt_size(); } - bool want_more = (*d_handler)(payload, n32_bit_words, &hdr); return !want_more ? data_handler::DONE : 0; -#endif } |