diff --git a/src/internal_modules/roc_audio/pcm_format.cpp b/src/internal_modules/roc_audio/pcm_format.cpp index 55887fd06..5c589e9af 100644 --- a/src/internal_modules/roc_audio/pcm_format.cpp +++ b/src/internal_modules/roc_audio/pcm_format.cpp @@ -4570,10 +4570,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt8_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt8_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt8; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt8_Be; +#else + traits.portable_alias = PcmFormat_SInt8_Le; #endif traits.bit_depth = 8; traits.bit_width = 8; @@ -4584,7 +4589,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt8_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt8; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt8_Be; traits.bit_depth = 8; traits.bit_width = 8; break; @@ -4594,7 +4606,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt8_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt8; +#endif + traits.portable_alias = PcmFormat_SInt8_Le; traits.bit_depth = 8; traits.bit_width = 8; break; @@ -4605,10 +4624,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt8_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt8_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt8; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt8_Be; +#else + traits.portable_alias = PcmFormat_UInt8_Le; #endif traits.bit_depth = 8; traits.bit_width = 8; @@ -4619,7 +4643,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt8_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt8; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt8_Be; traits.bit_depth = 8; traits.bit_width = 8; break; @@ -4629,7 +4660,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt8_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt8; +#endif + traits.portable_alias = PcmFormat_UInt8_Le; traits.bit_depth = 8; traits.bit_width = 8; break; @@ -4640,10 +4678,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt16_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt16_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt16; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt16_Be; +#else + traits.portable_alias = PcmFormat_SInt16_Le; #endif traits.bit_depth = 16; traits.bit_width = 16; @@ -4654,7 +4697,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt16_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt16; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt16_Be; traits.bit_depth = 16; traits.bit_width = 16; break; @@ -4664,7 +4714,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt16_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt16; +#endif + traits.portable_alias = PcmFormat_SInt16_Le; traits.bit_depth = 16; traits.bit_width = 16; break; @@ -4675,10 +4732,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt16_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt16_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt16; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt16_Be; +#else + traits.portable_alias = PcmFormat_UInt16_Le; #endif traits.bit_depth = 16; traits.bit_width = 16; @@ -4689,7 +4751,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt16_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt16; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt16_Be; traits.bit_depth = 16; traits.bit_width = 16; break; @@ -4699,7 +4768,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt16_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt16; +#endif + traits.portable_alias = PcmFormat_UInt16_Le; traits.bit_depth = 16; traits.bit_width = 16; break; @@ -4710,10 +4786,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt18_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt18_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt18; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt18_Be; +#else + traits.portable_alias = PcmFormat_SInt18_Le; #endif traits.bit_depth = 18; traits.bit_width = 18; @@ -4724,7 +4805,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt18_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt18; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt18_Be; traits.bit_depth = 18; traits.bit_width = 18; break; @@ -4734,7 +4822,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt18_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt18; +#endif + traits.portable_alias = PcmFormat_SInt18_Le; traits.bit_depth = 18; traits.bit_width = 18; break; @@ -4745,10 +4840,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt18_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt18_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt18; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt18_Be; +#else + traits.portable_alias = PcmFormat_UInt18_Le; #endif traits.bit_depth = 18; traits.bit_width = 18; @@ -4759,7 +4859,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt18_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt18; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt18_Be; traits.bit_depth = 18; traits.bit_width = 18; break; @@ -4769,7 +4876,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt18_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt18; +#endif + traits.portable_alias = PcmFormat_UInt18_Le; traits.bit_depth = 18; traits.bit_width = 18; break; @@ -4780,10 +4894,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt18_3_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt18_3_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt18_3; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt18_3_Be; +#else + traits.portable_alias = PcmFormat_SInt18_3_Le; #endif traits.bit_depth = 18; traits.bit_width = 24; @@ -4794,7 +4913,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt18_3_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt18_3; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt18_3_Be; traits.bit_depth = 18; traits.bit_width = 24; break; @@ -4804,7 +4930,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt18_3_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt18_3; +#endif + traits.portable_alias = PcmFormat_SInt18_3_Le; traits.bit_depth = 18; traits.bit_width = 24; break; @@ -4815,10 +4948,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt18_3_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt18_3_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt18_3; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt18_3_Be; +#else + traits.portable_alias = PcmFormat_UInt18_3_Le; #endif traits.bit_depth = 18; traits.bit_width = 24; @@ -4829,7 +4967,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt18_3_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt18_3; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt18_3_Be; traits.bit_depth = 18; traits.bit_width = 24; break; @@ -4839,7 +4984,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt18_3_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt18_3; +#endif + traits.portable_alias = PcmFormat_UInt18_3_Le; traits.bit_depth = 18; traits.bit_width = 24; break; @@ -4850,10 +5002,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt18_4_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt18_4_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt18_4; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt18_4_Be; +#else + traits.portable_alias = PcmFormat_SInt18_4_Le; #endif traits.bit_depth = 18; traits.bit_width = 32; @@ -4864,7 +5021,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt18_4_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt18_4; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt18_4_Be; traits.bit_depth = 18; traits.bit_width = 32; break; @@ -4874,7 +5038,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt18_4_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt18_4; +#endif + traits.portable_alias = PcmFormat_SInt18_4_Le; traits.bit_depth = 18; traits.bit_width = 32; break; @@ -4885,10 +5056,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt18_4_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt18_4_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt18_4; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt18_4_Be; +#else + traits.portable_alias = PcmFormat_UInt18_4_Le; #endif traits.bit_depth = 18; traits.bit_width = 32; @@ -4899,7 +5075,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt18_4_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt18_4; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt18_4_Be; traits.bit_depth = 18; traits.bit_width = 32; break; @@ -4909,7 +5092,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt18_4_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt18_4; +#endif + traits.portable_alias = PcmFormat_UInt18_4_Le; traits.bit_depth = 18; traits.bit_width = 32; break; @@ -4920,10 +5110,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt20_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt20_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt20; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt20_Be; +#else + traits.portable_alias = PcmFormat_SInt20_Le; #endif traits.bit_depth = 20; traits.bit_width = 20; @@ -4934,7 +5129,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt20_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt20; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt20_Be; traits.bit_depth = 20; traits.bit_width = 20; break; @@ -4944,7 +5146,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt20_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt20; +#endif + traits.portable_alias = PcmFormat_SInt20_Le; traits.bit_depth = 20; traits.bit_width = 20; break; @@ -4955,10 +5164,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt20_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt20_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt20; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt20_Be; +#else + traits.portable_alias = PcmFormat_UInt20_Le; #endif traits.bit_depth = 20; traits.bit_width = 20; @@ -4969,7 +5183,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt20_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt20; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt20_Be; traits.bit_depth = 20; traits.bit_width = 20; break; @@ -4979,7 +5200,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt20_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt20; +#endif + traits.portable_alias = PcmFormat_UInt20_Le; traits.bit_depth = 20; traits.bit_width = 20; break; @@ -4990,10 +5218,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt20_3_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt20_3_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt20_3; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt20_3_Be; +#else + traits.portable_alias = PcmFormat_SInt20_3_Le; #endif traits.bit_depth = 20; traits.bit_width = 24; @@ -5004,7 +5237,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt20_3_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt20_3; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt20_3_Be; traits.bit_depth = 20; traits.bit_width = 24; break; @@ -5014,7 +5254,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt20_3_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt20_3; +#endif + traits.portable_alias = PcmFormat_SInt20_3_Le; traits.bit_depth = 20; traits.bit_width = 24; break; @@ -5025,10 +5272,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt20_3_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt20_3_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt20_3; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt20_3_Be; +#else + traits.portable_alias = PcmFormat_UInt20_3_Le; #endif traits.bit_depth = 20; traits.bit_width = 24; @@ -5039,7 +5291,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt20_3_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt20_3; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt20_3_Be; traits.bit_depth = 20; traits.bit_width = 24; break; @@ -5049,7 +5308,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt20_3_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt20_3; +#endif + traits.portable_alias = PcmFormat_UInt20_3_Le; traits.bit_depth = 20; traits.bit_width = 24; break; @@ -5060,10 +5326,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt20_4_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt20_4_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt20_4; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt20_4_Be; +#else + traits.portable_alias = PcmFormat_SInt20_4_Le; #endif traits.bit_depth = 20; traits.bit_width = 32; @@ -5074,7 +5345,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt20_4_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt20_4; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt20_4_Be; traits.bit_depth = 20; traits.bit_width = 32; break; @@ -5084,7 +5362,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt20_4_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt20_4; +#endif + traits.portable_alias = PcmFormat_SInt20_4_Le; traits.bit_depth = 20; traits.bit_width = 32; break; @@ -5095,10 +5380,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt20_4_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt20_4_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt20_4; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt20_4_Be; +#else + traits.portable_alias = PcmFormat_UInt20_4_Le; #endif traits.bit_depth = 20; traits.bit_width = 32; @@ -5109,7 +5399,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt20_4_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt20_4; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt20_4_Be; traits.bit_depth = 20; traits.bit_width = 32; break; @@ -5119,7 +5416,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt20_4_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt20_4; +#endif + traits.portable_alias = PcmFormat_UInt20_4_Le; traits.bit_depth = 20; traits.bit_width = 32; break; @@ -5130,10 +5434,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt24_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt24_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt24; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt24_Be; +#else + traits.portable_alias = PcmFormat_SInt24_Le; #endif traits.bit_depth = 24; traits.bit_width = 24; @@ -5144,7 +5453,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt24_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt24; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt24_Be; traits.bit_depth = 24; traits.bit_width = 24; break; @@ -5154,7 +5470,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt24_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt24; +#endif + traits.portable_alias = PcmFormat_SInt24_Le; traits.bit_depth = 24; traits.bit_width = 24; break; @@ -5165,10 +5488,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt24_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt24_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt24; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt24_Be; +#else + traits.portable_alias = PcmFormat_UInt24_Le; #endif traits.bit_depth = 24; traits.bit_width = 24; @@ -5179,7 +5507,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt24_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt24; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt24_Be; traits.bit_depth = 24; traits.bit_width = 24; break; @@ -5189,7 +5524,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt24_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt24; +#endif + traits.portable_alias = PcmFormat_UInt24_Le; traits.bit_depth = 24; traits.bit_width = 24; break; @@ -5200,10 +5542,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt24_4_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt24_4_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt24_4; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt24_4_Be; +#else + traits.portable_alias = PcmFormat_SInt24_4_Le; #endif traits.bit_depth = 24; traits.bit_width = 32; @@ -5214,7 +5561,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt24_4_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt24_4; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt24_4_Be; traits.bit_depth = 24; traits.bit_width = 32; break; @@ -5224,7 +5578,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt24_4_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt24_4; +#endif + traits.portable_alias = PcmFormat_SInt24_4_Le; traits.bit_depth = 24; traits.bit_width = 32; break; @@ -5235,10 +5596,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt24_4_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt24_4_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt24_4; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt24_4_Be; +#else + traits.portable_alias = PcmFormat_UInt24_4_Le; #endif traits.bit_depth = 24; traits.bit_width = 32; @@ -5249,7 +5615,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt24_4_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt24_4; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt24_4_Be; traits.bit_depth = 24; traits.bit_width = 32; break; @@ -5259,7 +5632,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt24_4_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt24_4; +#endif + traits.portable_alias = PcmFormat_UInt24_4_Le; traits.bit_depth = 24; traits.bit_width = 32; break; @@ -5270,10 +5650,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt32_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt32_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt32; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt32_Be; +#else + traits.portable_alias = PcmFormat_SInt32_Le; #endif traits.bit_depth = 32; traits.bit_width = 32; @@ -5284,7 +5669,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt32_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt32; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt32_Be; traits.bit_depth = 32; traits.bit_width = 32; break; @@ -5294,7 +5686,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt32_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt32; +#endif + traits.portable_alias = PcmFormat_SInt32_Le; traits.bit_depth = 32; traits.bit_width = 32; break; @@ -5305,10 +5704,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt32_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt32_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt32; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt32_Be; +#else + traits.portable_alias = PcmFormat_UInt32_Le; #endif traits.bit_depth = 32; traits.bit_width = 32; @@ -5319,7 +5723,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt32_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt32; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt32_Be; traits.bit_depth = 32; traits.bit_width = 32; break; @@ -5329,7 +5740,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt32_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt32; +#endif + traits.portable_alias = PcmFormat_UInt32_Le; traits.bit_depth = 32; traits.bit_width = 32; break; @@ -5340,10 +5758,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_SInt64_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_SInt64_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_SInt64; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_SInt64_Be; +#else + traits.portable_alias = PcmFormat_SInt64_Le; #endif traits.bit_depth = 64; traits.bit_width = 64; @@ -5354,7 +5777,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_SInt64_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_SInt64; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_SInt64_Be; traits.bit_depth = 64; traits.bit_width = 64; break; @@ -5364,7 +5794,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_SInt64_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_SInt64; +#endif + traits.portable_alias = PcmFormat_SInt64_Le; traits.bit_depth = 64; traits.bit_width = 64; break; @@ -5375,10 +5812,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = false; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_UInt64_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_UInt64_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_UInt64; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_UInt64_Be; +#else + traits.portable_alias = PcmFormat_UInt64_Le; #endif traits.bit_depth = 64; traits.bit_width = 64; @@ -5389,7 +5831,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = false; - traits.canon_id = PcmFormat_UInt64_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_UInt64; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_UInt64_Be; traits.bit_depth = 64; traits.bit_width = 64; break; @@ -5399,7 +5848,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = true; traits.is_signed = false; traits.is_little = true; - traits.canon_id = PcmFormat_UInt64_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_UInt64; +#endif + traits.portable_alias = PcmFormat_UInt64_Le; traits.bit_depth = 64; traits.bit_width = 64; break; @@ -5410,10 +5866,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_Float32_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_Float32_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_Float32; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_Float32_Be; +#else + traits.portable_alias = PcmFormat_Float32_Le; #endif traits.bit_depth = 25; traits.bit_width = 32; @@ -5424,7 +5885,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = false; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_Float32_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_Float32; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_Float32_Be; traits.bit_depth = 25; traits.bit_width = 32; break; @@ -5434,7 +5902,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = false; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_Float32_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_Float32; +#endif + traits.portable_alias = PcmFormat_Float32_Le; traits.bit_depth = 25; traits.bit_width = 32; break; @@ -5445,10 +5920,15 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_signed = true; #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = PcmFormat_Float64_Be; #else traits.is_little = true; - traits.canon_id = PcmFormat_Float64_Le; +#endif + traits.is_native = true; + traits.native_alias = PcmFormat_Float64; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = PcmFormat_Float64_Be; +#else + traits.portable_alias = PcmFormat_Float64_Le; #endif traits.bit_depth = 53; traits.bit_width = 64; @@ -5459,7 +5939,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = false; traits.is_signed = true; traits.is_little = false; - traits.canon_id = PcmFormat_Float64_Be; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = PcmFormat_Float64; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = PcmFormat_Float64_Be; traits.bit_depth = 53; traits.bit_width = 64; break; @@ -5469,7 +5956,14 @@ PcmTraits pcm_format_traits(PcmFormat format) { traits.is_integer = false; traits.is_signed = true; traits.is_little = true; - traits.canon_id = PcmFormat_Float64_Le; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = PcmFormat_Float64; +#endif + traits.portable_alias = PcmFormat_Float64_Le; traits.bit_depth = 53; traits.bit_width = 64; break; diff --git a/src/internal_modules/roc_audio/pcm_format.h b/src/internal_modules/roc_audio/pcm_format.h index 664d13fdb..cbf6aac0c 100644 --- a/src/internal_modules/roc_audio/pcm_format.h +++ b/src/internal_modules/roc_audio/pcm_format.h @@ -211,8 +211,18 @@ struct PcmTraits { //! True for little-endian formats. bool is_little; - //! Canonical identifier of the same format. - PcmFormat canon_id; + //! True if format has same endian as current CPU. + bool is_native; + + //! Same format, but with removed _Be or _Le suffix. + //! Value depends on current CPU. + //! Set only if format's endian matches current CPU's endian. + PcmFormat native_alias; + + //! Same format, but with added _Be or _Le suffix. + //! Value depends on current CPU. + //! Always set. If format already had suffix, set to the same format. + PcmFormat portable_alias; //! Number of significant bits per sample. size_t bit_depth; @@ -225,7 +235,9 @@ struct PcmTraits { , is_integer(false) , is_signed(false) , is_little(false) - , canon_id(PcmFormat_Invalid) + , is_native(false) + , native_alias(PcmFormat_Invalid) + , portable_alias(PcmFormat_Invalid) , bit_depth(0) , bit_width(0) { } diff --git a/src/internal_modules/roc_audio/pcm_format_gen.py b/src/internal_modules/roc_audio/pcm_format_gen.py index 8c19f6277..eebdb24cc 100755 --- a/src/internal_modules/roc_audio/pcm_format_gen.py +++ b/src/internal_modules/roc_audio/pcm_format_gen.py @@ -979,14 +979,36 @@ def nth_chars(codes, prefix=()): {% if endian == 'Native' %} #if ROC_CPU_ENDIAN == ROC_CPU_BE traits.is_little = false; - traits.canon_id = {{ make_enum_name(code, 'Big') }}; #else traits.is_little = true; - traits.canon_id = {{ make_enum_name(code, 'Little') }}; #endif -{% else %} - traits.is_little = {{ str(endian == 'Little').lower() }}; - traits.canon_id = {{ make_enum_name(code, endian) }}; + traits.is_native = true; + traits.native_alias = {{ make_enum_name(code, endian) }}; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.portable_alias = {{ make_enum_name(code, 'Big') }}; +#else + traits.portable_alias = {{ make_enum_name(code, 'Little') }}; +#endif +{% elif endian == 'Big' %} + traits.is_little = false; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = true; + traits.native_alias = {{ make_enum_name(code, 'Native') }}; +#else + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#endif + traits.portable_alias = {{ make_enum_name(code, endian) }}; +{% elif endian == 'Little' %} + traits.is_little = true; +#if ROC_CPU_ENDIAN == ROC_CPU_BE + traits.is_native = false; + traits.native_alias = PcmFormat_Invalid; +#else + traits.is_native = true; + traits.native_alias = {{ make_enum_name(code, 'Native') }}; +#endif + traits.portable_alias = {{ make_enum_name(code, endian) }}; {% endif %} traits.bit_depth = {{ code.depth }}; traits.bit_width = {{ code.packed_width }}; diff --git a/src/internal_modules/roc_audio/sample_spec.cpp b/src/internal_modules/roc_audio/sample_spec.cpp index d9467e0ca..214c5b86f 100644 --- a/src/internal_modules/roc_audio/sample_spec.cpp +++ b/src/internal_modules/roc_audio/sample_spec.cpp @@ -62,13 +62,13 @@ core::nanoseconds_t nsamples_2_ns(const float n_samples, const size_t sample_rat return (core::nanoseconds_t)val; } -PcmFormat get_pcm_canon_format(PcmFormat fmt) { +PcmFormat get_pcm_portable_format(PcmFormat fmt) { if (fmt == PcmFormat_Invalid) { return PcmFormat_Invalid; } const PcmTraits traits = pcm_format_traits(fmt); - return traits.canon_id; + return traits.portable_alias; } size_t get_pcm_sample_width(PcmFormat fmt) { @@ -86,21 +86,24 @@ SampleSpec::SampleSpec() : sample_rate_(0) , sample_fmt_(SampleFormat_Invalid) , pcm_fmt_(PcmFormat_Invalid) - , pcm_width_(0) { + , pcm_width_(0) + , channel_set_() { } SampleSpec::SampleSpec(const size_t sample_rate, const PcmFormat pcm_fmt, const ChannelSet& channel_set) - : sample_rate_(sample_rate) - , sample_fmt_(SampleFormat_Pcm) - , pcm_fmt_(pcm_fmt) - , pcm_width_(get_pcm_sample_width(pcm_fmt)) + : sample_rate_(0) + , sample_fmt_(SampleFormat_Invalid) + , pcm_fmt_(PcmFormat_Invalid) + , pcm_width_(0) , channel_set_(channel_set) { - roc_panic_if_msg(sample_rate_ == 0, "sample spec: invalid sample rate"); - roc_panic_if_msg(pcm_fmt_ == PcmFormat_Invalid || pcm_width_ == 0, - "sample spec: invalid pcm format"); - roc_panic_if_msg(!channel_set_.is_valid(), "sample spec: invalid channel set"); + set_sample_format(SampleFormat_Pcm); + set_pcm_format(pcm_fmt); + set_sample_rate(sample_rate); + + roc_panic_if_msg(!is_valid(), "sample spec: attempt to construct invalid spec: %s", + sample_spec_to_str(*this).c_str()); } SampleSpec::SampleSpec(const size_t sample_rate, @@ -108,21 +111,24 @@ SampleSpec::SampleSpec(const size_t sample_rate, const ChannelLayout channel_layout, ChannelOrder channel_order, const ChannelMask channel_mask) - : sample_rate_(sample_rate) - , sample_fmt_(SampleFormat_Pcm) - , pcm_fmt_(pcm_fmt) - , pcm_width_(get_pcm_sample_width(pcm_fmt)) + : sample_rate_(0) + , sample_fmt_(SampleFormat_Invalid) + , pcm_fmt_(PcmFormat_Invalid) + , pcm_width_(0) , channel_set_(channel_layout, channel_order, channel_mask) { - roc_panic_if_msg(sample_rate_ == 0, "sample spec: invalid sample rate"); - roc_panic_if_msg(pcm_fmt_ == PcmFormat_Invalid || pcm_width_ == 0, - "sample spec: invalid pcm format"); - roc_panic_if_msg(!channel_set_.is_valid(), "sample spec: invalid channel set"); + set_sample_format(SampleFormat_Pcm); + set_pcm_format(pcm_fmt); + set_sample_rate(sample_rate); + + roc_panic_if_msg(!is_valid(), "sample spec: attempt to construct invalid spec: %s", + sample_spec_to_str(*this).c_str()); } bool SampleSpec::operator==(const SampleSpec& other) const { return sample_fmt_ == other.sample_fmt_ - && (sample_fmt_ != SampleFormat_Pcm || pcm_fmt_ == other.pcm_fmt_ - || get_pcm_canon_format(pcm_fmt_) == get_pcm_canon_format(other.pcm_fmt_)) + && (sample_fmt_ != SampleFormat_Pcm + || get_pcm_portable_format(pcm_fmt_) + == get_pcm_portable_format(other.pcm_fmt_)) && sample_rate_ == other.sample_rate_ && channel_set_ == other.channel_set_; } @@ -132,7 +138,7 @@ bool SampleSpec::operator!=(const SampleSpec& other) const { bool SampleSpec::is_valid() const { return sample_fmt_ != SampleFormat_Invalid - && ((sample_fmt_ == SampleFormat_Pcm) == (pcm_fmt_ != PcmFormat_Invalid)) + && (sample_fmt_ != SampleFormat_Pcm || pcm_fmt_ != PcmFormat_Invalid) && sample_rate_ != 0 && channel_set_.is_valid(); } @@ -143,7 +149,7 @@ bool SampleSpec::is_empty() const { bool SampleSpec::is_raw() const { return sample_fmt_ == SampleFormat_Pcm - && get_pcm_canon_format(pcm_fmt_) == get_pcm_canon_format(Sample_RawFormat); + && get_pcm_portable_format(pcm_fmt_) == get_pcm_portable_format(Sample_RawFormat); } void SampleSpec::clear() { @@ -388,7 +394,7 @@ void SampleSpec::validate_frame(Frame& frame) const { } } -bool SampleSpec::validate_frame_size(size_t n_bytes) { +bool SampleSpec::is_valid_frame_size(size_t n_bytes) { roc_panic_if_msg(!is_valid(), "sample spec: attempt to use invalid spec: %s", sample_spec_to_str(*this).c_str()); diff --git a/src/internal_modules/roc_audio/sample_spec.h b/src/internal_modules/roc_audio/sample_spec.h index 9996fadf3..99450ae07 100644 --- a/src/internal_modules/roc_audio/sample_spec.h +++ b/src/internal_modules/roc_audio/sample_spec.h @@ -250,7 +250,7 @@ class SampleSpec { //! Check if frame size is multiple of sample size and channel count. //! Returns false if size is invalid. - ROC_ATTR_NODISCARD bool validate_frame_size(size_t n_bytes); + bool is_valid_frame_size(size_t n_bytes); //! Cap duration to fit given buffer size in bytes. //! Returns @p duration or smaller value. diff --git a/src/internal_modules/roc_node/receiver.cpp b/src/internal_modules/roc_node/receiver.cpp index cc413bdbf..cb8178c22 100644 --- a/src/internal_modules/roc_node/receiver.cpp +++ b/src/internal_modules/roc_node/receiver.cpp @@ -335,7 +335,7 @@ status::StatusCode Receiver::read_frame(void* bytes, size_t n_bytes) { roc_panic_if(!bytes); roc_panic_if(n_bytes == 0); - if (!sample_spec_.validate_frame_size(n_bytes)) { + if (!sample_spec_.is_valid_frame_size(n_bytes)) { return status::StatusBadBuffer; } diff --git a/src/internal_modules/roc_node/receiver_decoder.cpp b/src/internal_modules/roc_node/receiver_decoder.cpp index 67949cba8..458d0e618 100644 --- a/src/internal_modules/roc_node/receiver_decoder.cpp +++ b/src/internal_modules/roc_node/receiver_decoder.cpp @@ -265,7 +265,7 @@ status::StatusCode ReceiverDecoder::read_frame(void* bytes, size_t n_bytes) { roc_panic_if(!bytes); roc_panic_if(n_bytes == 0); - if (!sample_spec_.validate_frame_size(n_bytes)) { + if (!sample_spec_.is_valid_frame_size(n_bytes)) { return status::StatusBadBuffer; } diff --git a/src/internal_modules/roc_node/sender.cpp b/src/internal_modules/roc_node/sender.cpp index b0f8e8baf..de29db82b 100644 --- a/src/internal_modules/roc_node/sender.cpp +++ b/src/internal_modules/roc_node/sender.cpp @@ -381,7 +381,7 @@ status::StatusCode Sender::write_frame(const void* bytes, size_t n_bytes) { roc_panic_if(!bytes); roc_panic_if(n_bytes == 0); - if (!sample_spec_.validate_frame_size(n_bytes)) { + if (!sample_spec_.is_valid_frame_size(n_bytes)) { return status::StatusBadBuffer; } diff --git a/src/internal_modules/roc_node/sender_encoder.cpp b/src/internal_modules/roc_node/sender_encoder.cpp index f5f1b6650..624cec50e 100644 --- a/src/internal_modules/roc_node/sender_encoder.cpp +++ b/src/internal_modules/roc_node/sender_encoder.cpp @@ -282,7 +282,7 @@ status::StatusCode SenderEncoder::write_frame(const void* bytes, size_t n_bytes) roc_panic_if(!bytes); roc_panic_if(n_bytes == 0); - if (!sample_spec_.validate_frame_size(n_bytes)) { + if (!sample_spec_.is_valid_frame_size(n_bytes)) { return status::StatusBadBuffer; }