Skip to main content

V4l2M2mEncoder

Struct V4l2M2mEncoder 

Source
pub struct V4l2M2mEncoder {
Show 18 fields fd: RawFd, codec: Codec, coded: u32, width: i32, height: i32, row_bytes: usize, bytesperline: usize, output_size: usize, output_map: *mut c_void, capture: [(*mut c_void, usize); 2], bitrate_bps: u32, fps: f64, omit_headers: bool, color: Color, fallback: Option<ColorSignal>, written_sps: Option<(Vec<u8>, Vec<u8>)>, decided: bool, reorder: NoReorder,
}

Fields§

§fd: RawFd§codec: Codec§coded: u32§width: i32§height: i32§row_bytes: usize§bytesperline: usize§output_size: usize§output_map: *mut c_void§capture: [(*mut c_void, usize); 2]§bitrate_bps: u32§fps: f64§omit_headers: bool§color: Color§fallback: Option<ColorSignal>

What to declare when the device declares nothing, or None for a device off the record.

§written_sps: Option<(Vec<u8>, Vec<u8>)>

A sequence parameter set arrives with every key frame and is identical each time, so it is written once and matched by bytes after that.

§decided: bool

Whether the first access unit has settled what the stream says.

§reorder: NoReorder

The reorder bound every H.264 set is held to. The session queues one frame and waits for its unit before the next, so pictures leave in the order they are shown whatever the device’s picture order count: a device that reordered would wait for a frame never queued.

Implementations§

Source§

impl V4l2M2mEncoder

Source

pub fn new( codec: Codec, settings: &CaptureSettings, rgba: bool, ) -> Result<Self, String>

Source

fn release(&mut self)

Everything about the session that a refused STREAMON leaves behind, so the next attempt starts on a node that carries none of it. The descriptor itself is reopened by the caller: a device that refused a parameter answers ESRCH to every later call on that descriptor.

Source

fn setup( &mut self, settings: &CaptureSettings, rgba: bool, ) -> Result<(), String>

Source

fn call<T>(&self, request: u64, arg: &mut T, what: &str) -> Result<(), String>

Source

fn set_control(&self, id: u32, value: i32, what: &str) -> Result<(), String>

A control this device refuses is a refusal of the session. It is not a warning to carry on past: a rejected rate control mode leaves the node answering ESRCH to STREAMON until it is closed, so a session that shrugged here would fail later and in a place that says nothing about the cause.

Source

fn set_frame_rate(&mut self, fps: f64) -> Result<(), String>

Source

fn request_buffers(&self, type_: u32, count: u32) -> Result<(), String>

Source

fn map_buffer( &self, type_: u32, index: u32, ) -> Result<(*mut c_void, usize), String>

Source

fn queue(&self, type_: u32, index: u32, bytesused: u32) -> Result<(), String>

Source

fn dequeue(&self, type_: u32) -> Result<(u32, usize), String>

Source

fn stream(&self, request: u64, type_: u32, what: &str) -> Result<(), String>

Source

fn wait_for_frame(&self) -> Result<(), String>

Wait for the access unit of the frame just queued. The node is opened blocking, so this exists to bound the wait: a device that stopped answering has to become an error the ladder can act on, not a stream that never returns.

Source

fn fill_output(&self, pixels: &[u8], stride: usize) -> Result<(), String>

Source

pub fn codec(&self) -> Codec

Source

fn frame_type(&self, bytes: &[u8]) -> u8

The wire picture type of one access unit, read with the codec’s own syntax: an H.265 NAL header is two bytes where H.264’s is one, and VP8 and VP9 carry no NAL units at all.

Source

pub fn is_fullcolor(&self) -> bool

The firmware converts to 4:2:0 and the encoder takes nothing else.

Source

fn signal(&self) -> Option<ColorSignal>

What the stream says about its color, once an access unit has settled it.

Source

pub fn last_reference(&self) -> Reference

The kernel’s stateful interface names no reference and takes no invalidation.

Source

pub fn invalidate_reference(&mut self, _frame_id: u16) -> bool

Source

pub fn is_full_range(&self) -> bool

The range the stream declares, which is the device’s to decide: a session that says nothing is described as limited, since that is what a decoder given nothing assumes.

Source

fn tag_sequence(&mut self, unit: &[u8]) -> Option<Vec<u8>>

Learn what the first sequence parameter set says, and write one into every later set when the device said nothing and its conversion is on record; then hold every set to a reorder bound of zero. Only H.264 carries either here: an H.265 set names its own reordering, and VP8 and VP9 carry no parameter sets.

Source

fn write_color( &mut self, original: &[u8], signal: ColorSignal, ) -> Option<Vec<u8>>

original declaring signal, or None where the set cannot be written, in which case it is left as it came: a stream that carries no color is watchable, and one carrying a set built wrong is not.

Source

pub fn reconfigure_rate( &mut self, settings: &CaptureSettings, ) -> Result<(), String>

Apply a live bitrate or frame rate change. Both are writable while streaming on this path, and the frame rate goes down with the bitrate: left behind, it would budget a new bitrate against an old rate.

Source

pub fn encode_host( &mut self, pixels: &[u8], stride: usize, _rgba: bool, frame_number: u64, _qp: u32, force_idr: bool, ) -> Result<Vec<u8>, String>

Source

fn frame(&mut self, unit: &[u8], frame_number: u64) -> Vec<u8> ⓘ

One access unit as the wire carries it: its sequence parameter sets tagged, behind a header naming the session’s codec unless the caller frames the stream itself.

Trait Implementations§

Source§

impl Drop for V4l2M2mEncoder

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for V4l2M2mEncoder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more