ArvStream

ArvStream — Abstract base class for video stream reception

Functions

Properties

gpointer callback Read / Write / Construct Only
gpointer callback-data Read / Write / Construct Only
ArvDevice * device Read / Write / Construct Only
gboolean emit-signals Read / Write

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── ArvStream
        ├── ArvFakeStream
        ├── ArvGvStream
        ╰── ArvUvStream

Implemented Interfaces

ArvStream implements GInitable.

Description

ArvStream provides an abstract base class for the implementation of video stream reception threads. The interface between the reception thread and the main thread is done using asynchronous queues, containing ArvBuffer objects.

Functions

ArvStreamCallback ()

void
(*ArvStreamCallback) (void *user_data,
                      ArvStreamCallbackType type,
                      ArvBuffer *buffer);

arv_stream_push_buffer ()

void
arv_stream_push_buffer (ArvStream *stream,
                        ArvBuffer *buffer);

Pushes a ArvBuffer to the stream thread. The stream takes ownership of buffer , and will free all the buffers still in its queues when destroyed.

This method is thread safe.

Parameters

stream

a ArvStream

 

buffer

buffer to push.

[transfer full]

Since: 0.2.0


arv_stream_pop_buffer ()

ArvBuffer *
arv_stream_pop_buffer (ArvStream *stream);

Pops a buffer from the output queue of stream . The retrieved buffer may contain an invalid image. Caller should check the buffer status before using it. This function blocks until a buffer is available.

This method is thread safe.

Parameters

stream

a ArvStream

 

Returns

a ArvBuffer.

[transfer full]

Since: 0.2.0


arv_stream_try_pop_buffer ()

ArvBuffer *
arv_stream_try_pop_buffer (ArvStream *stream);

Pops a buffer from the output queue of stream . The retrieved buffer may contain an invalid image. Caller should check the buffer status before using it. This is the non blocking version of pop_buffer.

This method is thread safe.

Parameters

stream

a ArvStream

 

Returns

a ArvBuffer, NULL if no buffer is available.

[transfer full]

Since: 0.2.0


arv_stream_timeout_pop_buffer ()

ArvBuffer *
arv_stream_timeout_pop_buffer (ArvStream *stream,
                               guint64 timeout);

Pops a buffer from the output queue of stream , waiting no more than timeout . The retrieved buffer may contain an invalid image. Caller should check the buffer status before using it.

This method is thread safe.

Parameters

stream

a ArvStream

 

timeout

timeout, in µs

 

Returns

a ArvBuffer, NULL if no buffer is available until the timeout occurs.

[transfer full]

Since: 0.2.0


arv_stream_get_n_buffers ()

void
arv_stream_get_n_buffers (ArvStream *stream,
                          gint *n_input_buffers,
                          gint *n_output_buffers);

An accessor to the stream buffer queue lengths.

Parameters

stream

a ArvStream

 

n_input_buffers

input queue length.

[out][allow-none]

n_output_buffers

output queue length.

[out][allow-none]

Since: 0.2.0


arv_stream_start_thread ()

void
arv_stream_start_thread (ArvStream *stream);

Start the stream receiving thread. The thread is automatically started when the ArvStream object is instantiated, so this function is only useful if the thread was stopped using arv_stream_stop_thread .

Parameters

stream

a ArvStream

 

Since: 0.6.2


arv_stream_stop_thread ()

unsigned int
arv_stream_stop_thread (ArvStream *stream,
                        gboolean delete_buffers);

Stop the stream receiving thread, and optionally delete all the ArvBuffer stored in the stream object queues. Main use of this function is to be able to quickly change an acquisition parameter that changes the payload size, without deleting/recreating the stream object.

Parameters

stream

a ArvStream

 

delete_buffers

enable buffer deletion

 

Returns

the number of deleted buffers if delete_buffers == TRUE, 0 otherwise.

Since: 0.6.2


arv_stream_get_emit_signals ()

gboolean
arv_stream_get_emit_signals (ArvStream *stream);

Check if stream will emit its signals.

Parameters

stream

a ArvStream

 

Returns

TRUE if stream is emiting its signals.

Since: 0.2.0


arv_stream_set_emit_signals ()

void
arv_stream_set_emit_signals (ArvStream *stream,
                             gboolean emit_signals);

Make stream emit signals. This option is by default disabled because signal emission is expensive and unneeded when the application prefers to operate in pull mode.

Parameters

stream

a ArvStream

 

emit_signals

the new state

 

Since: 0.2.0


arv_make_thread_realtime ()

gboolean
arv_make_thread_realtime (int priority);

