pub struct MediaCodecConfig { /* private fields */ }
Expand description
Stores the media codec configuration for an A2DP stream, and provides utility for integration with Fuchsia media.
Implementations§
Source§impl MediaCodecConfig
impl MediaCodecConfig
Sourcepub fn build(codec_type: MediaCodecType, extra: &[u8]) -> Result<Self>
pub fn build(codec_type: MediaCodecType, extra: &[u8]) -> Result<Self>
Try to build a codec config given a codec type and the codec specific information elements
for the codec specified in extra
. Fails with OutOfRange if the codec is not supported.
Sourcepub fn min_sbc() -> Self
pub fn min_sbc() -> Self
Build an SBC configuration with minimum defaults for configuration (48000 Hz Mono, 16 Blocks, 8 SubBands, Loudness Allocation, 2-29 bitpool) This is the minimunm configuration requried by both Sink and Source as defined in the A2DP Specificaiton 1.2 Section 4.3.2.
Sourcepub fn min_aac_sink() -> Self
pub fn min_aac_sink() -> Self
Mandatory sink configuration for AAC As defined by the A2DP Specification Sectrion 4.5
pub fn codec_type(&self) -> &MediaCodecType
pub fn codec_extra(&self) -> &[u8] ⓘ
pub fn make_packet_builder( &self, max_packet_size: usize, ) -> Result<Box<dyn RtpPacketBuilder>>
Sourcepub fn supports(&self, other: &MediaCodecConfig) -> bool
pub fn supports(&self, other: &MediaCodecConfig) -> bool
Returns true if the given MediaCodecConfig is a compatible subset of this configuration.
Sourcepub fn negotiate(
a: &MediaCodecConfig,
b: &MediaCodecConfig,
) -> Option<MediaCodecConfig>
pub fn negotiate( a: &MediaCodecConfig, b: &MediaCodecConfig, ) -> Option<MediaCodecConfig>
Negotiate the best supported configuration, given another configuration. This can be seen as a kind of intersection of the capabilities of the two configs. IF this returns Some(result), then a.supports(result) and b.supports(result) will both be true.
Sourcepub fn encoder_settings(&self) -> Result<EncoderSettings>
pub fn encoder_settings(&self) -> Result<EncoderSettings>
Retrieves a set of EncoderSettings that is suitable to configure a StreamProcessor to encode to the target configuration for this MediaCodecConfig. Returns Err(OutOfRange) if this does not specify a single configuration.
Sourcepub fn capability(&self) -> ServiceCapability
pub fn capability(&self) -> ServiceCapability
Construct a ServiceCapability that represents this codec config.
Sourcepub fn channel_count(&self) -> Result<usize>
pub fn channel_count(&self) -> Result<usize>
The number of channels that is selected in the configuration. Returns OutOfRange if the configuration supports a range of channel counts.
Sourcepub fn frames_per_packet(&self) -> usize
pub fn frames_per_packet(&self) -> usize
The number of frames that should be included when building a packet to send to a peer.
pub fn pcm_frames_per_encoded_frame(&self) -> usize
pub fn rtp_frame_header(&self) -> &[u8] ⓘ
Sourcepub fn sampling_frequency(&self) -> Result<u32>
pub fn sampling_frequency(&self) -> Result<u32>
Return the sampling freqeuncy selected by this configuration, or return OutOfRange if more than one is selected.
pub fn stream_encoding(&self) -> &'static str
pub fn mime_type(&self) -> &'static str
Trait Implementations§
Source§impl Clone for MediaCodecConfig
impl Clone for MediaCodecConfig
Source§fn clone(&self) -> MediaCodecConfig
fn clone(&self) -> MediaCodecConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MediaCodecConfig
impl Debug for MediaCodecConfig
Source§impl From<&MediaCodecConfig> for ServiceCapability
impl From<&MediaCodecConfig> for ServiceCapability
Source§fn from(config: &MediaCodecConfig) -> Self
fn from(config: &MediaCodecConfig) -> Self
Source§impl PartialEq for MediaCodecConfig
impl PartialEq for MediaCodecConfig
Source§impl TryFrom<&ServiceCapability> for MediaCodecConfig
impl TryFrom<&ServiceCapability> for MediaCodecConfig
impl StructuralPartialEq for MediaCodecConfig
Auto Trait Implementations§
impl Freeze for MediaCodecConfig
impl RefUnwindSafe for MediaCodecConfig
impl Send for MediaCodecConfig
impl Sync for MediaCodecConfig
impl Unpin for MediaCodecConfig
impl UnwindSafe for MediaCodecConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)