RTP Audio System
2.0.0
|
00001 // ########################################################################## 00002 // #### #### 00003 // #### RTP Audio Server Project #### 00004 // #### ============================ #### 00005 // #### #### 00006 // #### Advanced Audio Packet Defitition #### 00007 // #### #### 00008 // #### Copyright (C) 1999-2012 by Thomas Dreibholz #### 00009 // #### #### 00010 // #### Contact: #### 00011 // #### EMail: dreibh@iem.uni-due.de #### 00012 // #### WWW: https://www.nntb.no/~dreibh/rtpaudio #### 00013 // #### #### 00014 // #### ---------------------------------------------------------------- #### 00015 // #### #### 00016 // #### This program is free software: you can redistribute it and/or #### 00017 // #### modify it under the terms of the GNU General Public License as #### 00018 // #### published by the Free Software Foundation, either version 3 of #### 00019 // #### the License, or (at your option) any later version. #### 00020 // #### #### 00021 // #### This program is distributed in the hope that it will be useful, #### 00022 // #### but WITHOUT ANY WARRANTY; without even the implied warranty of #### 00023 // #### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #### 00024 // #### GNU General Public License for more details. #### 00025 // #### #### 00026 // #### You should have received a copy of the GNU General Public #### 00027 // #### License along with this program. If not, see #### 00028 // #### <http://www.gnu.org/licenses/>. #### 00029 // #### #### 00030 // ########################################################################## 00031 // $Id: advancedaudiopacket.h 1286 2011-12-18 13:43:16Z dreibh $ 00032 00033 00034 #ifndef ADVANCEDAUDIOPACKET_H 00035 #define ADVANCEDAUDIOPACKET_H 00036 00037 00038 #include "tdsystem.h" 00039 #include "mediainfo.h" 00040 #include "audioquality.h" 00041 00042 00053 struct AdvancedAudioPacket 00054 { 00055 // ====== Constructor ==================================================== 00056 public: 00060 AdvancedAudioPacket(); 00061 00062 // ====== Byte order translation ========================================= 00066 void translate(); 00067 00068 00069 // ====== Status functions =============================================== 00073 void reset(); 00074 00075 00076 // ====== Constants and static members =================================== 00080 static const card16 AdvancedAudioTypeID = 0x2961; 00081 00085 static const char AdvancedAudioTypeName[]; 00086 00090 static const card32 AdvancedAudioFormatID = 0x74660000 | AdvancedAudioTypeID; 00091 00095 static const cardinal AdvancedAudioMediaInfoPacketsPerSecond = 2; 00096 00100 static const cardinal AdvancedAudioFramesPerSecond = 35; 00101 00105 static const cardinal AdvancedAudioFrameSize = 00106 44100 * 2 * 2 / AdvancedAudioFramesPerSecond; 00107 00111 static const cardinal AdvancedAudioMaxTransferDelay = 100 * 16; // 100 ms. 00112 00116 static const cardinal AdvancedAudioMaxQualityLayers = 3; 00117 00121 static const cardinal AdvancedAudioQualityLevels = AudioQuality::QualityLevels; 00122 00123 00140 static AudioQuality calculateQualityForLimits( 00141 const AudioQualityInterface& userSetting, 00142 const AudioQualityInterface& inputQuality, 00143 const card64 totalByteRateLimit, 00144 const card64 byteRateLimitL1, 00145 const card64 byteRateLimitL2, 00146 const card64 byteRateLimitL3, 00147 const cardinal networkQualityDecrement, 00148 const cardinal headerSize, 00149 const cardinal maxPacketSize); 00150 00151 00160 static cardinal calculateFrameSize(const cardinal inputBytesPerSecond, 00161 const cardinal inputFrameSize); 00162 00163 00170 static cardinal calculateLayers(const AudioQualityInterface& quality); 00171 00172 00173 // ====== Packet data ==================================================== 00174 public: 00178 card32 FormatID; 00179 00183 card16 SamplingRate; 00184 00188 card8 Channels; 00189 00193 card8 Bits; 00194 00198 card64 Position; 00199 00203 card64 MaxPosition; 00204 00208 card8 ErrorCode; 00209 00213 card8 Flags; 00214 00218 enum AdvancedAudioFlags { 00219 AAF_ChannelLeft = (1 << 0), 00220 AAF_ChannelRight = (1 << 1), 00221 AAF_ByteUpper = (1 << 2), 00222 AAF_ByteLower = (1 << 3), 00223 AAF_MediaInfo = (1 << 4) 00224 }; 00225 00229 card16 Fragment; 00230 00234 char Data[0]; 00235 } __attribute__((packed)); 00236 00237 00238 #endif