Tristan Matthews | 0a329cc | 2013-07-17 13:20:14 -0400 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
| 3 | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) |
| 4 | * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | */ |
| 20 | #ifndef __PJMEDIA_TYPES_H__ |
| 21 | #define __PJMEDIA_TYPES_H__ |
| 22 | |
| 23 | /** |
| 24 | * @file pjmedia/types.h Basic Types |
| 25 | * @brief Basic PJMEDIA types. |
| 26 | */ |
| 27 | |
| 28 | #include <pjmedia/config.h> |
| 29 | #include <pj/sock.h> |
| 30 | #include <pj/types.h> |
| 31 | |
| 32 | |
| 33 | /** |
| 34 | * @defgroup PJMEDIA_PORT Media Ports Framework |
| 35 | * @brief Extensible framework for media terminations |
| 36 | */ |
| 37 | |
| 38 | |
| 39 | /** |
| 40 | * @defgroup PJMEDIA_FRAME_OP Audio Manipulation Algorithms |
| 41 | * @brief Algorithms to manipulate audio frames |
| 42 | */ |
| 43 | |
| 44 | /** |
| 45 | * @defgroup PJMEDIA_TYPES Basic Types |
| 46 | * @ingroup PJMEDIA_BASE |
| 47 | * @brief Basic PJMEDIA types and operations. |
| 48 | * @{ |
| 49 | */ |
| 50 | |
| 51 | /** |
| 52 | * Top most media type. See also #pjmedia_type_name(). |
| 53 | */ |
| 54 | typedef enum pjmedia_type |
| 55 | { |
| 56 | /** Type is not specified. */ |
| 57 | PJMEDIA_TYPE_NONE, |
| 58 | |
| 59 | /** The media is audio */ |
| 60 | PJMEDIA_TYPE_AUDIO, |
| 61 | |
| 62 | /** The media is video. */ |
| 63 | PJMEDIA_TYPE_VIDEO, |
| 64 | |
| 65 | /** The media is application. */ |
| 66 | PJMEDIA_TYPE_APPLICATION, |
| 67 | |
| 68 | /** The media type is unknown or unsupported. */ |
| 69 | PJMEDIA_TYPE_UNKNOWN |
| 70 | |
| 71 | } pjmedia_type; |
| 72 | |
| 73 | |
| 74 | /** |
| 75 | * Media transport protocol. |
| 76 | */ |
| 77 | typedef enum pjmedia_tp_proto |
| 78 | { |
| 79 | /** No transport type */ |
| 80 | PJMEDIA_TP_PROTO_NONE = 0, |
| 81 | |
| 82 | /** RTP using A/V profile */ |
| 83 | PJMEDIA_TP_PROTO_RTP_AVP, |
| 84 | |
| 85 | /** Secure RTP */ |
| 86 | PJMEDIA_TP_PROTO_RTP_SAVP, |
| 87 | |
| 88 | /** Unknown */ |
| 89 | PJMEDIA_TP_PROTO_UNKNOWN |
| 90 | |
| 91 | } pjmedia_tp_proto; |
| 92 | |
| 93 | |
| 94 | /** |
| 95 | * Media direction. |
| 96 | */ |
| 97 | typedef enum pjmedia_dir |
| 98 | { |
| 99 | /** None */ |
| 100 | PJMEDIA_DIR_NONE = 0, |
| 101 | |
| 102 | /** Encoding (outgoing to network) stream, also known as capture */ |
| 103 | PJMEDIA_DIR_ENCODING = 1, |
| 104 | |
| 105 | /** Same as encoding direction. */ |
| 106 | PJMEDIA_DIR_CAPTURE = PJMEDIA_DIR_ENCODING, |
| 107 | |
| 108 | /** Decoding (incoming from network) stream, also known as playback. */ |
| 109 | PJMEDIA_DIR_DECODING = 2, |
| 110 | |
| 111 | /** Same as decoding. */ |
| 112 | PJMEDIA_DIR_PLAYBACK = PJMEDIA_DIR_DECODING, |
| 113 | |
| 114 | /** Same as decoding. */ |
| 115 | PJMEDIA_DIR_RENDER = PJMEDIA_DIR_DECODING, |
| 116 | |
| 117 | /** Incoming and outgoing stream, same as PJMEDIA_DIR_CAPTURE_PLAYBACK */ |
| 118 | PJMEDIA_DIR_ENCODING_DECODING = 3, |
| 119 | |
| 120 | /** Same as ENCODING_DECODING */ |
| 121 | PJMEDIA_DIR_CAPTURE_PLAYBACK = PJMEDIA_DIR_ENCODING_DECODING, |
| 122 | |
| 123 | /** Same as ENCODING_DECODING */ |
| 124 | PJMEDIA_DIR_CAPTURE_RENDER = PJMEDIA_DIR_ENCODING_DECODING |
| 125 | |
| 126 | } pjmedia_dir; |
| 127 | |
| 128 | |
| 129 | /** |
| 130 | * Opaque declaration of media endpoint. |
| 131 | */ |
| 132 | typedef struct pjmedia_endpt pjmedia_endpt; |
| 133 | |
| 134 | /* |
| 135 | * Forward declaration for stream (needed by transport). |
| 136 | */ |
| 137 | typedef struct pjmedia_stream pjmedia_stream; |
| 138 | |
| 139 | /** |
| 140 | * Enumeration for picture coordinate base. |
| 141 | */ |
| 142 | typedef enum pjmedia_coord_base |
| 143 | { |
| 144 | /** |
| 145 | * This specifies that the pixel [0, 0] location is at the left-top |
| 146 | * position. |
| 147 | */ |
| 148 | PJMEDIA_COORD_BASE_LEFT_TOP, |
| 149 | |
| 150 | /** |
| 151 | * This specifies that the pixel [0, 0] location is at the left-bottom |
| 152 | * position. |
| 153 | */ |
| 154 | PJMEDIA_COORD_BASE_LEFT_BOTTOM |
| 155 | |
| 156 | } pjmedia_coord_base; |
| 157 | |
| 158 | /** |
| 159 | * This structure is used to represent rational numbers. |
| 160 | */ |
| 161 | typedef struct pjmedia_ratio |
| 162 | { |
| 163 | int num; /** < Numerator. */ |
| 164 | int denum; /** < Denumerator. */ |
| 165 | } pjmedia_ratio; |
| 166 | |
| 167 | /** |
| 168 | * This structure represent a coordinate. |
| 169 | */ |
| 170 | typedef struct pjmedia_coord |
| 171 | { |
| 172 | int x; /**< X position of the coordinate */ |
| 173 | int y; /**< Y position of the coordinate */ |
| 174 | } pjmedia_coord; |
| 175 | |
| 176 | /** |
| 177 | * This structure represents rectangle size. |
| 178 | */ |
| 179 | typedef struct pjmedia_rect_size |
| 180 | { |
| 181 | unsigned w; /**< The width. */ |
| 182 | unsigned h; /**< The height. */ |
| 183 | } pjmedia_rect_size; |
| 184 | |
| 185 | /** |
| 186 | * This structure describes a rectangle. |
| 187 | */ |
| 188 | typedef struct pjmedia_rect |
| 189 | { |
| 190 | pjmedia_coord coord; /**< The position. */ |
| 191 | pjmedia_rect_size size; /**< The size. */ |
| 192 | } pjmedia_rect; |
| 193 | |
| 194 | /** |
| 195 | * Enumeration for video/picture orientation. |
| 196 | */ |
| 197 | typedef enum pjmedia_orient |
| 198 | { |
| 199 | /** |
| 200 | * Unknown orientation. |
| 201 | */ |
| 202 | PJMEDIA_ORIENT_UNKNOWN, |
| 203 | |
| 204 | /** |
| 205 | * Natural orientation, e.g: sky upside on landscape view, head upside |
| 206 | * on human portrait. |
| 207 | */ |
| 208 | PJMEDIA_ORIENT_NATURAL, |
| 209 | |
| 210 | /** |
| 211 | * Specifies that the video/picture needs to be rotated 90 degrees |
| 212 | * clockwise to be displayed in natural orientation. |
| 213 | */ |
| 214 | PJMEDIA_ORIENT_ROTATE_90DEG, |
| 215 | |
| 216 | /** |
| 217 | * Specifies that the video/picture needs to be rotated 180 degrees |
| 218 | * clockwise to be displayed in natural orientation. |
| 219 | */ |
| 220 | PJMEDIA_ORIENT_ROTATE_180DEG, |
| 221 | |
| 222 | /** |
| 223 | * Specifies that the video/picture needs to be rotated 270 degrees |
| 224 | * clockwise to be displayed in natural orientation. |
| 225 | */ |
| 226 | PJMEDIA_ORIENT_ROTATE_270DEG |
| 227 | |
| 228 | } pjmedia_orient; |
| 229 | |
| 230 | |
| 231 | /** |
| 232 | * Macro for packing format from a four character code, similar to FOURCC. |
| 233 | */ |
| 234 | #define PJMEDIA_FOURCC(C1, C2, C3, C4) ( C4<<24 | C3<<16 | C2<<8 | C1 ) |
| 235 | |
| 236 | |
| 237 | /** |
| 238 | * Utility function to return the string name for a pjmedia_type. |
| 239 | * |
| 240 | * @param t The media type. |
| 241 | * |
| 242 | * @return String. |
| 243 | */ |
| 244 | PJ_DECL(const char*) pjmedia_type_name(pjmedia_type t); |
| 245 | |
| 246 | /** |
| 247 | * A utility function to convert fourcc type of value to four letters string. |
| 248 | * |
| 249 | * @param sig The fourcc value. |
| 250 | * @param buf Buffer to store the string, which MUST be at least |
| 251 | * five bytes long. |
| 252 | * |
| 253 | * @return The string. |
| 254 | */ |
| 255 | PJ_INLINE(const char*) pjmedia_fourcc_name(pj_uint32_t sig, char buf[]) |
| 256 | { |
| 257 | buf[3] = (char)((sig >> 24) & 0xFF); |
| 258 | buf[2] = (char)((sig >> 16) & 0xFF); |
| 259 | buf[1] = (char)((sig >> 8) & 0xFF); |
| 260 | buf[0] = (char)((sig >> 0) & 0xFF); |
| 261 | buf[4] = '\0'; |
| 262 | return buf; |
| 263 | } |
| 264 | |
| 265 | |
| 266 | /** |
| 267 | * @} |
| 268 | */ |
| 269 | |
| 270 | |
| 271 | #endif /* __PJMEDIA_TYPES_H__ */ |
| 272 | |