From 28dd9e0a27f86c20a443ab5b8282e406fd7609af Mon Sep 17 00:00:00 2001 From: Alfred Gutierrez Date: Sun, 4 Apr 2021 11:56:02 -0700 Subject: [PATCH] feat: add more audio object types (#52) --- src/types.rs | 124 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 119 insertions(+), 5 deletions(-) diff --git a/src/types.rs b/src/types.rs index be1aeab..22bc933 100644 --- a/src/types.rs +++ b/src/types.rs @@ -313,10 +313,48 @@ impl fmt::Display for AvcProfile { #[derive(Debug, PartialEq, Clone, Copy)] pub enum AudioObjectType { - AacMain = 1, - AacLowComplexity = 2, - AacScalableSampleRate = 3, - AacLongTermPrediction = 4, + AacMain = 1, // AAC Main Profile + AacLowComplexity = 2, // AAC Low Complexity + AacScalableSampleRate = 3, // AAC Scalable Sample Rate + AacLongTermPrediction = 4, // AAC Long Term Predictor + SpectralBandReplication = 5, // Spectral band Replication + AACScalable = 6, // AAC Scalable + TwinVQ = 7, // Twin VQ + CodeExcitedLinearPrediction = 8, // CELP + HarmonicVectorExcitationCoding = 9, // HVXC + TextToSpeechtInterface = 12, // TTSI + MainSynthetic = 13, // Main Synthetic + WavetableSynthesis = 14, // Wavetable Synthesis + GeneralMIDI = 15, // General MIDI + AlgorithmicSynthesis = 16, // Algorithmic Synthesis + ErrorResilientAacLowComplexity = 17, // ER AAC LC + ErrorResilientAacLongTermPrediction = 19, // ER AAC LTP + ErrorResilientAacScalable = 20, // ER AAC Scalable + ErrorResilientAacTwinVQ = 21, // ER AAC TwinVQ + ErrorResilientAacBitSlicedArithmeticCoding = 22, // ER Bit Sliced Arithmetic Coding + ErrorResilientAacLowDelay = 23, // ER AAC Low Delay + ErrorResilientCodeExcitedLinearPrediction = 24, // ER CELP + ErrorResilientHarmonicVectorExcitationCoding = 25, // ER HVXC + ErrorResilientHarmonicIndividualLinesNoise = 26, // ER HILN + ErrorResilientParametric = 27, // ER Parametric + SinuSoidalCoding = 28, // SSC + ParametricStereo = 29, // PS + MpegSurround = 30, // MPEG Surround + MpegLayer1 = 32, // MPEG Layer 1 + MpegLayer2 = 33, // MPEG Layer 2 + MpegLayer3 = 34, // MPEG Layer 3 + DirectStreamTransfer = 35, // DST Direct Stream Transfer + AudioLosslessCoding = 36, // ALS Audio Lossless Coding + ScalableLosslessCoding = 37, // SLC Scalable Lossless Coding + ScalableLosslessCodingNoneCore = 38, // SLC non-core + ErrorResilientAacEnhancedLowDelay = 39, // ER AAC ELD + SymbolicMusicRepresentationSimple = 40, // SMR Simple + SymbolicMusicRepresentationMain = 41, // SMR Main + UnifiedSpeechAudioCoding = 42, // USAC + SpatialAudioObjectCoding = 43, // SAOC + LowDelayMpegSurround = 44, // LD MPEG Surround + SpatialAudioObjectCodingDialogueEnhancement = 45, // SAOC-DE + AudioSync = 46, // Audio Sync } impl TryFrom for AudioObjectType { @@ -327,6 +365,44 @@ impl TryFrom for AudioObjectType { 2 => Ok(AudioObjectType::AacLowComplexity), 3 => Ok(AudioObjectType::AacScalableSampleRate), 4 => Ok(AudioObjectType::AacLongTermPrediction), + 5 => Ok(AudioObjectType::SpectralBandReplication), + 6 => Ok(AudioObjectType::AACScalable), + 7 => Ok(AudioObjectType::TwinVQ), + 8 => Ok(AudioObjectType::CodeExcitedLinearPrediction), + 9 => Ok(AudioObjectType::HarmonicVectorExcitationCoding), + 12 => Ok(AudioObjectType::TextToSpeechtInterface), + 13 => Ok(AudioObjectType::MainSynthetic), + 14 => Ok(AudioObjectType::WavetableSynthesis), + 15 => Ok(AudioObjectType::GeneralMIDI), + 16 => Ok(AudioObjectType::AlgorithmicSynthesis), + 17 => Ok(AudioObjectType::ErrorResilientAacLowComplexity), + 19 => Ok(AudioObjectType::ErrorResilientAacLongTermPrediction), + 20 => Ok(AudioObjectType::ErrorResilientAacScalable), + 21 => Ok(AudioObjectType::ErrorResilientAacTwinVQ), + 22 => Ok(AudioObjectType::ErrorResilientAacBitSlicedArithmeticCoding), + 23 => Ok(AudioObjectType::ErrorResilientAacLowDelay), + 24 => Ok(AudioObjectType::ErrorResilientCodeExcitedLinearPrediction), + 25 => Ok(AudioObjectType::ErrorResilientHarmonicVectorExcitationCoding), + 26 => Ok(AudioObjectType::ErrorResilientHarmonicIndividualLinesNoise), + 27 => Ok(AudioObjectType::ErrorResilientParametric), + 28 => Ok(AudioObjectType::SinuSoidalCoding), + 29 => Ok(AudioObjectType::ParametricStereo), + 30 => Ok(AudioObjectType::MpegSurround), + 32 => Ok(AudioObjectType::MpegLayer1), + 33 => Ok(AudioObjectType::MpegLayer2), + 34 => Ok(AudioObjectType::MpegLayer3), + 35 => Ok(AudioObjectType::DirectStreamTransfer), + 36 => Ok(AudioObjectType::AudioLosslessCoding), + 37 => Ok(AudioObjectType::ScalableLosslessCoding), + 38 => Ok(AudioObjectType::ScalableLosslessCodingNoneCore), + 39 => Ok(AudioObjectType::ErrorResilientAacEnhancedLowDelay), + 40 => Ok(AudioObjectType::SymbolicMusicRepresentationSimple), + 41 => Ok(AudioObjectType::SymbolicMusicRepresentationMain), + 42 => Ok(AudioObjectType::UnifiedSpeechAudioCoding), + 43 => Ok(AudioObjectType::SpatialAudioObjectCoding), + 44 => Ok(AudioObjectType::LowDelayMpegSurround), + 45 => Ok(AudioObjectType::SpatialAudioObjectCodingDialogueEnhancement), + 46 => Ok(AudioObjectType::AudioSync), _ => Err(Error::InvalidData("invalid audio object type")), } } @@ -335,10 +411,48 @@ impl TryFrom for AudioObjectType { impl fmt::Display for AudioObjectType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let type_str = match self { - AudioObjectType::AacMain => "main", + AudioObjectType::AacMain => "AAC Main", AudioObjectType::AacLowComplexity => "LC", AudioObjectType::AacScalableSampleRate => "SSR", AudioObjectType::AacLongTermPrediction => "LTP", + AudioObjectType::SpectralBandReplication => "SBR", + AudioObjectType::AACScalable => "Scalable", + AudioObjectType::TwinVQ => "TwinVQ", + AudioObjectType::CodeExcitedLinearPrediction => "CELP", + AudioObjectType::HarmonicVectorExcitationCoding => "HVXC", + AudioObjectType::TextToSpeechtInterface => "TTSI", + AudioObjectType::MainSynthetic => "Main Synthetic", + AudioObjectType::WavetableSynthesis => "Wavetable Synthesis", + AudioObjectType::GeneralMIDI => "General MIDI", + AudioObjectType::AlgorithmicSynthesis => "Algorithmic Synthesis", + AudioObjectType::ErrorResilientAacLowComplexity => "ER AAC LC", + AudioObjectType::ErrorResilientAacLongTermPrediction => "ER AAC LTP", + AudioObjectType::ErrorResilientAacScalable => "ER AAC scalable", + AudioObjectType::ErrorResilientAacTwinVQ => "ER AAC TwinVQ", + AudioObjectType::ErrorResilientAacBitSlicedArithmeticCoding => "ER AAC BSAC", + AudioObjectType::ErrorResilientAacLowDelay => "ER AAC LD", + AudioObjectType::ErrorResilientCodeExcitedLinearPrediction => "ER CELP", + AudioObjectType::ErrorResilientHarmonicVectorExcitationCoding => "ER HVXC", + AudioObjectType::ErrorResilientHarmonicIndividualLinesNoise => "ER HILN", + AudioObjectType::ErrorResilientParametric => "ER Parametric", + AudioObjectType::SinuSoidalCoding => "SSC", + AudioObjectType::ParametricStereo => "Parametric Stereo", + AudioObjectType::MpegSurround => "MPEG surround", + AudioObjectType::MpegLayer1 => "MPEG Layer 1", + AudioObjectType::MpegLayer2 => "MPEG Layer 2", + AudioObjectType::MpegLayer3 => "MPEG Layer 3", + AudioObjectType::DirectStreamTransfer => "DST", + AudioObjectType::AudioLosslessCoding => "ALS", + AudioObjectType::ScalableLosslessCoding => "SLS", + AudioObjectType::ScalableLosslessCodingNoneCore => "SLS Non-core", + AudioObjectType::ErrorResilientAacEnhancedLowDelay => "ER AAC ELD", + AudioObjectType::SymbolicMusicRepresentationSimple => "SMR Simple", + AudioObjectType::SymbolicMusicRepresentationMain => "SMR Main", + AudioObjectType::UnifiedSpeechAudioCoding => "USAC", + AudioObjectType::SpatialAudioObjectCoding => "SAOC", + AudioObjectType::LowDelayMpegSurround => "LD MPEG Surround", + AudioObjectType::SpatialAudioObjectCodingDialogueEnhancement => "SAOC-DE", + AudioObjectType::AudioSync => "Audio Sync", }; write!(f, "{}", type_str) }