ArvBuffer

ArvBuffer — Buffer for storage of video frames

Functions

Types and Values

enum ArvBufferStatus
  ArvBuffer
enum ArvBufferPayloadType
typedef ArvPixelFormat
#define ARV_PIXEL_FORMAT_BAYER_BG_10
#define ARV_PIXEL_FORMAT_BAYER_BG_12
#define ARV_PIXEL_FORMAT_BAYER_GR_12_PACKED
#define ARV_PIXEL_FORMAT_BAYER_GB_12_PACKED
#define ARV_PIXEL_FORMAT_BAYER_RG_12_PACKED
#define ARV_PIXEL_FORMAT_BAYER_BG_12_PACKED
#define ARV_PIXEL_FORMAT_BAYER_BG_8
#define ARV_PIXEL_FORMAT_BAYER_GB_10
#define ARV_PIXEL_FORMAT_BAYER_GB_12
#define ARV_PIXEL_FORMAT_BAYER_GB_8
#define ARV_PIXEL_FORMAT_BAYER_GR_10
#define ARV_PIXEL_FORMAT_BAYER_GR_12
#define ARV_PIXEL_FORMAT_BAYER_GR_8
#define ARV_PIXEL_FORMAT_BAYER_RG_10
#define ARV_PIXEL_FORMAT_BAYER_RG_12
#define ARV_PIXEL_FORMAT_BAYER_RG_8
#define ARV_PIXEL_FORMAT_BAYER_BG_16
#define ARV_PIXEL_FORMAT_BAYER_GB_16
#define ARV_PIXEL_FORMAT_BAYER_GR_16
#define ARV_PIXEL_FORMAT_BAYER_RG_16
#define ARV_PIXEL_FORMAT_BGRA_8_PACKED
#define ARV_PIXEL_FORMAT_BGR_10_PACKED
#define ARV_PIXEL_FORMAT_BGR_12_PACKED
#define ARV_PIXEL_FORMAT_BGR_8_PACKED
#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_BG_12_PACKED
#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_BG_16
#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_GB_12_PACKED
#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_GB_16
#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_GR_12_PACKED
#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_GR_16
#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_RG_12_PACKED
#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_RG_16
#define ARV_PIXEL_FORMAT_CUSTOM_YUV_422_YUYV_PACKED
#define ARV_PIXEL_FORMAT_MONO_10
#define ARV_PIXEL_FORMAT_MONO_10_PACKED
#define ARV_PIXEL_FORMAT_MONO_12
#define ARV_PIXEL_FORMAT_MONO_12_PACKED
#define ARV_PIXEL_FORMAT_MONO_14
#define ARV_PIXEL_FORMAT_MONO_16
#define ARV_PIXEL_FORMAT_MONO_8
#define ARV_PIXEL_FORMAT_MONO_8_SIGNED
#define ARV_PIXEL_FORMAT_RGBA_8_PACKED
#define ARV_PIXEL_FORMAT_RGB_10_PACKED
#define ARV_PIXEL_FORMAT_RGB_10_PLANAR
#define ARV_PIXEL_FORMAT_RGB_12_PACKED
#define ARV_PIXEL_FORMAT_RGB_12_PLANAR
#define ARV_PIXEL_FORMAT_RGB_16_PLANAR
#define ARV_PIXEL_FORMAT_RGB_8_PACKED
#define ARV_PIXEL_FORMAT_RGB_8_PLANAR
#define ARV_PIXEL_FORMAT_YUV_411_PACKED
#define ARV_PIXEL_FORMAT_YUV_422_PACKED
#define ARV_PIXEL_FORMAT_YUV_422_YUYV_PACKED
#define ARV_PIXEL_FORMAT_YUV_444_PACKED

Object Hierarchy

    GObject
    ╰── ArvBuffer

Description

ArvBuffer provides a class for the instantiation of buffers used for the storage of the separate images of the video stream. The actual data space may either be allocated by ArvBuffer during an object instatiation, of preallocated. ArvBuffer also allows the transmission of image metadata, such as offsets and size of the transmitted region of interrest, pixel format and time stamp.

Functions

ArvFrameCallback ()

void
(*ArvFrameCallback) (ArvBuffer *buffer);

arv_buffer_new ()

ArvBuffer *
arv_buffer_new (size_t size,
                void *preallocated);

