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
#include <arv.h>
#include <stdio.h>

int
main (int argc, char **argv)
{
    ArvCamera *camera;
    ArvStream *stream;
    ArvChunkParser *parser;

    /* Mandatory glib type system initialization */
    arv_g_type_init ();

    /* Instantiation of the first available camera */
    camera = arv_camera_new (NULL);

    if (camera != NULL) {
        gint payload;

        /* Instantiation of a chunk parser */
        parser = arv_camera_create_chunk_parser (camera);

        /* Enable chunk data */
        arv_camera_set_chunks (camera, "Width,Height");

        /* retrieve image payload (number of bytes per image) */
        payload = arv_camera_get_payload (camera);

        /* Create a new stream object */
        stream = arv_camera_create_stream (camera, NULL, NULL);

        if (stream != NULL) {
            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);

            /* Retrieve the acquired buffer */
            buffer = arv_stream_pop_buffer (stream);

            printf ("ChunkWidth = %d\n", (int) arv_chunk_parser_get_integer_value (parser, buffer, "ChunkWidth"));
            printf ("ChunkHeight = %d\n", (int) arv_chunk_parser_get_integer_value (parser, buffer, "ChunkHeight"));

            g_object_unref (buffer);

            /* Stop the video stream */
            arv_camera_stop_acquisition (camera);

            g_object_unref (stream);
        } else
            printf ("Can't create stream thread (check if the device is not already used)\n");

        g_object_unref (parser);
        g_object_unref (camera);
    } else
        printf ("No camera found\n");

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

Gets the value of chunk data as a float.

Parameters

parser

a ArvChunkParser

 

buffer

a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload

 

chunk

chunk data name

 

Returns

the chunk data float value.


arv_chunk_parser_get_integer_value ()

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

Gets the value of chunk data as an integer.

Parameters

parser

a ArvChunkParser

 

buffer

a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload

 

chunk

chunk data name

 

Returns

the chunk data integer value.


arv_chunk_parser_get_string_value ()

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

Gets the value of chunk data as a string.

Parameters

parser

a ArvChunkParser

 

buffer

a ArvBuffer with a ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA payload

 

chunk

chunk data name

 

Returns

the chunk data string value.

Types and Values

ArvChunkParser

typedef struct _ArvChunkParser ArvChunkParser;

Property Details

The “genicam” property

  “genicam”                  ArvGc *

Genicam instance.

Flags: Read / Write / Construct Only