niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #ifndef WEBRTC_COMMON_TYPES_H |
| 12 | #define WEBRTC_COMMON_TYPES_H |
| 13 | |
| 14 | #include "typedefs.h" |
| 15 | |
| 16 | #ifdef WEBRTC_EXPORT |
| 17 | #define WEBRTC_DLLEXPORT _declspec(dllexport) |
| 18 | #elif WEBRTC_DLL |
| 19 | #define WEBRTC_DLLEXPORT _declspec(dllimport) |
| 20 | #else |
| 21 | #define WEBRTC_DLLEXPORT |
| 22 | #endif |
| 23 | |
| 24 | #ifndef NULL |
| 25 | #define NULL 0 |
| 26 | #endif |
| 27 | |
henrika@webrtc.org | f75901f | 2012-01-16 08:45:42 +0000 | [diff] [blame] | 28 | #define RTP_PAYLOAD_NAME_SIZE 32 |
| 29 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 30 | namespace webrtc { |
| 31 | |
| 32 | class InStream |
| 33 | { |
| 34 | public: |
| 35 | virtual int Read(void *buf,int len) = 0; |
| 36 | virtual int Rewind() {return -1;} |
| 37 | virtual ~InStream() {} |
| 38 | protected: |
| 39 | InStream() {} |
| 40 | }; |
| 41 | |
| 42 | class OutStream |
| 43 | { |
| 44 | public: |
| 45 | virtual bool Write(const void *buf,int len) = 0; |
| 46 | virtual int Rewind() {return -1;} |
| 47 | virtual ~OutStream() {} |
| 48 | protected: |
| 49 | OutStream() {} |
| 50 | }; |
| 51 | |
| 52 | enum TraceModule |
| 53 | { |
| 54 | // not a module, triggered from the engine code |
| 55 | kTraceVoice = 0x0001, |
| 56 | // not a module, triggered from the engine code |
| 57 | kTraceVideo = 0x0002, |
| 58 | // not a module, triggered from the utility code |
| 59 | kTraceUtility = 0x0003, |
| 60 | kTraceRtpRtcp = 0x0004, |
| 61 | kTraceTransport = 0x0005, |
| 62 | kTraceSrtp = 0x0006, |
| 63 | kTraceAudioCoding = 0x0007, |
| 64 | kTraceAudioMixerServer = 0x0008, |
| 65 | kTraceAudioMixerClient = 0x0009, |
| 66 | kTraceFile = 0x000a, |
| 67 | kTraceAudioProcessing = 0x000b, |
| 68 | kTraceVideoCoding = 0x0010, |
| 69 | kTraceVideoMixer = 0x0011, |
| 70 | kTraceAudioDevice = 0x0012, |
| 71 | kTraceVideoRenderer = 0x0014, |
| 72 | kTraceVideoCapture = 0x0015, |
| 73 | kTraceVideoPreocessing = 0x0016 |
| 74 | }; |
| 75 | |
| 76 | enum TraceLevel |
| 77 | { |
| 78 | kTraceNone = 0x0000, // no trace |
| 79 | kTraceStateInfo = 0x0001, |
| 80 | kTraceWarning = 0x0002, |
| 81 | kTraceError = 0x0004, |
| 82 | kTraceCritical = 0x0008, |
| 83 | kTraceApiCall = 0x0010, |
| 84 | kTraceDefault = 0x00ff, |
| 85 | |
| 86 | kTraceModuleCall = 0x0020, |
| 87 | kTraceMemory = 0x0100, // memory info |
| 88 | kTraceTimer = 0x0200, // timing info |
| 89 | kTraceStream = 0x0400, // "continuous" stream of data |
| 90 | |
| 91 | // used for debug purposes |
| 92 | kTraceDebug = 0x0800, // debug |
| 93 | kTraceInfo = 0x1000, // debug info |
| 94 | |
| 95 | kTraceAll = 0xffff |
| 96 | }; |
| 97 | |
| 98 | // External Trace API |
| 99 | class TraceCallback |
| 100 | { |
| 101 | public: |
| 102 | virtual void Print(const TraceLevel level, |
| 103 | const char *traceString, |
| 104 | const int length) = 0; |
| 105 | protected: |
| 106 | virtual ~TraceCallback() {} |
| 107 | TraceCallback() {} |
| 108 | }; |
| 109 | |
| 110 | |
| 111 | enum FileFormats |
| 112 | { |
| 113 | kFileFormatWavFile = 1, |
| 114 | kFileFormatCompressedFile = 2, |
| 115 | kFileFormatAviFile = 3, |
| 116 | kFileFormatPreencodedFile = 4, |
| 117 | kFileFormatPcm16kHzFile = 7, |
| 118 | kFileFormatPcm8kHzFile = 8, |
| 119 | kFileFormatPcm32kHzFile = 9 |
| 120 | }; |
| 121 | |
| 122 | |
| 123 | enum ProcessingTypes |
| 124 | { |
| 125 | kPlaybackPerChannel = 0, |
| 126 | kPlaybackAllChannelsMixed, |
| 127 | kRecordingPerChannel, |
| 128 | kRecordingAllChannelsMixed |
| 129 | }; |
| 130 | |
| 131 | // Encryption enums |
| 132 | enum CipherTypes |
| 133 | { |
| 134 | kCipherNull = 0, |
| 135 | kCipherAes128CounterMode = 1 |
| 136 | }; |
| 137 | |
| 138 | enum AuthenticationTypes |
| 139 | { |
| 140 | kAuthNull = 0, |
| 141 | kAuthHmacSha1 = 3 |
| 142 | }; |
| 143 | |
| 144 | enum SecurityLevels |
| 145 | { |
| 146 | kNoProtection = 0, |
| 147 | kEncryption = 1, |
| 148 | kAuthentication = 2, |
| 149 | kEncryptionAndAuthentication = 3 |
| 150 | }; |
| 151 | |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 152 | // Interface for encrypting and decrypting regular data and rtp/rtcp packets. |
| 153 | // Implement this interface if you wish to provide an encryption scheme to |
| 154 | // the voice or video engines. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 155 | class Encryption |
| 156 | { |
| 157 | public: |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 158 | // Encrypt the given data. |
| 159 | // |
| 160 | // Args: |
| 161 | // channel: The channel to encrypt data for. |
| 162 | // in_data: The data to encrypt. This data is bytes_in bytes long. |
| 163 | // out_data: The buffer to write the encrypted data to. You may write more |
| 164 | // bytes of encrypted data than what you got as input, up to a maximum |
| 165 | // of webrtc::kViEMaxMtu if you are encrypting in the video engine, or |
| 166 | // webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine. |
| 167 | // bytes_in: The number of bytes in the input buffer. |
| 168 | // bytes_out: The number of bytes written in out_data. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 169 | virtual void encrypt( |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 170 | int channel, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 171 | unsigned char* in_data, |
| 172 | unsigned char* out_data, |
| 173 | int bytes_in, |
| 174 | int* bytes_out) = 0; |
| 175 | |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 176 | // Decrypts the given data. This should reverse the effects of encrypt(). |
| 177 | // |
| 178 | // Args: |
| 179 | // channel_no: The channel to decrypt data for. |
| 180 | // in_data: The data to decrypt. This data is bytes_in bytes long. |
| 181 | // out_data: The buffer to write the decrypted data to. You may write more |
| 182 | // bytes of decrypted data than what you got as input, up to a maximum |
| 183 | // of webrtc::kViEMaxMtu if you are encrypting in the video engine, or |
| 184 | // webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine. |
| 185 | // bytes_in: The number of bytes in the input buffer. |
| 186 | // bytes_out: The number of bytes written in out_data. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 187 | virtual void decrypt( |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 188 | int channel, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 189 | unsigned char* in_data, |
| 190 | unsigned char* out_data, |
| 191 | int bytes_in, |
| 192 | int* bytes_out) = 0; |
| 193 | |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 194 | // Encrypts a RTCP packet. Otherwise, this method has the same contract as |
| 195 | // encrypt(). |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 196 | virtual void encrypt_rtcp( |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 197 | int channel, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 198 | unsigned char* in_data, |
| 199 | unsigned char* out_data, |
| 200 | int bytes_in, |
| 201 | int* bytes_out) = 0; |
| 202 | |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 203 | // Decrypts a RTCP packet. Otherwise, this method has the same contract as |
| 204 | // decrypt(). |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 205 | virtual void decrypt_rtcp( |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 206 | int channel, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 207 | unsigned char* in_data, |
| 208 | unsigned char* out_data, |
| 209 | int bytes_in, |
| 210 | int* bytes_out) = 0; |
| 211 | |
| 212 | protected: |
| 213 | virtual ~Encryption() {} |
| 214 | Encryption() {} |
| 215 | }; |
| 216 | |
| 217 | // External transport callback interface |
| 218 | class Transport |
| 219 | { |
| 220 | public: |
| 221 | virtual int SendPacket(int channel, const void *data, int len) = 0; |
| 222 | virtual int SendRTCPPacket(int channel, const void *data, int len) = 0; |
| 223 | |
| 224 | protected: |
| 225 | virtual ~Transport() {} |
| 226 | Transport() {} |
| 227 | }; |
| 228 | |
| 229 | // ================================================================== |
| 230 | // Voice specific types |
| 231 | // ================================================================== |
| 232 | |
| 233 | // Each codec supported can be described by this structure. |
| 234 | struct CodecInst |
| 235 | { |
| 236 | int pltype; |
henrika@webrtc.org | f75901f | 2012-01-16 08:45:42 +0000 | [diff] [blame] | 237 | char plname[RTP_PAYLOAD_NAME_SIZE]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 238 | int plfreq; |
| 239 | int pacsize; |
| 240 | int channels; |
| 241 | int rate; |
| 242 | }; |
| 243 | |
| 244 | enum FrameType |
| 245 | { |
| 246 | kFrameEmpty = 0, |
| 247 | kAudioFrameSpeech = 1, |
| 248 | kAudioFrameCN = 2, |
| 249 | kVideoFrameKey = 3, // independent frame |
| 250 | kVideoFrameDelta = 4, // depends on the previus frame |
| 251 | kVideoFrameGolden = 5, // depends on a old known previus frame |
| 252 | kVideoFrameAltRef = 6 |
| 253 | }; |
| 254 | |
| 255 | // RTP |
| 256 | enum {kRtpCsrcSize = 15}; // RFC 3550 page 13 |
| 257 | |
| 258 | enum RTPDirections |
| 259 | { |
| 260 | kRtpIncoming = 0, |
| 261 | kRtpOutgoing |
| 262 | }; |
| 263 | |
| 264 | enum PayloadFrequencies |
| 265 | { |
| 266 | kFreq8000Hz = 8000, |
| 267 | kFreq16000Hz = 16000, |
| 268 | kFreq32000Hz = 32000 |
| 269 | }; |
| 270 | |
| 271 | enum VadModes // degree of bandwidth reduction |
| 272 | { |
| 273 | kVadConventional = 0, // lowest reduction |
| 274 | kVadAggressiveLow, |
| 275 | kVadAggressiveMid, |
| 276 | kVadAggressiveHigh // highest reduction |
| 277 | }; |
| 278 | |
| 279 | struct NetworkStatistics // NETEQ statistics |
| 280 | { |
| 281 | // current jitter buffer size in ms |
| 282 | WebRtc_UWord16 currentBufferSize; |
| 283 | // preferred (optimal) buffer size in ms |
| 284 | WebRtc_UWord16 preferredBufferSize; |
henrik.lundin@webrtc.org | d439870 | 2012-01-04 13:09:55 +0000 | [diff] [blame] | 285 | // adding extra delay due to "peaky jitter" |
| 286 | bool jitterPeaksFound; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 287 | // loss rate (network + late) in percent (in Q14) |
| 288 | WebRtc_UWord16 currentPacketLossRate; |
| 289 | // late loss rate in percent (in Q14) |
| 290 | WebRtc_UWord16 currentDiscardRate; |
| 291 | // fraction (of original stream) of synthesized speech inserted through |
| 292 | // expansion (in Q14) |
| 293 | WebRtc_UWord16 currentExpandRate; |
| 294 | // fraction of synthesized speech inserted through pre-emptive expansion |
| 295 | // (in Q14) |
| 296 | WebRtc_UWord16 currentPreemptiveRate; |
| 297 | // fraction of data removed through acceleration (in Q14) |
| 298 | WebRtc_UWord16 currentAccelerateRate; |
henrik.lundin@webrtc.org | d439870 | 2012-01-04 13:09:55 +0000 | [diff] [blame] | 299 | // clock-drift in parts-per-million (negative or positive) |
| 300 | int32_t clockDriftPPM; |
henrik.lundin@webrtc.org | dbba1f9 | 2011-12-20 15:45:05 +0000 | [diff] [blame] | 301 | // average packet waiting time in the jitter buffer (ms) |
| 302 | int meanWaitingTimeMs; |
| 303 | // median packet waiting time in the jitter buffer (ms) |
| 304 | int medianWaitingTimeMs; |
henrik.lundin@webrtc.org | 053c799 | 2012-01-12 14:16:44 +0000 | [diff] [blame] | 305 | // min packet waiting time in the jitter buffer (ms) |
| 306 | int minWaitingTimeMs; |
henrik.lundin@webrtc.org | dbba1f9 | 2011-12-20 15:45:05 +0000 | [diff] [blame] | 307 | // max packet waiting time in the jitter buffer (ms) |
| 308 | int maxWaitingTimeMs; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 309 | }; |
| 310 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 311 | typedef struct |
| 312 | { |
| 313 | int min; // minumum |
| 314 | int max; // maximum |
| 315 | int average; // average |
| 316 | } StatVal; |
| 317 | |
| 318 | typedef struct // All levels are reported in dBm0 |
| 319 | { |
| 320 | StatVal speech_rx; // long-term speech levels on receiving side |
| 321 | StatVal speech_tx; // long-term speech levels on transmitting side |
| 322 | StatVal noise_rx; // long-term noise/silence levels on receiving side |
| 323 | StatVal noise_tx; // long-term noise/silence levels on transmitting side |
| 324 | } LevelStatistics; |
| 325 | |
| 326 | typedef struct // All levels are reported in dB |
| 327 | { |
| 328 | StatVal erl; // Echo Return Loss |
| 329 | StatVal erle; // Echo Return Loss Enhancement |
| 330 | StatVal rerl; // RERL = ERL + ERLE |
| 331 | // Echo suppression inside EC at the point just before its NLP |
| 332 | StatVal a_nlp; |
| 333 | } EchoStatistics; |
| 334 | |
| 335 | enum TelephoneEventDetectionMethods |
| 336 | { |
| 337 | kInBand = 0, |
| 338 | kOutOfBand = 1, |
| 339 | kInAndOutOfBand = 2 |
| 340 | }; |
| 341 | |
| 342 | enum NsModes // type of Noise Suppression |
| 343 | { |
| 344 | kNsUnchanged = 0, // previously set mode |
| 345 | kNsDefault, // platform default |
| 346 | kNsConference, // conferencing default |
| 347 | kNsLowSuppression, // lowest suppression |
| 348 | kNsModerateSuppression, |
| 349 | kNsHighSuppression, |
| 350 | kNsVeryHighSuppression, // highest suppression |
| 351 | }; |
| 352 | |
| 353 | enum AgcModes // type of Automatic Gain Control |
| 354 | { |
| 355 | kAgcUnchanged = 0, // previously set mode |
| 356 | kAgcDefault, // platform default |
| 357 | // adaptive mode for use when analog volume control exists (e.g. for |
| 358 | // PC softphone) |
| 359 | kAgcAdaptiveAnalog, |
| 360 | // scaling takes place in the digital domain (e.g. for conference servers |
| 361 | // and embedded devices) |
| 362 | kAgcAdaptiveDigital, |
| 363 | // can be used on embedded devices where the the capture signal is level |
| 364 | // is predictable |
| 365 | kAgcFixedDigital |
| 366 | }; |
| 367 | |
| 368 | // EC modes |
| 369 | enum EcModes // type of Echo Control |
| 370 | { |
| 371 | kEcUnchanged = 0, // previously set mode |
| 372 | kEcDefault, // platform default |
| 373 | kEcConference, // conferencing default (aggressive AEC) |
| 374 | kEcAec, // Acoustic Echo Cancellation |
| 375 | kEcAecm, // AEC mobile |
| 376 | }; |
| 377 | |
| 378 | // AECM modes |
| 379 | enum AecmModes // mode of AECM |
| 380 | { |
| 381 | kAecmQuietEarpieceOrHeadset = 0, |
| 382 | // Quiet earpiece or headset use |
| 383 | kAecmEarpiece, // most earpiece use |
| 384 | kAecmLoudEarpiece, // Loud earpiece or quiet speakerphone use |
| 385 | kAecmSpeakerphone, // most speakerphone use (default) |
| 386 | kAecmLoudSpeakerphone // Loud speakerphone |
| 387 | }; |
| 388 | |
| 389 | // AGC configuration |
| 390 | typedef struct |
| 391 | { |
| 392 | unsigned short targetLeveldBOv; |
| 393 | unsigned short digitalCompressionGaindB; |
| 394 | bool limiterEnable; |
| 395 | } AgcConfig; // AGC configuration parameters |
| 396 | |
| 397 | enum StereoChannel |
| 398 | { |
| 399 | kStereoLeft = 0, |
| 400 | kStereoRight, |
| 401 | kStereoBoth |
| 402 | }; |
| 403 | |
| 404 | // Audio device layers |
| 405 | enum AudioLayers |
| 406 | { |
| 407 | kAudioPlatformDefault = 0, |
| 408 | kAudioWindowsWave = 1, |
| 409 | kAudioWindowsCore = 2, |
| 410 | kAudioLinuxAlsa = 3, |
| 411 | kAudioLinuxPulse = 4 |
| 412 | }; |
| 413 | |
| 414 | enum NetEqModes // NetEQ playout configurations |
| 415 | { |
| 416 | // Optimized trade-off between low delay and jitter robustness for two-way |
| 417 | // communication. |
| 418 | kNetEqDefault = 0, |
| 419 | // Improved jitter robustness at the cost of increased delay. Can be |
| 420 | // used in one-way communication. |
| 421 | kNetEqStreaming = 1, |
| 422 | // Optimzed for decodability of fax signals rather than for perceived audio |
| 423 | // quality. |
| 424 | kNetEqFax = 2, |
| 425 | }; |
| 426 | |
| 427 | enum NetEqBgnModes // NetEQ Background Noise (BGN) configurations |
| 428 | { |
| 429 | // BGN is always on and will be generated when the incoming RTP stream |
| 430 | // stops (default). |
| 431 | kBgnOn = 0, |
| 432 | // The BGN is faded to zero (complete silence) after a few seconds. |
| 433 | kBgnFade = 1, |
| 434 | // BGN is not used at all. Silence is produced after speech extrapolation |
| 435 | // has faded. |
| 436 | kBgnOff = 2, |
| 437 | }; |
| 438 | |
| 439 | enum OnHoldModes // On Hold direction |
| 440 | { |
| 441 | kHoldSendAndPlay = 0, // Put both sending and playing in on-hold state. |
| 442 | kHoldSendOnly, // Put only sending in on-hold state. |
| 443 | kHoldPlayOnly // Put only playing in on-hold state. |
| 444 | }; |
| 445 | |
| 446 | enum AmrMode |
| 447 | { |
| 448 | kRfc3267BwEfficient = 0, |
| 449 | kRfc3267OctetAligned = 1, |
| 450 | kRfc3267FileStorage = 2, |
| 451 | }; |
| 452 | |
| 453 | // ================================================================== |
| 454 | // Video specific types |
| 455 | // ================================================================== |
| 456 | |
| 457 | // Raw video types |
| 458 | enum RawVideoType |
| 459 | { |
| 460 | kVideoI420 = 0, |
| 461 | kVideoYV12 = 1, |
| 462 | kVideoYUY2 = 2, |
| 463 | kVideoUYVY = 3, |
| 464 | kVideoIYUV = 4, |
| 465 | kVideoARGB = 5, |
| 466 | kVideoRGB24 = 6, |
| 467 | kVideoRGB565 = 7, |
| 468 | kVideoARGB4444 = 8, |
| 469 | kVideoARGB1555 = 9, |
| 470 | kVideoMJPEG = 10, |
| 471 | kVideoNV12 = 11, |
| 472 | kVideoNV21 = 12, |
mikhal@webrtc.org | c00f91d | 2012-01-03 18:49:15 +0000 | [diff] [blame] | 473 | kVideoBGRA = 13, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 474 | kVideoUnknown = 99 |
| 475 | }; |
| 476 | |
| 477 | // Video codec |
| 478 | enum { kConfigParameterSize = 128}; |
| 479 | enum { kPayloadNameSize = 32}; |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 480 | enum { kMaxSimulcastStreams = 4}; |
pwestin@webrtc.org | db221d2 | 2011-12-02 11:31:08 +0000 | [diff] [blame] | 481 | enum { kMaxTemporalStreams = 4}; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 482 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 483 | enum VideoCodecComplexity |
| 484 | { |
| 485 | kComplexityNormal = 0, |
| 486 | kComplexityHigh = 1, |
| 487 | kComplexityHigher = 2, |
| 488 | kComplexityMax = 3 |
| 489 | }; |
| 490 | |
| 491 | enum VideoCodecProfile |
| 492 | { |
| 493 | kProfileBase = 0x00, |
| 494 | kProfileMain = 0x01 |
| 495 | }; |
| 496 | |
stefan@webrtc.org | efd0a48 | 2011-12-29 10:12:35 +0000 | [diff] [blame] | 497 | enum VP8ResilienceMode { |
| 498 | kResilienceOff, // The stream produced by the encoder requires a |
| 499 | // recovery frame (typically a key frame) to be |
| 500 | // decodable after a packet loss. |
| 501 | kResilientStream, // A stream produced by the encoder is resilient to |
| 502 | // packet losses, but packets within a frame subsequent |
| 503 | // to a loss can't be decoded. |
| 504 | kResilientFrames // Same as kResilientStream but with added resilience |
| 505 | // within a frame. |
| 506 | }; |
| 507 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 508 | // VP8 specific |
| 509 | struct VideoCodecVP8 |
| 510 | { |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 511 | bool pictureLossIndicationOn; |
| 512 | bool feedbackModeOn; |
| 513 | VideoCodecComplexity complexity; |
stefan@webrtc.org | efd0a48 | 2011-12-29 10:12:35 +0000 | [diff] [blame] | 514 | VP8ResilienceMode resilience; |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 515 | unsigned char numberOfTemporalLayers; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 516 | }; |
| 517 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 518 | // Unknown specific |
| 519 | struct VideoCodecGeneric |
| 520 | { |
| 521 | }; |
| 522 | |
| 523 | // Video codec types |
| 524 | enum VideoCodecType |
| 525 | { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 526 | kVideoCodecVP8, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 527 | kVideoCodecI420, |
| 528 | kVideoCodecRED, |
| 529 | kVideoCodecULPFEC, |
| 530 | kVideoCodecUnknown |
| 531 | }; |
| 532 | |
| 533 | union VideoCodecUnion |
| 534 | { |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 535 | VideoCodecVP8 VP8; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 536 | VideoCodecGeneric Generic; |
| 537 | }; |
| 538 | |
phoglund@webrtc.org | 8bfee84 | 2012-02-17 09:32:48 +0000 | [diff] [blame^] | 539 | |
| 540 | // Simulcast is when the same stream is encoded multiple times with different |
| 541 | // settings such as resolution. |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 542 | struct SimulcastStream |
| 543 | { |
| 544 | unsigned short width; |
| 545 | unsigned short height; |
| 546 | unsigned char numberOfTemporalLayers; |
| 547 | unsigned int maxBitrate; |
| 548 | unsigned int qpMax; // minimum quality |
| 549 | }; |
| 550 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 551 | // Common video codec properties |
| 552 | struct VideoCodec |
| 553 | { |
| 554 | VideoCodecType codecType; |
| 555 | char plName[kPayloadNameSize]; |
| 556 | unsigned char plType; |
| 557 | |
| 558 | unsigned short width; |
| 559 | unsigned short height; |
| 560 | |
| 561 | unsigned int startBitrate; |
| 562 | unsigned int maxBitrate; |
| 563 | unsigned int minBitrate; |
| 564 | unsigned char maxFramerate; |
| 565 | |
| 566 | VideoCodecUnion codecSpecific; |
| 567 | |
| 568 | unsigned int qpMax; |
pwestin@webrtc.org | 1da1ce0 | 2011-10-13 15:19:55 +0000 | [diff] [blame] | 569 | unsigned char numberOfSimulcastStreams; |
| 570 | SimulcastStream simulcastStream[kMaxSimulcastStreams]; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 571 | }; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 572 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 573 | #endif // WEBRTC_COMMON_TYPES_H |