blob: 2ab66b14b7d66f79f8f6511f0d303af5adf4e709 [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001/*
John Koleszarc2140b82010-09-09 08:16:39 -04002 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar0ea50ce2010-05-18 11:58:33 -04003 *
John Koleszar94c52e42010-06-18 12:39:21 -04004 * Use of this source code is governed by a BSD-style license
John Koleszar09202d82010-06-04 16:19:40 -04005 * 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
John Koleszar94c52e42010-06-18 12:39:21 -04007 * in the file PATENTS. All contributing project authors may
John Koleszar09202d82010-06-04 16:19:40 -04008 * be found in the AUTHORS file in the root of the source tree.
John Koleszar0ea50ce2010-05-18 11:58:33 -04009 */
10
11
12#ifndef __VPXTYPES_H__
13#define __VPXTYPES_H__
14
John Koleszar1df03142010-05-20 14:44:18 -040015#include "vpx_ports/config.h"
John Koleszar0ea50ce2010-05-18 11:58:33 -040016
17//#include <sys/types.h>
18#ifdef _MSC_VER
19# include <basetsd.h>
20typedef SSIZE_T ssize_t;
21#endif
22
23#if defined(HAVE_STDINT_H) && HAVE_STDINT_H
24/* C99 types are preferred to vpx integer types */
25# include <stdint.h>
26#endif
27
28/*!\defgroup basetypes Base Types
29 @{*/
30#if !defined(HAVE_STDINT_H) && !defined(INT_T_DEFINED)
31# ifdef STRICTTYPES
32typedef signed char int8_t;
33typedef signed short int16_t;
34typedef signed int int32_t;
35# else
36typedef char int8_t;
37typedef short int16_t;
38typedef int int32_t;
39# endif
40typedef unsigned char uint8_t;
41typedef unsigned short uint16_t;
42typedef unsigned int uint32_t;
43#endif
44
45typedef int8_t vpxs8;
46typedef uint8_t vpxu8;
47typedef int16_t vpxs16;
48typedef uint16_t vpxu16;
49typedef int32_t vpxs32;
50typedef uint32_t vpxu32;
51typedef int32_t vpxbool;
52
53enum {vpxfalse, vpxtrue};
54
55/*!\def OTC
56 \brief a macro suitable for declaring a constant #vpxtc*/
57/*!\def VPXTC
58 \brief printf format string suitable for printing an #vpxtc*/
59#ifdef UNICODE
60# ifdef NO_WCHAR
61# error "no non-wchar support added yet"
62# else
63# include <wchar.h>
64typedef wchar_t vpxtc;
65# define OTC(str) L ## str
66# define VPXTC "ls"
67# endif /*NO_WCHAR*/
68#else
69typedef char vpxtc;
70# define OTC(str) (vpxtc*)str
71# define VPXTC "s"
72#endif /*UNICODE*/
73/*@} end - base types*/
74
75/*!\addtogroup basetypes
76 @{*/
77/*!\def VPX64
78 \brief printf format string suitable for printing an #vpxs64*/
79#if defined(HAVE_STDINT_H)
80# define VPX64 PRId64
81typedef int64_t vpxs64;
82#elif defined(HASLONGLONG)
83# undef PRId64
84# define PRId64 "lld"
85# define VPX64 PRId64
86typedef long long vpxs64;
87#elif defined(WIN32) || defined(_WIN32_WCE)
88# undef PRId64
89# define PRId64 "I64d"
90# define VPX64 PRId64
91typedef __int64 vpxs64;
92typedef unsigned __int64 vpxu64;
93#elif defined(__uClinux__) && defined(CHIP_DM642)
94# include <lddk.h>
95# undef PRId64
96# define PRId64 "lld"
97# define VPX64 PRId64
98typedef long vpxs64;
99#elif defined(__SYMBIAN32__)
100# undef PRId64
101# define PRId64 "u"
102# define VPX64 PRId64
103typedef unsigned int vpxs64;
104#else
105# error "64 bit integer type undefined for this platform!"
106#endif
107#if !defined(HAVE_STDINT_H) && !defined(INT_T_DEFINED)
108typedef vpxs64 int64_t;
109typedef vpxu64 uint64_t;
110#endif
111/*!@} end - base types*/
112
113/*!\ingroup basetypes
114 \brief Common return type*/
115typedef enum
116{
117 VPX_NOT_FOUND = -404,
118 VPX_BUFFER_EMPTY = -202,
119 VPX_BUFFER_FULL = -201,
120
121 VPX_CONNREFUSED = -102,
122 VPX_TIMEDOUT = -101,
123 VPX_WOULDBLOCK = -100,
124
125 VPX_NET_ERROR = -9,
126 VPX_INVALID_VERSION = -8,
127 VPX_INPROGRESS = -7,
128 VPX_NOT_SUPP = -6,
129 VPX_NO_MEM = -3,
130 VPX_INVALID_PARAMS = -2,
131 VPX_ERROR = -1,
132 VPX_OK = 0,
133 VPX_DONE = 1
134} vpxsc;
135
136#if defined(WIN32) || defined(_WIN32_WCE)
137# define DLLIMPORT __declspec(dllimport)
138# define DLLEXPORT __declspec(dllexport)
139# define DLLLOCAL
140#elif defined(LINUX)
141# define DLLIMPORT
142/*visibility attribute support is available in 3.4 and later.
143 see: http://gcc.gnu.org/wiki/Visibility for more info*/
144# if defined(__GNUC__) && ((__GNUC__<<16|(__GNUC_MINOR__&0xff)) >= (3<<16|4))
145# define GCC_HASCLASSVISIBILITY
146# endif /*defined(__GNUC__) && __GNUC_PREREQ(3,4)*/
147# ifdef GCC_HASCLASSVISIBILITY
148# define DLLEXPORT __attribute__ ((visibility("default")))
149# define DLLLOCAL __attribute__ ((visibility("hidden")))
150# else
151# define DLLEXPORT
152# define DLLLOCAL
153# endif /*GCC_HASCLASSVISIBILITY*/
154#endif /*platform ifdefs*/
155
156#endif /*__VPXTYPES_H__*/
157
158#undef VPXAPI
159/*!\def VPXAPI
160 \brief library calling convention/storage class attributes.
161
162 Specifies whether the function is imported through a dll
163 or is from a static library.*/
164#ifdef VPXDLL
165# ifdef VPXDLLEXPORT
166# define VPXAPI DLLEXPORT
167# else
168# define VPXAPI DLLIMPORT
169# endif /*VPXDLLEXPORT*/
170#else
171# define VPXAPI
172#endif /*VPXDLL*/