pub trait StreamExt: 'static {
Show 20 methods
// Required methods
fn emits_signals(&self) -> bool;
fn info_double(&self, id: u32) -> f64;
fn info_double_by_name(&self, name: &str) -> f64;
fn info_name(&self, id: u32) -> Option<GString>;
fn info_type(&self, id: u32) -> Type;
fn info_uint64(&self, id: u32) -> u64;
fn info_uint64_by_name(&self, name: &str) -> u64;
fn n_buffers(&self) -> (i32, i32);
fn n_infos(&self) -> u32;
fn statistics(&self) -> (u64, u64, u64);
fn pop_buffer(&self) -> Option<Buffer>;
fn push_buffer(&self, buffer: &Buffer);
fn set_emit_signals(&self, emit_signals: bool);
fn start_thread(&self);
fn stop_thread(&self, delete_buffers: bool) -> u32;
fn timeout_pop_buffer(&self, timeout: u64) -> Option<Buffer>;
fn try_pop_buffer(&self) -> Option<Buffer>;
fn device(&self) -> Option<Device>;
fn connect_new_buffer<F: Fn(&Self) + Send + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_emit_signals_notify<F: Fn(&Self) + Send + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods§
sourcefn emits_signals(&self) -> bool
fn emits_signals(&self) -> bool
sourcefn info_double(&self, id: u32) -> f64
fn info_double(&self, id: u32) -> f64
v0_8_11
only.sourcefn info_double_by_name(&self, name: &str) -> f64
fn info_double_by_name(&self, name: &str) -> f64
v0_8_11
only.sourcefn info_type(&self, id: u32) -> Type
fn info_type(&self, id: u32) -> Type
v0_8_11
only.id
info id
Returns
the GType
of the corresponding stream information, which indicates what API to use to retrieve the
information value (info_uint64()
or info_double()
).
sourcefn info_uint64(&self, id: u32) -> u64
fn info_uint64(&self, id: u32) -> u64
v0_8_11
only.sourcefn info_uint64_by_name(&self, name: &str) -> u64
fn info_uint64_by_name(&self, name: &str) -> u64
v0_8_11
only.sourcefn n_buffers(&self) -> (i32, i32)
fn n_buffers(&self) -> (i32, i32)
An accessor to the stream buffer queue lengths.
Returns
n_input_buffers
input queue length
n_output_buffers
output queue length
sourcefn n_infos(&self) -> u32
fn n_infos(&self) -> u32
v0_8_11
only.Returns
the number of stream informations. These informations contain useful numbers about data transfer quality.
sourcefn statistics(&self) -> (u64, u64, u64)
fn statistics(&self) -> (u64, u64, u64)
An accessor to the stream statistics.
Returns
n_completed_buffers
number of complete received buffers
n_failures
number of reception failures
n_underruns
number of input buffer underruns
sourcefn pop_buffer(&self) -> Option<Buffer>
fn pop_buffer(&self) -> Option<Buffer>
sourcefn push_buffer(&self, buffer: &Buffer)
fn push_buffer(&self, buffer: &Buffer)
sourcefn set_emit_signals(&self, emit_signals: bool)
fn set_emit_signals(&self, emit_signals: bool)
Make self
emit signals. This option is
by default disabled because signal emission is expensive and unneeded when
the application prefers to operate in pull mode.
emit_signals
the new state
sourcefn start_thread(&self)
fn start_thread(&self)
Start the stream receiving thread. The thread is automatically started when
the Stream
object is instantiated, so this function is only useful if
the thread was stopped using stop_thread()
.
sourcefn stop_thread(&self, delete_buffers: bool) -> u32
fn stop_thread(&self, delete_buffers: bool) -> u32
Stop the stream receiving thread, and optionally delete all the Buffer
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.
delete_buffers
enable buffer deletion
Returns
the number of deleted buffers if delete_buffers
== true
, 0 otherwise.
sourcefn timeout_pop_buffer(&self, timeout: u64) -> Option<Buffer>
fn timeout_pop_buffer(&self, timeout: u64) -> Option<Buffer>
Pops a buffer from the output queue of self
, 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.
timeout
timeout, in µs
Returns
a Buffer
, NULL if no buffer is available until the timeout occurs.
sourcefn try_pop_buffer(&self) -> Option<Buffer>
fn try_pop_buffer(&self) -> Option<Buffer>
fn device(&self) -> Option<Device>
sourcefn connect_new_buffer<F: Fn(&Self) + Send + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_new_buffer<F: Fn(&Self) + Send + 'static>( &self, f: F ) -> SignalHandlerId
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 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.