Home | History | Annotate | Download | only in src
      1 /*
      2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
      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 /*
     12  *
     13  * This file contains type definitions used in all WebRtc APIs.
     14  *
     15  */
     16 
     17 /* Reserved words definitions */
     18 #define WEBRTC_EXTERN extern
     19 #define G_CONST const
     20 #define WEBRTC_INLINE extern __inline
     21 
     22 #ifndef WEBRTC_TYPEDEFS_H
     23 #define WEBRTC_TYPEDEFS_H
     24 
     25 /* Define WebRtc preprocessor identifiers based on the current build platform */
     26 #if defined(WIN32)
     27     // Windows & Windows Mobile
     28     #if !defined(WEBRTC_TARGET_PC)
     29         #define WEBRTC_TARGET_PC
     30     #endif
     31 #elif defined(__APPLE__)
     32     // Mac OS X
     33     #if defined(__LITTLE_ENDIAN__ ) //TODO: is this used?
     34         #if !defined(WEBRTC_TARGET_MAC_INTEL)
     35             #define WEBRTC_TARGET_MAC_INTEL
     36         #endif
     37     #else
     38         #if !defined(WEBRTC_TARGET_MAC)
     39             #define WEBRTC_TARGET_MAC
     40         #endif
     41     #endif
     42 #else
     43     // Linux etc.
     44     #if !defined(WEBRTC_TARGET_PC)
     45         #define WEBRTC_TARGET_PC
     46     #endif
     47 #endif
     48 
     49 #if defined(WEBRTC_TARGET_PC)
     50 
     51 #if !defined(_MSC_VER)
     52   #include <stdint.h>
     53 #else
     54     // Define C99 equivalent types.
     55     // Since MSVC doesn't include these headers, we have to write our own
     56     // version to provide a compatibility layer between MSVC and the WebRTC
     57     // headers.
     58     typedef signed char         int8_t;
     59     typedef signed short        int16_t;
     60     typedef signed int          int32_t;
     61     typedef signed long long    int64_t;
     62     typedef unsigned char       uint8_t;
     63     typedef unsigned short      uint16_t;
     64     typedef unsigned int        uint32_t;
     65     typedef unsigned long long  uint64_t;
     66 #endif
     67 
     68 #if defined(WIN32)
     69     typedef __int64             WebRtc_Word64;
     70     typedef unsigned __int64    WebRtc_UWord64;
     71 #else
     72     typedef int64_t             WebRtc_Word64;
     73     typedef uint64_t            WebRtc_UWord64;
     74 #endif
     75     typedef int32_t             WebRtc_Word32;
     76     typedef uint32_t            WebRtc_UWord32;
     77     typedef int16_t             WebRtc_Word16;
     78     typedef uint16_t            WebRtc_UWord16;
     79     typedef char                WebRtc_Word8;
     80     typedef uint8_t             WebRtc_UWord8;
     81 
     82     /* Define endian for the platform */
     83     #define WEBRTC_LITTLE_ENDIAN
     84 
     85 #elif defined(WEBRTC_TARGET_MAC_INTEL)
     86     #include <stdint.h>
     87 
     88     typedef int64_t             WebRtc_Word64;
     89     typedef uint64_t            WebRtc_UWord64;
     90     typedef int32_t             WebRtc_Word32;
     91     typedef uint32_t            WebRtc_UWord32;
     92     typedef int16_t             WebRtc_Word16;
     93     typedef char                WebRtc_Word8;
     94     typedef uint16_t            WebRtc_UWord16;
     95     typedef uint8_t             WebRtc_UWord8;
     96 
     97     /* Define endian for the platform */
     98     #define WEBRTC_LITTLE_ENDIAN
     99 
    100 #else
    101 
    102     #error "No platform defined for WebRtc type definitions (webrtc_typedefs.h)"
    103 
    104 #endif
    105 
    106 
    107 #endif // WEBRTC_TYPEDEFS_H
    108