Forum: GNU Radio Modify data inside a blob

Posted by Jose Torres Diaz (Guest)
on 2012-10-08 04:06
(Received via mailing list)
Hi,

I would like to ask about how to modify data inside a block that work 
with
blobs. I've finished a block (let name as "BLOCK_1"), which post message
downstream. In particular, it posts 2 blobs with metadata and data. The
idea is the following:

-----------------
-------------------
| BLOCK_1 |        ---->  post message downstream (blob 1, blob 2 )
---->  | BLOCK_2 |
------------------
-------------------

So, I've finished my BLOCK_1, which post:

this->post_msg(0,blob_1, blob_2), where

blob_1: Metadata that I don't want to modify
blob_2: Data I want to modify

I'm following the examples blob_to_stream, stream_to_blob and
socket_to_blob. However, I am not sure how can I manipulate the data 
(ie.
blob_2) in my BLOCK_2.

For example, I thought something like this in BLOCK_2:

int work(
        const InputItems &input_items,
        const OutputItems &output_items
)

{
  //Loop until a blob is received
  while (_offset==0){ //start of while until a blob is received
  _msg=this->pop_msg_queue(); //Read the blob

//How to manipulate data here from _msg?
//Or can I use just input_items in the work function?

}


Many thanks for your help,

Jose
Posted by Josh Blum (Guest)
on 2012-10-08 20:01
(Received via mailing list)
On 10/07/2012 07:05 PM, Jose Torres Diaz wrote:
> ---->  | BLOCK_2 |
> ------------------
> -------------------
>
> So, I've finished my BLOCK_1, which post:
>
> this->post_msg(0,blob_1, blob_2), where
>
> blob_1: Metadata that I don't want to modify
> blob_2: Data I want to modify
>

Generally, you dont want to modify a message from the upstream. Thats
because this message may be shared by other downstream consumers.

Its best to make a copy of the data into a new blob.

I think you have everything you need between these two header entries:
http://gnuradio.org/cgit/gnuradio.git/tree/gruel/s...
https://github.com/guruofquality/grextras/blob/mas...

-josh
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.