ArvChunkParser

ArvChunkParser — Parser for extraction of chunk data from buffers

Functions

Properties

ArvGc * genicam Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── ArvChunkParser

Description

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;
}

Functions

arv_chunk_parser_new ()

ArvChunkParser *
arv_chunk_parser_new (const char *xml,
                      gsize size);

Creates a new chunk_parser.

Parameters

xml

XML genicam data

 

size

genicam data size, -1 if NULL terminated

 

Returns

a new ArvChunkParser object

Since: 0.4.0


arv_chunk_parser_get_float_value ()

double
arv_chunk_parser_get_float_value (ArvChunkParser *parser,
                                  ArvBuffer *buffer,
                                  const char *chunk,
                                  GError **error);

Parameters

parser

a ArvChunkParser

 

buffer

a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload

 

chunk

chunk data name

 

error

a GError placeholder

 

Returns

the float chunk data value.


arv_chunk_parser_get_integer_value ()

gint64
arv_chunk_parser_get_integer_value (ArvChunkParser *parser,
                                    ArvBuffer *buffer,
                                    const char *chunk,
                                    GError **error);

Parameters

parser

a ArvChunkParser

 

buffer

a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload

 

chunk

chunk data name

 

error

a GError placeholder

 

Returns

the integer chunk data integer.


arv_chunk_parser_get_boolean_value ()

gboolean
arv_chunk_parser_get_boolean_value (ArvChunkParser *parser,
                                    ArvBuffer *buffer,
                                    const char *chunk,
                                    GError **error);

Parameters

parser

a ArvChunkParser

 

buffer

a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload

 

chunk

chunk data name

 

error

a GError placeholder

 

Returns

the boolean chunk data value.


arv_chunk_parser_get_string_value ()

const char *
arv_chunk_parser_get_string_value (ArvChunkParser *parser,
                                   ArvBuffer *buffer,
                                   const char *chunk,
                                   GError **error);

Parameters

parser

a ArvChunkParser

 

buffer

a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload

 

chunk

chunk data name

 

error

a GError placeholder

 

Returns

the string chunk data value.

Types and Values

ARV_CHUNK_PARSER_ERROR

#define ARV_CHUNK_PARSER_ERROR arv_chunk_parser_error_quark()

enum ArvChunkParserError

Members

ARV_CHUNK_PARSER_ERROR_INVALID_FEATURE_TYPE

invalid feature type

 

ARV_CHUNK_PARSER_ERROR_BUFFER_NOT_FOUND

a buffer is not attached to the chunk parser

 

ARV_CHUNK_PARSER_ERROR_CHUNK_NOT_FOUND

the requested chunk is not found in the buffer data

 

ArvChunkParser

typedef struct _ArvChunkParser ArvChunkParser;

Property Details

The “genicam” property

  “genicam”                  ArvGc *

Internal Genicam object

Owner: ArvChunkParser

Flags: Read / Write / Construct Only

Stability Level: Private