Creates a new buffer for the storage of the video stream images. The data space can be either preallocated, and the caller is responsible for it's deallocation, or allocated by this function. If it is the case, data memory will be freed when the buffer is destroyed.

Parameters

size

payload size

 

preallocated

preallocated memory buffer.

[transfer none]

Returns

a new ArvBuffer object

Since: 0.2.0


arv_buffer_new_full ()

ArvBuffer *
arv_buffer_new_full (size_t size,
                     void *preallocated,
                     void *user_data,
                     GDestroyNotify user_data_destroy_func);

Creates a new buffer for the storage of the video stream images. The data space can be either preallocated, and the caller is responsible for it's deallocation, or allocated by this function. If it is the case, data memory will be freed when the buffer is destroyed.

If user_data_destroy_func is non NULL, it will be called in order to destroy user_data when the buffer is destroyed.

Parameters

size

payload size

 

preallocated

preallocated memory buffer.

[transfer none]

user_data

a pointer to user data associated to this buffer.

[transfer none]

user_data_destroy_func

an optional user data destroy callback

 

Returns

a new ArvBuffer object

Since: 0.2.0


arv_buffer_new_allocate ()

ArvBuffer *
arv_buffer_new_allocate (size_t size);

Creates a new buffer for the storage of the video stream images. The data space is allocated by this function, and will be freed when the buffer is destroyed.

Parameters

size

payload size

 

Returns

a new ArvBuffer object

Since: 0.2.3


arv_buffer_get_user_data ()

const void *
arv_buffer_get_user_data (ArvBuffer *buffer);

Gets a pointer to user data set by arv_buffer_new_full.

Parameters

buffer

a ArvBuffer

 

Returns

user data, or NULL if not set.

Since: 0.4.0


arv_buffer_get_data ()

const void *
arv_buffer_get_data (ArvBuffer *buffer,
                     size_t *size);

Buffer data accessor.

Parameters

buffer

a ArvBuffer

 

size

location to store data size, or NULL.

[allow-none]

Returns

a pointer to the buffer data.

[array length=size][element-type guint8]

Since: 0.4.0


arv_buffer_get_chunk_data ()

const void *
arv_buffer_get_chunk_data (ArvBuffer *buffer,
                           guint64 chunk_id,
                           size_t *size);

Chunk data accessor.

Parameters

buffer

a ArvBuffer

 

chunk_id

chunk id

 

size

location to store chunk data size, or NULL.

[allow-none]

Returns

a pointer to the chunk data.

[array length=size][element-type guint8]

Since: 0.4.0


arv_buffer_get_timestamp ()

guint64
arv_buffer_get_timestamp (ArvBuffer *buffer);

Gets the buffer camera timestamp, expressed as nanoseconds. Not all devices provide reliable timestamp, which means sometimes its better to rely on the buffer completion host local time (given by g_get_realtime for example).

Parameters

buffer

a ArvBuffer

 

Returns

buffer timestamp, in nanoseconds.

Since: 0.4.0


arv_buffer_set_timestamp ()

void
arv_buffer_set_timestamp (ArvBuffer *buffer,
                          guint64 timestamp_ns);

Sets the buffer timestamp, which allows to override the timpestamp set by the camera, which in some case is incorrect.

Parameters

buffer

a ArvBuffer

 

timestamp_ns

a timestamp, expressed as nanoseconds

 

Since: 0.4.0


arv_buffer_get_frame_id ()

guint32
arv_buffer_get_frame_id (ArvBuffer *buffer);

Gets the buffer frame id. For GigEVision devices, valid values are in the 1..65535 range.

Parameters

buffer

a ArvBuffer

 

Returns

frame id, 0 on error.

Since: 0.4.0


arv_buffer_get_payload_type ()

ArvBufferPayloadType
arv_buffer_get_payload_type (ArvBuffer *buffer);

Gets the buffer payload type.

Parameters

buffer

a ArvBuffer

 

Returns

payload type.

Since: 0.4.0


arv_buffer_get_status ()

ArvBufferStatus
arv_buffer_get_status (ArvBuffer *buffer);

Gets the buffer acquisition status.

Parameters

buffer

a ArvBuffer

 

Returns

buffer acquisition status.

Since: 0.4.0


arv_buffer_get_image_height ()

