Struct bt_a2dp::codec::MediaCodecConfig
source · 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.
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§fn eq(&self, other: &MediaCodecConfig) -> bool
fn eq(&self, other: &MediaCodecConfig) -> bool
self
and other
values to be equal, and is used
by ==
.