| 1 | /* |
| 2 | * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | */ |
| 18 | #ifndef __PJMEDIA_VIDEODEV_VIDEODEV_ERRNO_H__ |
| 19 | #define __PJMEDIA_VIDEODEV_VIDEODEV_ERRNO_H__ |
| 20 | |
| 21 | /** |
| 22 | * @file errno.h Error Codes |
| 23 | * @brief Videodev specific error codes. |
| 24 | */ |
| 25 | |
| 26 | #include <pjmedia-videodev/config.h> |
| 27 | #include <pj/errno.h> |
| 28 | |
| 29 | /** |
| 30 | * @defgroup error_codes Error Codes |
| 31 | * @ingroup video_device_api |
| 32 | * @brief Video device library specific error codes. |
| 33 | * @{ |
| 34 | */ |
| 35 | |
| 36 | |
| 37 | PJ_BEGIN_DECL |
| 38 | |
| 39 | |
| 40 | /** |
| 41 | * Start of error code relative to PJ_ERRNO_START_USER. |
| 42 | * This value is 520000. |
| 43 | */ |
| 44 | #define PJMEDIA_VIDEODEV_ERRNO_START \ |
| 45 | (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*7) |
| 46 | #define PJMEDIA_VIDEODEV_ERRNO_END \ |
| 47 | (PJMEDIA_VIDEODEV_ERRNO_START + PJ_ERRNO_SPACE_SIZE - 1) |
| 48 | |
| 49 | |
| 50 | /************************************************************ |
| 51 | * Video Device API error codes |
| 52 | ***********************************************************/ |
| 53 | /** |
| 54 | * @hideinitializer |
| 55 | * General/unknown error. |
| 56 | */ |
| 57 | #define PJMEDIA_EVID_ERR (PJMEDIA_VIDEODEV_ERRNO_START+1) /* 520001 */ |
| 58 | |
| 59 | /** |
| 60 | * @hideinitializer |
| 61 | * Unknown error from video driver |
| 62 | */ |
| 63 | #define PJMEDIA_EVID_SYSERR (PJMEDIA_VIDEODEV_ERRNO_START+2) /* 520002 */ |
| 64 | |
| 65 | /** |
| 66 | * @hideinitializer |
| 67 | * Video subsystem not initialized |
| 68 | */ |
| 69 | #define PJMEDIA_EVID_INIT (PJMEDIA_VIDEODEV_ERRNO_START+3) /* 520003 */ |
| 70 | |
| 71 | /** |
| 72 | * @hideinitializer |
| 73 | * Invalid video device |
| 74 | */ |
| 75 | #define PJMEDIA_EVID_INVDEV (PJMEDIA_VIDEODEV_ERRNO_START+4) /* 520004 */ |
| 76 | |
| 77 | /** |
| 78 | * @hideinitializer |
| 79 | * Found no devices |
| 80 | */ |
| 81 | #define PJMEDIA_EVID_NODEV (PJMEDIA_VIDEODEV_ERRNO_START+5) /* 520005 */ |
| 82 | |
| 83 | /** |
| 84 | * @hideinitializer |
| 85 | * Unable to find default device |
| 86 | */ |
| 87 | #define PJMEDIA_EVID_NODEFDEV (PJMEDIA_VIDEODEV_ERRNO_START+6) /* 520006 */ |
| 88 | |
| 89 | /** |
| 90 | * @hideinitializer |
| 91 | * Device not ready |
| 92 | */ |
| 93 | #define PJMEDIA_EVID_NOTREADY (PJMEDIA_VIDEODEV_ERRNO_START+7) /* 520007 */ |
| 94 | |
| 95 | /** |
| 96 | * @hideinitializer |
| 97 | * The video capability is invalid or not supported |
| 98 | */ |
| 99 | #define PJMEDIA_EVID_INVCAP (PJMEDIA_VIDEODEV_ERRNO_START+8) /* 520008 */ |
| 100 | |
| 101 | /** |
| 102 | * @hideinitializer |
| 103 | * The operation is invalid or not supported |
| 104 | */ |
| 105 | #define PJMEDIA_EVID_INVOP (PJMEDIA_VIDEODEV_ERRNO_START+9) /* 520009 */ |
| 106 | |
| 107 | /** |
| 108 | * @hideinitializer |
| 109 | * Bad or invalid video device format |
| 110 | */ |
| 111 | #define PJMEDIA_EVID_BADFORMAT (PJMEDIA_VIDEODEV_ERRNO_START+10) /* 520010 */ |
| 112 | |
| 113 | /** |
| 114 | * @hideinitializer |
| 115 | * Invalid video device sample format |
| 116 | */ |
| 117 | #define PJMEDIA_EVID_SAMPFORMAT (PJMEDIA_VIDEODEV_ERRNO_START+11) /* 520011 */ |
| 118 | |
| 119 | /** |
| 120 | * @hideinitializer |
| 121 | * Bad latency setting |
| 122 | */ |
| 123 | #define PJMEDIA_EVID_BADLATENCY (PJMEDIA_VIDEODEV_ERRNO_START+12) /* 520012 */ |
| 124 | |
| 125 | /** |
| 126 | * @hideinitializer |
| 127 | * Bad/unsupported video size |
| 128 | */ |
| 129 | #define PJMEDIA_EVID_BADSIZE (PJMEDIA_VIDEODEV_ERRNO_START+13) /* 520013 */ |
| 130 | |
| 131 | |
| 132 | /** |
| 133 | * Get error message for the specified error code. Note that this |
| 134 | * function is only able to decode PJMEDIA Videodev specific error code. |
| 135 | * Application should use pj_strerror(), which should be able to |
| 136 | * decode all error codes belonging to all subsystems (e.g. pjlib, |
| 137 | * pjmedia, pjsip, etc). |
| 138 | * |
| 139 | * @param status The error code. |
| 140 | * @param buffer The buffer where to put the error message. |
| 141 | * @param bufsize Size of the buffer. |
| 142 | * |
| 143 | * @return The error message as NULL terminated string, |
| 144 | * wrapped with pj_str_t. |
| 145 | */ |
| 146 | PJ_DECL(pj_str_t) pjmedia_videodev_strerror(pj_status_t status, char *buffer, |
| 147 | pj_size_t bufsize); |
| 148 | |
| 149 | |
| 150 | PJ_END_DECL |
| 151 | |
| 152 | /** |
| 153 | * @} |
| 154 | */ |
| 155 | |
| 156 | |
| 157 | #endif /* __PJMEDIA_VIDEODEV_VIDEODEV_ERRNO_H__ */ |
| 158 |