Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VSs > VSs__H264__App
comparison libavutil/internal.h @ 9:ea1ba68cf0ed
update to match api changes + add sscc produced source
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Wed, 05 Jun 2013 14:43:26 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:d5fbb1b0e777 |
|---|---|
| 1 /* | |
| 2 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | |
| 3 * | |
| 4 * This file is part of FFmpeg. | |
| 5 * | |
| 6 * FFmpeg is free software; you can redistribute it and/or | |
| 7 * modify it under the terms of the GNU Lesser General Public | |
| 8 * License as published by the Free Software Foundation; either | |
| 9 * version 2.1 of the License, or (at your option) any later version. | |
| 10 * | |
| 11 * FFmpeg 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 GNU | |
| 14 * Lesser General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU Lesser General Public | |
| 17 * License along with FFmpeg; if not, write to the Free Software | |
| 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 19 */ | |
| 20 | |
| 21 /** | |
| 22 * @file | |
| 23 * common internal API header | |
| 24 */ | |
| 25 | |
| 26 #ifndef AVUTIL_INTERNAL_H | |
| 27 #define AVUTIL_INTERNAL_H | |
| 28 | |
| 29 #if !defined(DEBUG) && !defined(NDEBUG) | |
| 30 # define NDEBUG | |
| 31 #endif | |
| 32 | |
| 33 #include <limits.h> | |
| 34 #include <stdint.h> | |
| 35 #include <stddef.h> | |
| 36 #include <assert.h> | |
| 37 #include "config.h" | |
| 38 #include "attributes.h" | |
| 39 #include "timer.h" | |
| 40 | |
| 41 | |
| 42 | |
| 43 #ifndef INT16_MIN | |
| 44 #define INT16_MIN (-0x7fff - 1) | |
| 45 #endif | |
| 46 | |
| 47 #ifndef INT16_MAX | |
| 48 #define INT16_MAX 0x7fff | |
| 49 #endif | |
| 50 | |
| 51 #ifndef INT32_MIN | |
| 52 #define INT32_MIN (-0x7fffffff - 1) | |
| 53 #endif | |
| 54 | |
| 55 #ifndef INT32_MAX | |
| 56 #define INT32_MAX 0x7fffffff | |
| 57 #endif | |
| 58 | |
| 59 #ifndef UINT32_MAX | |
| 60 #define UINT32_MAX 0xffffffff | |
| 61 #endif | |
| 62 | |
| 63 #ifndef INT64_MIN | |
| 64 #define INT64_MIN (-0x7fffffffffffffffLL - 1) | |
| 65 #endif | |
| 66 | |
| 67 #ifndef INT64_MAX | |
| 68 #define INT64_MAX INT64_C(9223372036854775807) | |
| 69 #endif | |
| 70 | |
| 71 #ifndef UINT64_MAX | |
| 72 #define UINT64_MAX UINT64_C(0xFFFFFFFFFFFFFFFF) | |
| 73 #endif | |
| 74 | |
| 75 #ifndef INT_BIT | |
| 76 # define INT_BIT (CHAR_BIT * sizeof(int)) | |
| 77 #endif | |
| 78 | |
| 79 #ifndef offsetof | |
| 80 # define offsetof(T, F) ((unsigned int)((char *)&((T *)0)->F)) | |
| 81 #endif | |
| 82 | |
| 83 /* Use to export labels from asm. */ | |
| 84 #define LABEL_MANGLE(a) #a | |
| 85 #define LOCAL_MANGLE(a) #a | |
| 86 #define MANGLE(a) #a | |
| 87 | |
| 88 // Use rip-relative addressing if compiling PIC code on x86-64. | |
| 89 // #if ARCH_X86_64 && defined(PIC) | |
| 90 // # define LOCAL_MANGLE(a) #a "(%%rip)" | |
| 91 // #else | |
| 92 // # define LOCAL_MANGLE(a) #a | |
| 93 // #endif | |
| 94 // | |
| 95 // #define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a) | |
| 96 | |
| 97 /* debug stuff */ | |
| 98 | |
| 99 /* dprintf macros */ | |
| 100 #ifdef DEBUG | |
| 101 # define dprintf(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) | |
| 102 #else | |
| 103 # define dprintf(pctx, ...) | |
| 104 #endif | |
| 105 | |
| 106 #define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) | |
| 107 | |
| 108 /* math */ | |
| 109 | |
| 110 | |
| 111 /* avoid usage of dangerous/inappropriate system functions */ | |
| 112 // #undef malloc | |
| 113 // #define malloc please_use_av_malloc | |
| 114 // #undef free | |
| 115 // #define free please_use_av_free | |
| 116 #undef realloc | |
| 117 #define realloc please_use_av_realloc | |
| 118 #undef time | |
| 119 #define time time_is_forbidden_due_to_security_issues | |
| 120 #undef rand | |
| 121 #define rand rand_is_forbidden_due_to_state_trashing_use_av_lfg_get | |
| 122 #undef srand | |
| 123 #define srand srand_is_forbidden_due_to_state_trashing_use_av_lfg_init | |
| 124 #undef random | |
| 125 #define random random_is_forbidden_due_to_state_trashing_use_av_lfg_get | |
| 126 #undef sprintf | |
| 127 #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf | |
| 128 //#undef exit | |
| 129 //#define exit exit_is_forbidden | |
| 130 #ifndef LIBAVFORMAT_BUILD | |
| 131 | |
| 132 #undef puts | |
| 133 #define puts please_use_av_log_instead_of_puts | |
| 134 #undef perror | |
| 135 #define perror please_use_av_log_instead_of_perror | |
| 136 #endif | |
| 137 | |
| 138 #define FF_ALLOC_OR_GOTO(p, size, label)\ | |
| 139 {\ | |
| 140 p = av_malloc(size);\ | |
| 141 if (p == NULL && (size) != 0) {\ | |
| 142 av_log(AV_LOG_ERROR, "Cannot allocate memory.\n");\ | |
| 143 goto label;\ | |
| 144 }\ | |
| 145 } | |
| 146 | |
| 147 #define FF_ALLOCZ_OR_GOTO(p, size, label)\ | |
| 148 {\ | |
| 149 p = av_mallocz(size);\ | |
| 150 if (p == NULL && (size) != 0) {\ | |
| 151 av_log(AV_LOG_ERROR, "Cannot allocate memory.\n");\ | |
| 152 goto label;\ | |
| 153 }\ | |
| 154 } | |
| 155 | |
| 156 | |
| 157 /** | |
| 158 * Returns NULL if CONFIG_SMALL is true, otherwise the argument | |
| 159 * without modification. Used to disable the definition of strings | |
| 160 * (for example AVCodec long_names). | |
| 161 */ | |
| 162 #if CONFIG_SMALL | |
| 163 # define NULL_IF_CONFIG_SMALL(x) NULL | |
| 164 #else | |
| 165 # define NULL_IF_CONFIG_SMALL(x) x | |
| 166 #endif | |
| 167 | |
| 168 #endif /* AVUTIL_INTERNAL_H */ |
