AddChunkData
Top  Previous  Next

Description

Adds a chunk data field to the frame buffer.

[C++]

int
 AddChunkData (constant char* frame , constant char* data , int length, 
  unsigned int
 chunkId, unsigned int channelIndex=0);


Parameters
[C/C++]

[in] constant char* frame  
Pointer to the beginning of the frame buffer (image data). Must not be NULL or empty  
 
[in] constant char* data  
Pointer to the chunk data field. Must not be NULL or empty.  
 
[in] int length  
Integer value specifying the size of chunk data in bytes.  
 
[in] unsigned int chunkID  
Integer value specifying the numerical ID of the chunk.  
 
[in] unsigned int channelIndex  
Index of the associated stream channel. Possible values are 0 or 1.  
 

Return Values

S_OK  
Success  
E_FAIL  
Failure  
 
 
Example

This fragment of code creates the "camera temperature" chunk feature, adds a corresponding data field to the frame buffer and sends the frame to the network:
 
      m_pCamera->SetStreamChannelCount(1);
      m_pCamera->SetChunkMode (4,1);

      
m_pCamera->CreateChunkCategory ("ChunkDataControl"
);
m_pCamera->CreateChunkFeature (0xa8dc50a0, "ChunkTemperature", "ChunkDataControl", FEATURE_TYPE_FLOAT, 4, "Camera temperature");  
.........  
m_pCamera->LockFormat();  
buffer=GenerateImageFrame();  
data=GetVirtualTemperature();  
m_pCamera->AddChunkData (buffer, (char*) data, 4, 0xa8dc50a0);  
m_pCamera->AddChunkData (buffer, NULL, imageWidth*imageHeight*BytesPerPixel, 0);  
m_pCamera->SendImage(buffer);  
 

Remarks

This method is used to add chunk data to the frame buffer when the chunk mode is activated. It should be called before the image frame is sent to the network. You can use several calls to AddChunkData to add several chunk fields to the frame. Note that in the chunk mode the very last call to AddChunkData should always be made for the image buffer with the data and chunkID parameters set to zero and length equal to the size of the image in bytes.

For GenICam compatibility It is recommended to associate each chunk data field with a corresponding chunk feature by a prior call to CreateChunkFeature.