Parameters

priority

realtime priority

 

Returns

TRUE on success.

Try to make current thread realtime. It first try to use sched_setscheduler, and if it fails, use rtkit.

Since: 0.4.0


arv_make_thread_high_priority ()

gboolean
arv_make_thread_high_priority (int nice_level);

Parameters

nice_level

new nice level

 

Returns

TRUE on success.

Try to set current thread nice level to high priority, using rtkit.

Since: 0.4.0


arv_stream_get_statistics ()

void
arv_stream_get_statistics (ArvStream *stream,
                           guint64 *n_completed_buffers,
                           guint64 *n_failures,
                           guint64 *n_underruns);

An accessor to the stream statistics.

Parameters

stream

a ArvStream

 

n_completed_buffers

number of complete received buffers.

[out][allow-none]

n_failures

number of reception failures.

[out][allow-none]

n_underruns

number of input buffer underruns.

[out][allow-none]

Since: 0.2.0


arv_stream_get_n_infos ()

guint
arv_stream_get_n_infos (ArvStream *stream);

Parameters

stream

a ArvStream

 

Returns

the number of stream informations. These informations contain useful numbers about data transfer quality.

Since: 0.8.11


arv_stream_get_info_name ()

const char *
arv_stream_get_info_name (ArvStream *stream,
                          guint id);

Parameters

stream

a ArvStream

 

id

info id

 

Returns

the name of the corresponding stream information.

Since: 0.8.11


arv_stream_get_info_type ()

GType
arv_stream_get_info_type (ArvStream *stream,
                          guint id);

Parameters

stream

a ArvStream

 

id

info id

 

Returns

the GType of the corresponding stream information, which indicates what API to use to retrieve the information value (arv_stream_get_info_uint64() or arv_stream_get_info_double()).

Since: 0.8.11


arv_stream_get_info_double ()

double
arv_stream_get_info_double (ArvStream *stream,
                            guint id);

Parameters

stream

a ArvStream

 

id

info id

 

Returns

the value of the corresponding stream information, as a double.

Since: 0.8.11


arv_stream_get_info_double_by_name ()

double
arv_stream_get_info_double_by_name (ArvStream *stream,
                                    const char *name);

Parameters

stream

a ArvStream

 

name

info name

 

Returns

the value of the corresponding stream information, as a double.

Since: 0.8.11


arv_stream_get_info_uint64 ()

guint64
arv_stream_get_info_uint64 (ArvStream *stream,
                            guint id);

Parameters

stream

a ArvStream

 

id

info id

 

Returns

the value of the corresponding stream information, as a 64 bit unsigned integer.

Since: 0.8.11


arv_stream_get_info_uint64_by_name ()

guint64
arv_stream_get_info_uint64_by_name (ArvStream *stream,
                                    const char *name);

Parameters

stream

a ArvStream

 

name

info name

 

Returns

the value of the corresponding stream information, as a 64 bit unsigned integer.

Since: 0.8.11

Types and Values

enum ArvStreamCallbackType

Describes when the stream callback is called.

Members

ARV_STREAM_CALLBACK_TYPE_INIT

thread initialization, happens once

 

ARV_STREAM_CALLBACK_TYPE_EXIT

thread end, happens once

 

ARV_STREAM_CALLBACK_TYPE_START_BUFFER

buffer filling start, happens at each frame

 

ARV_STREAM_CALLBACK_TYPE_BUFFER_DONE

buffer filled, happens at each frame

 

ArvStream

typedef struct _ArvStream ArvStream;

Property Details

The “callback” property

  “callback”                 gpointer

Optional user callback.

Owner: ArvStream

Flags: Read / Write / Construct Only


The “callback-data” property

  “callback-data”            gpointer

Optional user callback data.

Owner: ArvStream

Flags: Read / Write / Construct Only


The “device” property

  “device”                   ArvDevice *

A ArvDevice parent object.

Owner: ArvStream

Flags: Read / Write / Construct Only


The “emit-signals” property

  “emit-signals”             gboolean

Emit signals.

Owner: ArvStream

Flags: Read / Write

Default value: FALSE

Signal Details

The “new-buffer” signal

void
user_function (ArvStream *stream,
               gpointer   user_data)

Signal that a new buffer is available.

This signal is emited from the stream receive thread and only when the "emit-signals" property is TRUE.

The new buffer can be retrieved with arv_stream_pop_buffer().

Note that this signal is only emited when the "emit-signals" property is set to TRUE, which it is not by default for performance reasons.

Parameters

stream

the stream that emited the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 0.2.0