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 module ffmpeg.libavutil.avutil; 21 22 import ffmpeg.libavutil.rational; 23 24 import core.stdc.stdint; 25 import core.stdc.stdio; 26 27 extern (C) @nogc nothrow: 28 29 /** 30 * @file 31 * @ingroup lavu 32 * Convenience header that includes @ref lavu "libavutil"'s core. 33 */ 34 35 /** 36 * @mainpage 37 * 38 * @section ffmpeg_intro Introduction 39 * 40 * This document describes the usage of the different libraries 41 * provided by FFmpeg. 42 * 43 * @li @ref libavc "libavcodec" encoding/decoding library 44 * @li @ref lavfi "libavfilter" graph-based frame editing library 45 * @li @ref libavf "libavformat" I/O and muxing/demuxing library 46 * @li @ref lavd "libavdevice" special devices muxing/demuxing library 47 * @li @ref lavu "libavutil" common utility library 48 * @li @ref lswr "libswresample" audio resampling, format conversion and mixing 49 * @li @ref lpp "libpostproc" post processing library 50 * @li @ref libsws "libswscale" color conversion and scaling library 51 * 52 * @section ffmpeg_versioning Versioning and compatibility 53 * 54 * Each of the FFmpeg libraries contains a version.h header, which defines a 55 * major, minor and micro version number with the 56 * <em>LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO}</em> macros. The major version 57 * number is incremented with backward incompatible changes - e.g. removing 58 * parts of the public API, reordering public struct members, etc. The minor 59 * version number is incremented for backward compatible API changes or major 60 * new features - e.g. adding a new public function or a new decoder. The micro 61 * version number is incremented for smaller changes that a calling program 62 * might still want to check for - e.g. changing behavior in a previously 63 * unspecified situation. 64 * 65 * FFmpeg guarantees backward API and ABI compatibility for each library as long 66 * as its major version number is unchanged. This means that no public symbols 67 * will be removed or renamed. Types and names of the public struct members and 68 * values of public macros and enums will remain the same (unless they were 69 * explicitly declared as not part of the public API). Documented behavior will 70 * not change. 71 * 72 * In other words, any correct program that works with a given FFmpeg snapshot 73 * should work just as well without any changes with any later snapshot with the 74 * same major versions. This applies to both rebuilding the program against new 75 * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program 76 * links against. 77 * 78 * However, new public symbols may be added and new members may be appended to 79 * public structs whose size is not part of public ABI (most public structs in 80 * FFmpeg). New macros and enum values may be added. Behavior in undocumented 81 * situations may change slightly (and be documented). All those are accompanied 82 * by an entry in doc/APIchanges and incrementing either the minor or micro 83 * version number. 84 */ 85 86 /** 87 * @defgroup lavu libavutil 88 * Common code shared across all FFmpeg libraries. 89 * 90 * @note 91 * libavutil is designed to be modular. In most cases, in order to use the 92 * functions provided by one component of libavutil you must explicitly include 93 * the specific header containing that feature. If you are only using 94 * media-related components, you could simply include libavutil/avutil.h, which 95 * brings in most of the "core" components. 96 * 97 * @{ 98 * 99 * @defgroup lavu_crypto Crypto and Hashing 100 * 101 * @{ 102 * @} 103 * 104 * @defgroup lavu_math Mathematics 105 * @{ 106 * 107 * @} 108 * 109 * @defgroup lavu_string String Manipulation 110 * 111 * @{ 112 * 113 * @} 114 * 115 * @defgroup lavu_mem Memory Management 116 * 117 * @{ 118 * 119 * @} 120 * 121 * @defgroup lavu_data Data Structures 122 * @{ 123 * 124 * @} 125 * 126 * @defgroup lavu_video Video related 127 * 128 * @{ 129 * 130 * @} 131 * 132 * @defgroup lavu_audio Audio related 133 * 134 * @{ 135 * 136 * @} 137 * 138 * @defgroup lavu_error Error Codes 139 * 140 * @{ 141 * 142 * @} 143 * 144 * @defgroup lavu_log Logging Facility 145 * 146 * @{ 147 * 148 * @} 149 * 150 * @defgroup lavu_misc Other 151 * 152 * @{ 153 * 154 * @defgroup preproc_misc Preprocessor String Macros 155 * 156 * @{ 157 * 158 * @} 159 * 160 * @defgroup version_utils Library Version Macros 161 * 162 * @{ 163 * 164 * @} 165 */ 166 167 /** 168 * @addtogroup lavu_ver 169 * @{ 170 */ 171 172 /** 173 * Return the LIBAVUTIL_VERSION_INT constant. 174 */ 175 uint avutil_version (); 176 177 /** 178 * Return an informative version string. This usually is the actual release 179 * version number or a git commit description. This string has no fixed format 180 * and can change any time. It should never be parsed by code. 181 */ 182 const(char)* av_version_info (); 183 184 /** 185 * Return the libavutil build-time configuration. 186 */ 187 const(char)* avutil_configuration (); 188 189 /** 190 * Return the libavutil license. 191 */ 192 const(char)* avutil_license (); 193 194 /** 195 * @} 196 */ 197 198 /** 199 * @addtogroup lavu_media Media Type 200 * @brief Media Type 201 */ 202 203 enum AVMediaType 204 { 205 AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA 206 AVMEDIA_TYPE_VIDEO = 0, 207 AVMEDIA_TYPE_AUDIO = 1, 208 AVMEDIA_TYPE_DATA = 2, ///< Opaque data information usually continuous 209 AVMEDIA_TYPE_SUBTITLE = 3, 210 AVMEDIA_TYPE_ATTACHMENT = 4, ///< Opaque data information usually sparse 211 AVMEDIA_TYPE_NB = 5 212 } 213 214 /** 215 * Return a string describing the media_type enum, NULL if media_type 216 * is unknown. 217 */ 218 const(char)* av_get_media_type_string (AVMediaType media_type); 219 220 /** 221 * @defgroup lavu_const Constants 222 * @{ 223 * 224 * @defgroup lavu_enc Encoding specific 225 * 226 * @note those definition should move to avcodec 227 * @{ 228 */ 229 230 enum FF_LAMBDA_SHIFT = 7; 231 enum FF_LAMBDA_SCALE = 1 << FF_LAMBDA_SHIFT; 232 enum FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda 233 enum FF_LAMBDA_MAX = 256 * 128 - 1; 234 235 enum FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove 236 237 /** 238 * @} 239 * @defgroup lavu_time Timestamp specific 240 * 241 * FFmpeg internal timebase and timestamp definitions 242 * 243 * @{ 244 */ 245 246 /** 247 * @brief Undefined timestamp value 248 * 249 * Usually reported by demuxer that work on containers that do not provide 250 * either pts or dts. 251 */ 252 253 enum AV_NOPTS_VALUE = cast(long) UINT64_C(0x8000000000000000); 254 255 /** 256 * Internal time base represented as integer 257 */ 258 259 enum AV_TIME_BASE = 1000000; 260 261 /** 262 * Internal time base represented as fractional value 263 */ 264 265 /** 266 * @} 267 * @} 268 * @defgroup lavu_picture Image related 269 * 270 * AVPicture types, pixel formats and basic image planes manipulation. 271 * 272 * @{ 273 */ 274 275 enum AVPictureType 276 { 277 AV_PICTURE_TYPE_NONE = 0, ///< Undefined 278 AV_PICTURE_TYPE_I = 1, ///< Intra 279 AV_PICTURE_TYPE_P = 2, ///< Predicted 280 AV_PICTURE_TYPE_B = 3, ///< Bi-dir predicted 281 AV_PICTURE_TYPE_S = 4, ///< S(GMC)-VOP MPEG-4 282 AV_PICTURE_TYPE_SI = 5, ///< Switching Intra 283 AV_PICTURE_TYPE_SP = 6, ///< Switching Predicted 284 AV_PICTURE_TYPE_BI = 7 ///< BI type 285 } 286 287 /** 288 * Return a single letter to describe the given picture type 289 * pict_type. 290 * 291 * @param[in] pict_type the picture type @return a single character 292 * representing the picture type, '?' if pict_type is unknown 293 */ 294 char av_get_picture_type_char (AVPictureType pict_type); 295 296 /** 297 * @} 298 */ 299 300 /** 301 * Return x default pointer in case p is NULL. 302 */ 303 void* av_x_if_null (const(void)* p, const(void)* x); 304 305 /** 306 * Compute the length of an integer list. 307 * 308 * @param elsize size in bytes of each list element (only 1, 2, 4 or 8) 309 * @param term list terminator (usually 0 or -1) 310 * @param list pointer to the list 311 * @return length of the list, in elements, not counting the terminator 312 */ 313 uint av_int_list_length_for_size (uint elsize, const(void)* list, ulong term); 314 315 /** 316 * Compute the length of an integer list. 317 * 318 * @param term list terminator (usually 0 or -1) 319 * @param list pointer to the list 320 * @return length of the list, in elements, not counting the terminator 321 */ 322 extern (D) auto av_int_list_length(T0, T1)(auto ref T0 list, auto ref T1 term) 323 { 324 return av_int_list_length_for_size((*list).sizeof, list, term); 325 } 326 327 /** 328 * Open a file using a UTF-8 filename. 329 * The API of this function matches POSIX fopen(), errors are returned through 330 * errno. 331 */ 332 FILE* av_fopen_utf8 (const(char)* path, const(char)* mode); 333 334 /** 335 * Return the fractional representation of the internal time base. 336 */ 337 AVRational av_get_time_base_q (); 338 339 enum AV_FOURCC_MAX_STRING_SIZE = 32; 340 341 /** 342 * Fill the provided buffer with a string containing a FourCC (four-character 343 * code) representation. 344 * 345 * @param buf a buffer with size in bytes of at least AV_FOURCC_MAX_STRING_SIZE 346 * @param fourcc the fourcc to represent 347 * @return the buffer in input 348 */ 349 char* av_fourcc_make_string (char* buf, uint fourcc); 350 351 /** 352 * @} 353 * @} 354 */ 355 356 /* AVUTIL_AVUTIL_H */