gint
arv_buffer_get_image_height (ArvBuffer *buffer);

Gets the image width. This function must only be called on buffer containing a ARV_BUFFER_PAYLOAD_TYPE_IMAGE payload.

Parameters

buffer

a ArvBuffer

 

Returns

image height, in pixels.

Since: 0.4.0


arv_buffer_get_image_pixel_format ()

ArvPixelFormat
arv_buffer_get_image_pixel_format (ArvBuffer *buffer);

Gets the image pixel format. This function must only be called on buffer containing a ARV_BUFFER_PAYLOAD_TYPE_IMAGE payload.

Parameters

buffer

a ArvBuffer

 

Returns

image pixel format.

Since: 0.4.0


arv_buffer_get_image_region ()

void
arv_buffer_get_image_region (ArvBuffer *buffer,
                             gint *x,
                             gint *y,
                             gint *width,
                             gint *height);

Gets the image region. This function must only be called on buffer containing a ARV_BUFFER_PAYLOAD_TYPE_IMAGE payload.

Parameters

buffer

a ArvBuffer

 

x

image x offset placeholder.

[allow-none]

y

image y offset placeholder.

[allow-none]

width

image width placholder.

[allow-none]

height

image height placeholder.

[allow-none]

Since: 0.4.0


arv_buffer_get_image_width ()

gint
arv_buffer_get_image_width (ArvBuffer *buffer);

Gets the image width. This function must only be called on buffer containing a ARV_BUFFER_PAYLOAD_TYPE_IMAGE payload.

Parameters

buffer

a ArvBuffer

 

Returns

image width, in pixels.

Since: 0.4.0


arv_buffer_get_image_x ()

gint
arv_buffer_get_image_x (ArvBuffer *buffer);

Gets the image x offset. This function must only be called on buffer containing a ARV_BUFFER_PAYLOAD_TYPE_IMAGE payload.

Parameters

buffer

a ArvBuffer

 

Returns

image x offset, in pixels.

Since: 0.4.0


arv_buffer_get_image_y ()

gint
arv_buffer_get_image_y (ArvBuffer *buffer);

Gets the image y offset. This function must only be called on buffer containing a ARV_BUFFER_PAYLOAD_TYPE_IMAGE payload.

Parameters

buffer

a ArvBuffer

 

Returns

image y offset, in pixels.

Since: 0.4.0


ARV_PIXEL_FORMAT_BIT_PER_PIXEL()

#define ARV_PIXEL_FORMAT_BIT_PER_PIXEL(pixel_format) (((pixel_format) >> 16) & 0xff)

Types and Values

enum ArvBufferStatus

Members

ARV_BUFFER_STATUS_UNKNOWN

unknown status

 

ARV_BUFFER_STATUS_SUCCESS

the buffer contains a valid image

 

ARV_BUFFER_STATUS_CLEARED

the buffer is cleared

 

ARV_BUFFER_STATUS_TIMEOUT

timeout was reached before all packets are received

 

ARV_BUFFER_STATUS_MISSING_PACKETS

stream has missing packets

 

ARV_BUFFER_STATUS_WRONG_PACKET_ID

stream has packet with wrong id

 

ARV_BUFFER_STATUS_SIZE_MISMATCH

the received image didn't fit in the buffer data space

 

ARV_BUFFER_STATUS_FILLING

the image is currently being filled

 

ARV_BUFFER_STATUS_ABORTED

the filling was aborted before completion

 

ArvBuffer

typedef struct _ArvBuffer ArvBuffer;

enum ArvBufferPayloadType

Members

ARV_BUFFER_PAYLOAD_TYPE_UNKNOWN

unknown payload type

 

ARV_BUFFER_PAYLOAD_TYPE_IMAGE

image data

 

ARV_BUFFER_PAYLOAD_TYPE_RAWDATA

raw data

 

ARV_BUFFER_PAYLOAD_TYPE_FILE

file

 

ARV_BUFFER_PAYLOAD_TYPE_CHUNK_DATA

chunk data

 

ARV_BUFFER_PAYLOAD_TYPE_EXTENDED_CHUNK_DATA

extended chunk data

 

ARV_BUFFER_PAYLOAD_TYPE_JPEG

JPEG data

 

ARV_BUFFER_PAYLOAD_TYPE_JPEG2000

