pub struct Session {
pipe: File,
connection: Rc<VeaConnection>,
session_ptr: *mut vea_session_info,
}
Expand description
Represents an encode session.
Fields§
§pipe: File
§connection: Rc<VeaConnection>
§session_ptr: *mut vea_session_info
Implementations§
source§impl Session
impl Session
sourcepub(super) fn new(connection: &Rc<VeaConnection>, config: Config) -> Option<Self>
pub(super) fn new(connection: &Rc<VeaConnection>, config: Config) -> Option<Self>
Creates a new Session
.
sourcepub fn read_event(&mut self) -> Result<Event>
pub fn read_event(&mut self) -> Result<Event>
Reads an Event
object from a pipe provided by an encode session.
sourcepub fn encode(
&self,
input_buffer_id: VeaInputBufferId,
fd: BufferFd,
planes: &[FramePlane],
timestamp: i64,
force_keyframe: bool
) -> Result<()>
pub fn encode(
&self,
input_buffer_id: VeaInputBufferId,
fd: BufferFd,
planes: &[FramePlane],
timestamp: i64,
force_keyframe: bool
) -> Result<()>
Sends an encode request for an input buffer given as fd
with planes described
by planes. The timestamp of the frame to encode is typically provided in milliseconds by
timestamp.
force_keyframe` indicates to the encoder that
the frame should be encoded as a keyframe.
When the input buffer has been filled, an EncoderEvent::ProcessedInputBuffer
event can be read from the event pipe.
The caller is responsible for passing in a unique value for input_buffer_id
which can be referenced when the event is received.
fd
will be closed after encoding has occurred.
sourcepub fn use_output_buffer(
&self,
output_buffer_id: VeaOutputBufferId,
fd: BufferFd,
offset: u32,
size: u32
) -> Result<()>
pub fn use_output_buffer(
&self,
output_buffer_id: VeaOutputBufferId,
fd: BufferFd,
offset: u32,
size: u32
) -> Result<()>
Provides a buffer for storing encoded output.
When the output buffer has been filled, an EncoderEvent::ProcessedOutputBuffer
event can be read from the event pipe.
The caller is responsible for passing in a unique value for output_buffer_id
which can be referenced when the event is received.
This function takes ownership of fd
.