Top |
ArvChunkParser provides a class for the instantiation of chunk parsers used for the extraction of chunk data stored in the stream payload.
Chunks are tagged blocks of data stored in a ArvBuffer containing a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload. The tags allow a chunk parser to dissect the data payload into its elements and to identify the content.
Chunk data are enabled using either arv_camera_set_chunks()
or
arv_camera_set_chunk_mode()
. Both functions are simple convenience wrappers
that handle the setting of ChunkModeActive, ChunkSelector and ChunkEnable
GENICAM features.
Example 2. Example use of the ArvChunkParser API
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
#include <arv.h> #include <stdio.h> int main (int argc, char **argv) { ArvCamera *camera; ArvStream *stream; ArvChunkParser *parser; GError *error =NULL; /* Instantiation of the first available camera */ camera = arv_camera_new (NULL, &error); if (ARV_IS_CAMERA (camera)) { gint payload; /* Instantiation of a chunk parser */ parser = arv_camera_create_chunk_parser (camera); /* Enable chunk data */ arv_camera_set_chunks (camera, "Width,Height", NULL); /* retrieve image payload (number of bytes per image) */ payload = arv_camera_get_payload (camera, NULL); /* Create a new stream object */ stream = arv_camera_create_stream (camera, NULL, NULL, &error); if (ARV_IS_STREAM (stream)) { ArvBuffer *buffer; /* Push 1 buffer in the stream input buffer queue */ arv_stream_push_buffer (stream, arv_buffer_new (payload, NULL)); /* Start the video stream */ arv_camera_start_acquisition (camera, NULL); /* Retrieve the acquired buffer */ buffer = arv_stream_pop_buffer (stream); printf ("ChunkWidth = %d\n", (int) arv_chunk_parser_get_integer_value (parser, buffer, "ChunkWidth", NULL)); printf ("ChunkHeight = %d\n", (int) arv_chunk_parser_get_integer_value (parser, buffer, "ChunkHeight", NULL)); g_object_unref (buffer); /* Stop the video stream */ arv_camera_stop_acquisition (camera, NULL); g_object_unref (stream); } else { printf ("Can't create stream thread%s%s\n", error != NULL ? ": " : "", error != NULL ? error->message: ""); g_clear_error (&error); } g_object_unref (parser); g_object_unref (camera); } else { printf ("No camera found%s%s\n", error != NULL ? ": " : "", error != NULL ? error->message: ""); g_clear_error (&error); } return 0; } |
ArvChunkParser * arv_chunk_parser_new (const char *xml
,gsize size
);
Creates a new chunk_parser.
Since: 0.4.0
double arv_chunk_parser_get_float_value (ArvChunkParser *parser
,ArvBuffer *buffer
,const char *chunk
,GError **error
);
parser |
||
buffer |
a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload |
|
chunk |
chunk data name |
|
error |
a GError placeholder |
gint64 arv_chunk_parser_get_integer_value (ArvChunkParser *parser
,ArvBuffer *buffer
,const char *chunk
,GError **error
);
parser |
||
buffer |
a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload |
|
chunk |
chunk data name |
|
error |
a GError placeholder |
gboolean arv_chunk_parser_get_boolean_value (ArvChunkParser *parser
,ArvBuffer *buffer
,const char *chunk
,GError **error
);
parser |
||
buffer |
a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload |
|
chunk |
chunk data name |
|
error |
a GError placeholder |
const char * arv_chunk_parser_get_string_value (ArvChunkParser *parser
,ArvBuffer *buffer
,const char *chunk
,GError **error
);
parser |
||
buffer |
a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload |
|
chunk |
chunk data name |
|
error |
a GError placeholder |
“genicam”
property“genicam” ArvGc *
Internal Genicam object
Owner: ArvChunkParser
Flags: Read / Write / Construct Only
Stability Level: Private