JPEG2000 data

 

ARV_BUFFER_PAYLOAD_TYPE_H264

h264 data

 

ARV_BUFFER_PAYLOAD_TYPE_MULTIZONE_IMAGE

multizone image

 

ArvPixelFormat

typedef guint32 ArvPixelFormat;

ARV_PIXEL_FORMAT_BAYER_BG_10

#define ARV_PIXEL_FORMAT_BAYER_BG_10		0x0110000f

ARV_PIXEL_FORMAT_BAYER_BG_12

#define ARV_PIXEL_FORMAT_BAYER_BG_12		0x01100013

ARV_PIXEL_FORMAT_BAYER_GR_12_PACKED

#define ARV_PIXEL_FORMAT_BAYER_GR_12_PACKED 0x010c002a

ARV_PIXEL_FORMAT_BAYER_GB_12_PACKED

#define ARV_PIXEL_FORMAT_BAYER_GB_12_PACKED 0x010c002c

ARV_PIXEL_FORMAT_BAYER_RG_12_PACKED

#define ARV_PIXEL_FORMAT_BAYER_RG_12_PACKED 0x010c002b

ARV_PIXEL_FORMAT_BAYER_BG_12_PACKED

#define ARV_PIXEL_FORMAT_BAYER_BG_12_PACKED 0x010c002d

ARV_PIXEL_FORMAT_BAYER_BG_8

#define ARV_PIXEL_FORMAT_BAYER_BG_8		0x0108000b

ARV_PIXEL_FORMAT_BAYER_GB_10

#define ARV_PIXEL_FORMAT_BAYER_GB_10		0x0110000e

ARV_PIXEL_FORMAT_BAYER_GB_12

#define ARV_PIXEL_FORMAT_BAYER_GB_12		0x01100012

ARV_PIXEL_FORMAT_BAYER_GB_8

#define ARV_PIXEL_FORMAT_BAYER_GB_8		0x0108000a

ARV_PIXEL_FORMAT_BAYER_GR_10

#define ARV_PIXEL_FORMAT_BAYER_GR_10		0x0110000c

ARV_PIXEL_FORMAT_BAYER_GR_12

#define ARV_PIXEL_FORMAT_BAYER_GR_12		0x01100010

ARV_PIXEL_FORMAT_BAYER_GR_8

#define ARV_PIXEL_FORMAT_BAYER_GR_8		0x01080008

ARV_PIXEL_FORMAT_BAYER_RG_10

#define ARV_PIXEL_FORMAT_BAYER_RG_10		0x0110000d

ARV_PIXEL_FORMAT_BAYER_RG_12

#define ARV_PIXEL_FORMAT_BAYER_RG_12		0x01100011

ARV_PIXEL_FORMAT_BAYER_RG_8

#define ARV_PIXEL_FORMAT_BAYER_RG_8		0x01080009

ARV_PIXEL_FORMAT_BAYER_BG_16

#define ARV_PIXEL_FORMAT_BAYER_BG_16		0x01100031

ARV_PIXEL_FORMAT_BAYER_GB_16

#define ARV_PIXEL_FORMAT_BAYER_GB_16		0x01100030

ARV_PIXEL_FORMAT_BAYER_GR_16

#define ARV_PIXEL_FORMAT_BAYER_GR_16		0x0110002e

ARV_PIXEL_FORMAT_BAYER_RG_16

#define ARV_PIXEL_FORMAT_BAYER_RG_16		0x0110002f

ARV_PIXEL_FORMAT_BGRA_8_PACKED

#define ARV_PIXEL_FORMAT_BGRA_8_PACKED		0x02200017

ARV_PIXEL_FORMAT_BGR_10_PACKED

#define ARV_PIXEL_FORMAT_BGR_10_PACKED		0x02300019

ARV_PIXEL_FORMAT_BGR_12_PACKED

#define ARV_PIXEL_FORMAT_BGR_12_PACKED		0x0230001b

ARV_PIXEL_FORMAT_BGR_8_PACKED

#define ARV_PIXEL_FORMAT_BGR_8_PACKED		0x02180015

ARV_PIXEL_FORMAT_CUSTOM_BAYER_BG_12_PACKED

#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_BG_12_PACKED  	0x810c0004

ARV_PIXEL_FORMAT_CUSTOM_BAYER_BG_16

