Modify data inside a blob

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

On 10/07/2012 07:05 PM, Jose T. 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/src/include/gruel/pmt.h#n329

-josh