Migrating box code from 0.18.x to 1.0.0


OpenViBE boxes use decoders and encoders to pass data in and out the box (you can see details here).

Bad news: The interface of all the codecs has slightly changed in 1.0.0 for clarity and to force correct usage. Old code no longer compiles.

Good news: it is really straightforward to update your old code to 1.0.

What to do

Each decoder and encoder only works correctly for a single box input or output connector. Hence, the natural place to associate the codec with a connector is in the initializer of the coder. In the old interface, you had to specify the connector index in the decoding and encoding calls. This is no longer the case, and hence compiling old code will result in errors.

Here is an example of the new usage with a single decoder,

// In box::initialize(),

  m_oStreamDecoder.initialize(*this,0);  // use input connector 0 here

// In box::process()
  IBoxIO& l_rDynamicBoxContext=this->getDynamicBoxContext();
  for(uint32 i=0; i<l_rDynamicBoxContext.getInputChunkCount(0); i++)

      // input characteristics are known now

      // we have a new chunk of data

      // no more stuff will arrive


// in box::uninitialize()


For encoders, the usage is similar: you no longer insert the output index as a part of the encode() call.

Be really careful when updating the decode() calls to NOT call the function with integers. Due to C++ accepting integer as a boolean, an integer will unfortunately be interpreted as a boolean parameter that is used to control deprecation of the chunks.

This entry was posted in Version migration instructions. Bookmark the permalink.