#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_BG_16		0x81100009

ARV_PIXEL_FORMAT_CUSTOM_BAYER_GB_12_PACKED

#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_GB_12_PACKED  	0x810c0003

ARV_PIXEL_FORMAT_CUSTOM_BAYER_GB_16

#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_GB_16		0x81100008

ARV_PIXEL_FORMAT_CUSTOM_BAYER_GR_12_PACKED

#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_GR_12_PACKED  	0x810c0001

ARV_PIXEL_FORMAT_CUSTOM_BAYER_GR_16

#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_GR_16		0x81100006

ARV_PIXEL_FORMAT_CUSTOM_BAYER_RG_12_PACKED

#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_RG_12_PACKED  	0x810c0002

ARV_PIXEL_FORMAT_CUSTOM_BAYER_RG_16

#define ARV_PIXEL_FORMAT_CUSTOM_BAYER_RG_16		0x81100007

ARV_PIXEL_FORMAT_CUSTOM_YUV_422_YUYV_PACKED

#define ARV_PIXEL_FORMAT_CUSTOM_YUV_422_YUYV_PACKED 	0x82100005

ARV_PIXEL_FORMAT_MONO_10

#define ARV_PIXEL_FORMAT_MONO_10		0x01100003

ARV_PIXEL_FORMAT_MONO_10_PACKED

#define ARV_PIXEL_FORMAT_MONO_10_PACKED		0x010c0004

ARV_PIXEL_FORMAT_MONO_12

#define ARV_PIXEL_FORMAT_MONO_12		0x01100005

ARV_PIXEL_FORMAT_MONO_12_PACKED

#define ARV_PIXEL_FORMAT_MONO_12_PACKED		0x010c0006

ARV_PIXEL_FORMAT_MONO_14

#define ARV_PIXEL_FORMAT_MONO_14		0x01100025 /* https://bugzilla.gnome.org/show_bug.cgi?id=655131 */

ARV_PIXEL_FORMAT_MONO_16

#define ARV_PIXEL_FORMAT_MONO_16		0x01100007

ARV_PIXEL_FORMAT_MONO_8

#define ARV_PIXEL_FORMAT_MONO_8			0x01080001

ARV_PIXEL_FORMAT_MONO_8_SIGNED

#define ARV_PIXEL_FORMAT_MONO_8_SIGNED		0x01080002

ARV_PIXEL_FORMAT_RGBA_8_PACKED

#define ARV_PIXEL_FORMAT_RGBA_8_PACKED		0x02200016

ARV_PIXEL_FORMAT_RGB_10_PACKED

#define ARV_PIXEL_FORMAT_RGB_10_PACKED		0x02300018

ARV_PIXEL_FORMAT_RGB_10_PLANAR

#define ARV_PIXEL_FORMAT_RGB_10_PLANAR		0x02300022

ARV_PIXEL_FORMAT_RGB_12_PACKED

#define ARV_PIXEL_FORMAT_RGB_12_PACKED		0x0230001a

ARV_PIXEL_FORMAT_RGB_12_PLANAR

#define ARV_PIXEL_FORMAT_RGB_12_PLANAR		0x02300023

ARV_PIXEL_FORMAT_RGB_16_PLANAR

#define ARV_PIXEL_FORMAT_RGB_16_PLANAR		0x02300024

ARV_PIXEL_FORMAT_RGB_8_PACKED

#define ARV_PIXEL_FORMAT_RGB_8_PACKED		0x02180014

ARV_PIXEL_FORMAT_RGB_8_PLANAR

#define ARV_PIXEL_FORMAT_RGB_8_PLANAR		0x02180021

ARV_PIXEL_FORMAT_YUV_411_PACKED

#define ARV_PIXEL_FORMAT_YUV_411_PACKED		0x020c001e

ARV_PIXEL_FORMAT_YUV_422_PACKED

#define ARV_PIXEL_FORMAT_YUV_422_PACKED		0x0210001f

ARV_PIXEL_FORMAT_YUV_422_YUYV_PACKED

#define ARV_PIXEL_FORMAT_YUV_422_YUYV_PACKED 	0x02100032

ARV_PIXEL_FORMAT_YUV_444_PACKED

#define ARV_PIXEL_FORMAT_YUV_444_PACKED		0x02180020