pub struct StreamProcessor { /* private fields */ }
Expand description
Struct representing a CodecFactory .
Input sent to the encoder via StreamProcessor::write_bytes
is queued for delivery, and delivered
whenever a packet is full or StreamProcessor::send_packet
is called. Output can be retrieved using
an StreamProcessorStream
from StreamProcessor::take_output_stream
.
Implementations§
Source§impl StreamProcessor
impl StreamProcessor
Sourcepub fn create_encoder(
input_domain: DomainFormat,
encoder_settings: EncoderSettings,
) -> Result<StreamProcessor, Error>
pub fn create_encoder( input_domain: DomainFormat, encoder_settings: EncoderSettings, ) -> Result<StreamProcessor, Error>
Create a new StreamProcessor encoder, with the given input_domain
and encoder_settings
. See
stream_processor.fidl for descriptions of these parameters. This is only meant for audio
encoding.
Sourcepub fn create_decoder(
mime_type: &str,
oob_bytes: Option<Vec<u8>>,
) -> Result<StreamProcessor, Error>
pub fn create_decoder( mime_type: &str, oob_bytes: Option<Vec<u8>>, ) -> Result<StreamProcessor, Error>
Create a new StreamProcessor decoder, with the given mime_type
and optional oob_bytes
. See
stream_processor.fidl for descriptions of these parameters. This is only meant for audio
decoding.
Sourcepub fn take_output_stream(
&mut self,
) -> Result<StreamProcessorOutputStream, Error>
pub fn take_output_stream( &mut self, ) -> Result<StreamProcessorOutputStream, Error>
Take a stream object which will produce the output of the processor. Only one StreamProcessorOutputStream object can exist at a time, and this will return an Error if it is already taken.
Sourcepub fn send_packet(&mut self) -> Result<(), Error>
pub fn send_packet(&mut self) -> Result<(), Error>
Flush the input buffer to the processor, relinquishing the ownership of the buffer currently in the input cursor, and picking a new input buffer. If there is no input buffer left, the input cursor is left as None.
pub fn close(&mut self) -> Result<(), Error>
Trait Implementations§
Source§impl AsyncWrite for StreamProcessor
impl AsyncWrite for StreamProcessor
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf
into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Result<()>>
Auto Trait Implementations§
impl Freeze for StreamProcessor
impl !RefUnwindSafe for StreamProcessor
impl Send for StreamProcessor
impl Sync for StreamProcessor
impl Unpin for StreamProcessor
impl !UnwindSafe for StreamProcessor
Blanket Implementations§
§impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
impl<W> AsyncWriteExt for Wwhere
W: AsyncWrite + ?Sized,
§fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
fn flush(&mut self) -> Flush<'_, Self>where
Self: Unpin,
AsyncWrite
. Read more§fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
fn close(&mut self) -> Close<'_, Self>where
Self: Unpin,
AsyncWrite
.§fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
fn write<'a>(&'a mut self, buf: &'a [u8]) -> Write<'a, Self>where
Self: Unpin,
buf
into the object. Read more§fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectored<'a, Self>where
Self: Unpin,
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectored<'a, Self>where
Self: Unpin,
bufs
into the object using vectored
IO operations. Read more