1 /***************************************************************************** 2 * mp4a.h 3 ***************************************************************************** 4 * Copyright (C) 2010-2017 L-SMASH project 5 * 6 * Authors: Takashi Hirata <silverfilain@gmail.com> 7 * 8 * Permission to use, copy, modify, and/or distribute this software for any 9 * purpose with or without fee is hereby granted, provided that the above 10 * copyright notice and this permission notice appear in all copies. 11 * 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 *****************************************************************************/ 20 21 /* This file is available under an ISC license. */ 22 23 #ifndef MP4A_H 24 #define MP4A_H 25 26 /*************************************************************************** 27 MPEG-4 Systems for MPEG-4 Audio 28 ***************************************************************************/ 29 30 /* 14496-3 audioProfileLevelIndication */ 31 typedef enum { 32 MP4A_AUDIO_PLI_Reserved = 0x00, /* Reserved for ISO use */ 33 MP4A_AUDIO_PLI_Main_L1 = 0x01, /* Main Audio Profile L1 */ 34 MP4A_AUDIO_PLI_Main_L2 = 0x02, /* Main Audio Profile L2 */ 35 MP4A_AUDIO_PLI_Main_L3 = 0x03, /* Main Audio Profile L3 */ 36 MP4A_AUDIO_PLI_Main_L4 = 0x04, /* Main Audio Profile L4 */ 37 MP4A_AUDIO_PLI_Scalable_L1 = 0x05, /* Scalable Audio Profile L1 */ 38 MP4A_AUDIO_PLI_Scalable_L2 = 0x06, /* Scalable Audio Profile L2 */ 39 MP4A_AUDIO_PLI_Scalable_L3 = 0x07, /* Scalable Audio Profile L3 */ 40 MP4A_AUDIO_PLI_Scalable_L4 = 0x08, /* Scalable Audio Profile L4 */ 41 MP4A_AUDIO_PLI_Speech_L1 = 0x09, /* Speech Audio Profile L1 */ 42 MP4A_AUDIO_PLI_Speech_L2 = 0x0A, /* Speech Audio Profile L2 */ 43 MP4A_AUDIO_PLI_Synthetic_L1 = 0x0B, /* Synthetic Audio Profile L1 */ 44 MP4A_AUDIO_PLI_Synthetic_L2 = 0x0C, /* Synthetic Audio Profile L2 */ 45 MP4A_AUDIO_PLI_Synthetic_L3 = 0x0D, /* Synthetic Audio Profile L3 */ 46 MP4A_AUDIO_PLI_HighQuality_L1 = 0x0E, /* High Quality Audio Profile L1 */ 47 MP4A_AUDIO_PLI_HighQuality_L2 = 0x0F, /* High Quality Audio Profile L2 */ 48 MP4A_AUDIO_PLI_HighQuality_L3 = 0x10, /* High Quality Audio Profile L3 */ 49 MP4A_AUDIO_PLI_HighQuality_L4 = 0x11, /* High Quality Audio Profile L4 */ 50 MP4A_AUDIO_PLI_HighQuality_L5 = 0x12, /* High Quality Audio Profile L5 */ 51 MP4A_AUDIO_PLI_HighQuality_L6 = 0x13, /* High Quality Audio Profile L6 */ 52 MP4A_AUDIO_PLI_HighQuality_L7 = 0x14, /* High Quality Audio Profile L7 */ 53 MP4A_AUDIO_PLI_HighQuality_L8 = 0x15, /* High Quality Audio Profile L8 */ 54 MP4A_AUDIO_PLI_LowDelay_L1 = 0x16, /* Low Delay Audio Profile L1 */ 55 MP4A_AUDIO_PLI_LowDelay_L2 = 0x17, /* Low Delay Audio Profile L2 */ 56 MP4A_AUDIO_PLI_LowDelay_L3 = 0x18, /* Low Delay Audio Profile L3 */ 57 MP4A_AUDIO_PLI_LowDelay_L4 = 0x19, /* Low Delay Audio Profile L4 */ 58 MP4A_AUDIO_PLI_LowDelay_L5 = 0x1A, /* Low Delay Audio Profile L5 */ 59 MP4A_AUDIO_PLI_LowDelay_L6 = 0x1B, /* Low Delay Audio Profile L6 */ 60 MP4A_AUDIO_PLI_LowDelay_L7 = 0x1C, /* Low Delay Audio Profile L7 */ 61 MP4A_AUDIO_PLI_LowDelay_L8 = 0x1D, /* Low Delay Audio Profile L8 */ 62 MP4A_AUDIO_PLI_Natural_L1 = 0x1E, /* Natural Audio Profile L1 */ 63 MP4A_AUDIO_PLI_Natural_L2 = 0x1F, /* Natural Audio Profile L2 */ 64 MP4A_AUDIO_PLI_Natural_L3 = 0x20, /* Natural Audio Profile L3 */ 65 MP4A_AUDIO_PLI_Natural_L4 = 0x21, /* Natural Audio Profile L4 */ 66 MP4A_AUDIO_PLI_MobileInternetworking_L1 = 0x22, /* Mobile Audio Internetworking Profile L1 */ 67 MP4A_AUDIO_PLI_MobileInternetworking_L2 = 0x23, /* Mobile Audio Internetworking Profile L2 */ 68 MP4A_AUDIO_PLI_MobileInternetworking_L3 = 0x24, /* Mobile Audio Internetworking Profile L3 */ 69 MP4A_AUDIO_PLI_MobileInternetworking_L4 = 0x25, /* Mobile Audio Internetworking Profile L4 */ 70 MP4A_AUDIO_PLI_MobileInternetworking_L5 = 0x26, /* Mobile Audio Internetworking Profile L5 */ 71 MP4A_AUDIO_PLI_MobileInternetworking_L6 = 0x27, /* Mobile Audio Internetworking Profile L6 */ 72 MP4A_AUDIO_PLI_AAC_L1 = 0x28, /* AAC Profile L1 */ 73 MP4A_AUDIO_PLI_AAC_L2 = 0x29, /* AAC Profile L2 */ 74 MP4A_AUDIO_PLI_AAC_L4 = 0x2A, /* AAC Profile L4 */ 75 MP4A_AUDIO_PLI_AAC_L5 = 0x2B, /* AAC Profile L5 */ 76 MP4A_AUDIO_PLI_HE_AAC_L2 = 0x2C, /* High Efficiency AAC Profile L2 */ 77 MP4A_AUDIO_PLI_HE_AAC_L3 = 0x2D, /* High Efficiency AAC Profile L3 */ 78 MP4A_AUDIO_PLI_HE_AAC_L4 = 0x2E, /* High Efficiency AAC Profile L4 */ 79 MP4A_AUDIO_PLI_HE_AAC_L5 = 0x2F, /* High Efficiency AAC Profile L5 */ 80 MP4A_AUDIO_PLI_HE_AAC_v2_L2 = 0x30, /* High Efficiency AAC v2 Profile L2 */ 81 MP4A_AUDIO_PLI_HE_AAC_v2_L3 = 0x31, /* High Efficiency AAC v2 Profile L3 */ 82 MP4A_AUDIO_PLI_HE_AAC_v2_L4 = 0x32, /* High Efficiency AAC v2 Profile L4 */ 83 MP4A_AUDIO_PLI_HE_AAC_v2_L5 = 0x33, /* High Efficiency AAC v2 Profile L5 */ 84 MP4A_AUDIO_PLI_LowDelay_AAC_L1 = 0x34, /* Low Delay AAC Profile L1 */ 85 MP4A_AUDIO_PLI_Baseline_MPEG_Surround_L1= 0x35, /* Baseline MPEG Surround Profile L1 */ 86 MP4A_AUDIO_PLI_Baseline_MPEG_Surround_L2= 0x36, /* Baseline MPEG Surround Profile L2 */ 87 MP4A_AUDIO_PLI_Baseline_MPEG_Surround_L3= 0x37, /* Baseline MPEG Surround Profile L3 */ 88 MP4A_AUDIO_PLI_Baseline_MPEG_Surround_L4= 0x38, /* Baseline MPEG Surround Profile L4 */ 89 MP4A_AUDIO_PLI_Baseline_MPEG_Surround_L5= 0x39, /* Baseline MPEG Surround Profile L5 */ 90 MP4A_AUDIO_PLI_Baseline_MPEG_Surround_L6= 0x3A, /* Baseline MPEG Surround Profile L6 */ 91 MP4A_AUDIO_PLI_HD_AAC_L1 = 0x3B, /* High Definition AAC Profile L1 */ 92 MP4A_AUDIO_PLI_ALS_Simple_L1 = 0x3C, /* ALS Simple Profile L1 */ 93 MP4A_AUDIO_PLI_NOT_SPECIFIED = 0xFE, /* no audio profile specified */ 94 MP4A_AUDIO_PLI_NONE_REQUIRED = 0xFF, /* no audio capability required */ 95 } mp4a_audioProfileLevelIndication; 96 97 #ifndef MP4A_INTERNAL 98 99 typedef void mp4a_AudioSpecificConfig_t; 100 101 /* export for mp4sys / importer */ 102 mp4a_AudioSpecificConfig_t *mp4a_create_AudioSpecificConfig( 103 lsmash_mp4a_AudioObjectType aot, 104 uint32_t frequency, 105 uint32_t channels, 106 lsmash_mp4a_aac_sbr_mode sbr_mode, 107 uint8_t *exdata, 108 uint32_t exdata_length 109 ); 110 void mp4a_put_AudioSpecificConfig( lsmash_bs_t* bs, mp4a_AudioSpecificConfig_t* asc ); 111 void mp4a_remove_AudioSpecificConfig( mp4a_AudioSpecificConfig_t* asc ); 112 113 uint8_t *mp4a_export_AudioSpecificConfig( lsmash_mp4a_AudioObjectType aot, 114 uint32_t frequency, 115 uint32_t channels, 116 lsmash_mp4a_aac_sbr_mode sbr_mode, 117 uint8_t *exdata, 118 uint32_t exdata_length, 119 uint32_t *data_length ); 120 121 /* export for importer */ 122 extern const uint32_t mp4a_sampling_frequency_table[13][5]; 123 124 /* setup for summary */ 125 int mp4a_setup_summary_from_AudioSpecificConfig( lsmash_audio_summary_t *summary, uint8_t *dsi_payload, uint32_t dsi_payload_length ); 126 127 /* profileLevelIndication relative functions. */ 128 mp4a_audioProfileLevelIndication mp4a_get_audioProfileLevelIndication( lsmash_audio_summary_t *summary ); 129 mp4a_audioProfileLevelIndication mp4a_max_audioProfileLevelIndication( 130 mp4a_audioProfileLevelIndication a, 131 mp4a_audioProfileLevelIndication b 132 ); 133 134 #endif 135 136 #endif 137