Access and modification of the stream header.

Making & changing box plugins and external apps
Post Reply
glio
Posts: 10
Joined: Thu Mar 05, 2009 8:33 am
Location: Grenoble

Access and modification of the stream header.

Post by glio »

Hello,

I'm currently working on two boxes with two signal streams in entry, and one signal stream for the output.
If all the signal processing procedure is working reasonably well, I have a problem to create the new header for the output of the boxes.

After the decoding procedure, I can access for each input to the sampling rate and to an handler for a header, data or an ender.
If working with data is working well, how I can access to information as the channels name, the size of the chunks...
And how can I use the information presented at the two input to create a new header for the output ?

Thanks a lot.

Guillaume.

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Access and modification of the stream header.

Post by yrenard »

Dear glio,

what do header is expected to be sent based on the two input headers your box receives ?

In short, what should you box do ?

Yann

glio
Posts: 10
Joined: Thu Mar 05, 2009 8:33 am
Location: Grenoble

Re: Access and modification of the stream header.

Post by glio »

Hello,

For example, the simplest box is a Signal Stream Concatenation Box.

If we have two streams with the same sampling rate in input :

Stream 1 - Channel 0 - Channel name : FP1
Stream 1 - Channel 1 - Channel name : FPz
Stream 1 - Channel 2 - Channel name : FP2

Stream 2 - Channel 0 - Channel name : Coord_X
Stream 2 - Channel 1 - Channel name : Coord_Y

I want to concatenate the two streams in one at the output :

Stream 3 - Channel 0 - Channel name : FP1
Stream 3 - Channel 1 - Channel name : FPz
Stream 3 - Channel 2 - Channel name : FP2
Stream 3 - Channel 3 - Channel name : Coord_X
Stream 3 - Channel 4 - Channel name : Coord_Y

So for each chunk at the inputs of the box, after the decoding procedure, I can identify if the
chunk is :
an header

Code: Select all

isOutputTriggerActive(OVP_GD_Algorithm_SignalStreamDecoder_OutputTriggerId_ReceivedHeader)
a buffer

Code: Select all

isOutputTriggerActive(OVP_GD_Algorithm_SignalStreamDecoder_OutputTriggerId_ReceivedBuffer)
or an ender

Code: Select all

isOutputTriggerActive(OVP_GD_Algorithm_SignalStreamDecoder_OutputTriggerId_ReceivedEnd
If chunks are buffers, I can access to the data and launch the concatenation procedure :

Code: Select all

op_pEncodedMemoryBuffer=l_pDynamicBoxContext->getOutputChunk(0);
m_pSignalEncoder->process(OVP_GD_Algorithm_SignalStreamEncoder_InputTriggerId_EncodeBuffer);
But, if chunks are headers I must extract from the headers the channels names, to create then a new header with all the channels names for the output stream.
Do you have any idea to how I can access to this kind of stream parameters ?

Thank you,

Guillaume.

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: Access and modification of the stream header.

Post by yrenard »

Dear glio,

this information is available in the OpenViBE::IMatrix itself. After the header has been decoded, you can get the matrix' dimension count, dimension size(s) and dimension name(s).

Hope this helps,
Best regards,
Yann

glio
Posts: 10
Joined: Thu Mar 05, 2009 8:33 am
Location: Grenoble

Re: Access and modification of the stream header.

Post by glio »

Ok,

Code: Select all

virtual const char * 	getDimensionLabel  (const OpenViBE::uint32  ui32DimensionIndex, const OpenViBE::uint32  ui32DimensionEntryIndex) const =0
 	Gets the dimension label for a given dimension index / dimension entry index pair. 
and

Code: Select all

virtual OpenViBE::boolean 	setDimensionLabel  (const OpenViBE::uint32  ui32DimensionIndex, const OpenViBE::uint32  ui32DimensionEntryIndex, const char *sDimensionLabel)=0
 	Sets the dimension label for this matrix on a given dimension index / dimension entry index pair. 
Thank you ! This is perfect.

Post Reply