git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3610 92316355-f0b4-4df1-b90c-862c8a59935fmaster
@@ -0,0 +1,305 @@ | |||
// ISO C9x compliant inttypes.h for Microsoft Visual Studio | |||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 | |||
// | |||
// Copyright (c) 2006 Alexander Chemeris | |||
// | |||
// Redistribution and use in source and binary forms, with or without | |||
// modification, are permitted provided that the following conditions are met: | |||
// | |||
// 1. Redistributions of source code must retain the above copyright notice, | |||
// this list of conditions and the following disclaimer. | |||
// | |||
// 2. Redistributions in binary form must reproduce the above copyright | |||
// notice, this list of conditions and the following disclaimer in the | |||
// documentation and/or other materials provided with the distribution. | |||
// | |||
// 3. The name of the author may be used to endorse or promote products | |||
// derived from this software without specific prior written permission. | |||
// | |||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | |||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
// | |||
/////////////////////////////////////////////////////////////////////////////// | |||
#ifndef _MSC_VER // [ | |||
#error "Use this header only with Microsoft Visual C++ compilers!" | |||
#endif // _MSC_VER ] | |||
#ifndef _MSC_INTTYPES_H_ // [ | |||
#define _MSC_INTTYPES_H_ | |||
#if _MSC_VER > 1000 | |||
#pragma once | |||
#endif | |||
#include <stdint.h> | |||
// 7.8 Format conversion of integer types | |||
typedef struct { | |||
intmax_t quot; | |||
intmax_t rem; | |||
} imaxdiv_t; | |||
// 7.8.1 Macros for format specifiers | |||
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 | |||
// The fprintf macros for signed integers are: | |||
#define PRId8 "d" | |||
#define PRIi8 "i" | |||
#define PRIdLEAST8 "d" | |||
#define PRIiLEAST8 "i" | |||
#define PRIdFAST8 "d" | |||
#define PRIiFAST8 "i" | |||
#define PRId16 "hd" | |||
#define PRIi16 "hi" | |||
#define PRIdLEAST16 "hd" | |||
#define PRIiLEAST16 "hi" | |||
#define PRIdFAST16 "hd" | |||
#define PRIiFAST16 "hi" | |||
#define PRId32 "I32d" | |||
#define PRIi32 "I32i" | |||
#define PRIdLEAST32 "I32d" | |||
#define PRIiLEAST32 "I32i" | |||
#define PRIdFAST32 "I32d" | |||
#define PRIiFAST32 "I32i" | |||
#define PRId64 "I64d" | |||
#define PRIi64 "I64i" | |||
#define PRIdLEAST64 "I64d" | |||
#define PRIiLEAST64 "I64i" | |||
#define PRIdFAST64 "I64d" | |||
#define PRIiFAST64 "I64i" | |||
#define PRIdMAX "I64d" | |||
#define PRIiMAX "I64i" | |||
#define PRIdPTR "Id" | |||
#define PRIiPTR "Ii" | |||
// The fprintf macros for unsigned integers are: | |||
#define PRIo8 "o" | |||
#define PRIu8 "u" | |||
#define PRIx8 "x" | |||
#define PRIX8 "X" | |||
#define PRIoLEAST8 "o" | |||
#define PRIuLEAST8 "u" | |||
#define PRIxLEAST8 "x" | |||
#define PRIXLEAST8 "X" | |||
#define PRIoFAST8 "o" | |||
#define PRIuFAST8 "u" | |||
#define PRIxFAST8 "x" | |||
#define PRIXFAST8 "X" | |||
#define PRIo16 "ho" | |||
#define PRIu16 "hu" | |||
#define PRIx16 "hx" | |||
#define PRIX16 "hX" | |||
#define PRIoLEAST16 "ho" | |||
#define PRIuLEAST16 "hu" | |||
#define PRIxLEAST16 "hx" | |||
#define PRIXLEAST16 "hX" | |||
#define PRIoFAST16 "ho" | |||
#define PRIuFAST16 "hu" | |||
#define PRIxFAST16 "hx" | |||
#define PRIXFAST16 "hX" | |||
#define PRIo32 "I32o" | |||
#define PRIu32 "I32u" | |||
#define PRIx32 "I32x" | |||
#define PRIX32 "I32X" | |||
#define PRIoLEAST32 "I32o" | |||
#define PRIuLEAST32 "I32u" | |||
#define PRIxLEAST32 "I32x" | |||
#define PRIXLEAST32 "I32X" | |||
#define PRIoFAST32 "I32o" | |||
#define PRIuFAST32 "I32u" | |||
#define PRIxFAST32 "I32x" | |||
#define PRIXFAST32 "I32X" | |||
#define PRIo64 "I64o" | |||
#define PRIu64 "I64u" | |||
#define PRIx64 "I64x" | |||
#define PRIX64 "I64X" | |||
#define PRIoLEAST64 "I64o" | |||
#define PRIuLEAST64 "I64u" | |||
#define PRIxLEAST64 "I64x" | |||
#define PRIXLEAST64 "I64X" | |||
#define PRIoFAST64 "I64o" | |||
#define PRIuFAST64 "I64u" | |||
#define PRIxFAST64 "I64x" | |||
#define PRIXFAST64 "I64X" | |||
#define PRIoMAX "I64o" | |||
#define PRIuMAX "I64u" | |||
#define PRIxMAX "I64x" | |||
#define PRIXMAX "I64X" | |||
#define PRIoPTR "Io" | |||
#define PRIuPTR "Iu" | |||
#define PRIxPTR "Ix" | |||
#define PRIXPTR "IX" | |||
// The fscanf macros for signed integers are: | |||
#define SCNd8 "d" | |||
#define SCNi8 "i" | |||
#define SCNdLEAST8 "d" | |||
#define SCNiLEAST8 "i" | |||
#define SCNdFAST8 "d" | |||
#define SCNiFAST8 "i" | |||
#define SCNd16 "hd" | |||
#define SCNi16 "hi" | |||
#define SCNdLEAST16 "hd" | |||
#define SCNiLEAST16 "hi" | |||
#define SCNdFAST16 "hd" | |||
#define SCNiFAST16 "hi" | |||
#define SCNd32 "ld" | |||
#define SCNi32 "li" | |||
#define SCNdLEAST32 "ld" | |||
#define SCNiLEAST32 "li" | |||
#define SCNdFAST32 "ld" | |||
#define SCNiFAST32 "li" | |||
#define SCNd64 "I64d" | |||
#define SCNi64 "I64i" | |||
#define SCNdLEAST64 "I64d" | |||
#define SCNiLEAST64 "I64i" | |||
#define SCNdFAST64 "I64d" | |||
#define SCNiFAST64 "I64i" | |||
#define SCNdMAX "I64d" | |||
#define SCNiMAX "I64i" | |||
#ifdef _WIN64 // [ | |||
# define SCNdPTR "I64d" | |||
# define SCNiPTR "I64i" | |||
#else // _WIN64 ][ | |||
# define SCNdPTR "ld" | |||
# define SCNiPTR "li" | |||
#endif // _WIN64 ] | |||
// The fscanf macros for unsigned integers are: | |||
#define SCNo8 "o" | |||
#define SCNu8 "u" | |||
#define SCNx8 "x" | |||
#define SCNX8 "X" | |||
#define SCNoLEAST8 "o" | |||
#define SCNuLEAST8 "u" | |||
#define SCNxLEAST8 "x" | |||
#define SCNXLEAST8 "X" | |||
#define SCNoFAST8 "o" | |||
#define SCNuFAST8 "u" | |||
#define SCNxFAST8 "x" | |||
#define SCNXFAST8 "X" | |||
#define SCNo16 "ho" | |||
#define SCNu16 "hu" | |||
#define SCNx16 "hx" | |||
#define SCNX16 "hX" | |||
#define SCNoLEAST16 "ho" | |||
#define SCNuLEAST16 "hu" | |||
#define SCNxLEAST16 "hx" | |||
#define SCNXLEAST16 "hX" | |||
#define SCNoFAST16 "ho" | |||
#define SCNuFAST16 "hu" | |||
#define SCNxFAST16 "hx" | |||
#define SCNXFAST16 "hX" | |||
#define SCNo32 "lo" | |||
#define SCNu32 "lu" | |||
#define SCNx32 "lx" | |||
#define SCNX32 "lX" | |||
#define SCNoLEAST32 "lo" | |||
#define SCNuLEAST32 "lu" | |||
#define SCNxLEAST32 "lx" | |||
#define SCNXLEAST32 "lX" | |||
#define SCNoFAST32 "lo" | |||
#define SCNuFAST32 "lu" | |||
#define SCNxFAST32 "lx" | |||
#define SCNXFAST32 "lX" | |||
#define SCNo64 "I64o" | |||
#define SCNu64 "I64u" | |||
#define SCNx64 "I64x" | |||
#define SCNX64 "I64X" | |||
#define SCNoLEAST64 "I64o" | |||
#define SCNuLEAST64 "I64u" | |||
#define SCNxLEAST64 "I64x" | |||
#define SCNXLEAST64 "I64X" | |||
#define SCNoFAST64 "I64o" | |||
#define SCNuFAST64 "I64u" | |||
#define SCNxFAST64 "I64x" | |||
#define SCNXFAST64 "I64X" | |||
#define SCNoMAX "I64o" | |||
#define SCNuMAX "I64u" | |||
#define SCNxMAX "I64x" | |||
#define SCNXMAX "I64X" | |||
#ifdef _WIN64 // [ | |||
# define SCNoPTR "I64o" | |||
# define SCNuPTR "I64u" | |||
# define SCNxPTR "I64x" | |||
# define SCNXPTR "I64X" | |||
#else // _WIN64 ][ | |||
# define SCNoPTR "lo" | |||
# define SCNuPTR "lu" | |||
# define SCNxPTR "lx" | |||
# define SCNXPTR "lX" | |||
#endif // _WIN64 ] | |||
#endif // __STDC_FORMAT_MACROS ] | |||
// 7.8.2 Functions for greatest-width integer types | |||
// 7.8.2.1 The imaxabs function | |||
#define imaxabs _abs64 | |||
// 7.8.2.2 The imaxdiv function | |||
// This is modified version of div() function from Microsoft's div.c found | |||
// in %MSVC.NET%\crt\src\div.c | |||
#ifdef STATIC_IMAXDIV // [ | |||
static | |||
#else // STATIC_IMAXDIV ][ | |||
_inline | |||
#endif // STATIC_IMAXDIV ] | |||
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) | |||
{ | |||
imaxdiv_t result; | |||
result.quot = numer / denom; | |||
result.rem = numer % denom; | |||
if (numer < 0 && result.rem > 0) { | |||
// did division wrong; must fix up | |||
++result.quot; | |||
result.rem -= denom; | |||
} | |||
return result; | |||
} | |||
// 7.8.2.3 The strtoimax and strtoumax functions | |||
#define strtoimax _strtoi64 | |||
#define strtoumax _strtoui64 | |||
// 7.8.2.4 The wcstoimax and wcstoumax functions | |||
#define wcstoimax _wcstoi64 | |||
#define wcstoumax _wcstoui64 | |||
#endif // _MSC_INTTYPES_H_ ] |
@@ -0,0 +1,156 @@ | |||
/* | |||
* AVOptions | |||
* copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVCODEC_OPT_H | |||
#define AVCODEC_OPT_H | |||
/** | |||
* @file libavcodec/opt.h | |||
* AVOptions | |||
*/ | |||
#include "libavutil/rational.h" | |||
#include "avcodec.h" | |||
enum AVOptionType{ | |||
FF_OPT_TYPE_FLAGS, | |||
FF_OPT_TYPE_INT, | |||
FF_OPT_TYPE_INT64, | |||
FF_OPT_TYPE_DOUBLE, | |||
FF_OPT_TYPE_FLOAT, | |||
FF_OPT_TYPE_STRING, | |||
FF_OPT_TYPE_RATIONAL, | |||
FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length | |||
FF_OPT_TYPE_CONST=128, | |||
}; | |||
/** | |||
* AVOption | |||
*/ | |||
typedef struct AVOption { | |||
const char *name; | |||
/** | |||
* short English help text | |||
* @todo What about other languages? | |||
*/ | |||
const char *help; | |||
/** | |||
* The offset relative to the context structure where the option | |||
* value is stored. It should be 0 for named constants. | |||
*/ | |||
int offset; | |||
enum AVOptionType type; | |||
/** | |||
* the default value for scalar options | |||
*/ | |||
double default_val; | |||
double min; ///< minimum valid value for the option | |||
double max; ///< maximum valid value for the option | |||
int flags; | |||
#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding | |||
#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding | |||
#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... | |||
#define AV_OPT_FLAG_AUDIO_PARAM 8 | |||
#define AV_OPT_FLAG_VIDEO_PARAM 16 | |||
#define AV_OPT_FLAG_SUBTITLE_PARAM 32 | |||
//FIXME think about enc-audio, ... style flags | |||
/** | |||
* The logical unit to which the option belongs. Non-constant | |||
* options and corresponding named constants share the same | |||
* unit. May be NULL. | |||
*/ | |||
const char *unit; | |||
} AVOption; | |||
/** | |||
* Looks for an option in \p obj. Looks only for the options which | |||
* have the flags set as specified in \p mask and \p flags (that is, | |||
* for which it is the case that opt->flags & mask == flags). | |||
* | |||
* @param[in] obj a pointer to a struct whose first element is a | |||
* pointer to an AVClass | |||
* @param[in] name the name of the option to look for | |||
* @param[in] unit the unit of the option to look for, or any if NULL | |||
* @return a pointer to the option found, or NULL if no option | |||
* has been found | |||
*/ | |||
const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); | |||
#if LIBAVCODEC_VERSION_MAJOR < 53 | |||
/** | |||
* @see av_set_string2() | |||
*/ | |||
attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val); | |||
/** | |||
* @return a pointer to the AVOption corresponding to the field set or | |||
* NULL if no matching AVOption exists, or if the value \p val is not | |||
* valid | |||
* @see av_set_string3() | |||
*/ | |||
attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc); | |||
#endif | |||
/** | |||
* Sets the field of obj with the given name to value. | |||
* | |||
* @param[in] obj A struct whose first element is a pointer to an | |||
* AVClass. | |||
* @param[in] name the name of the field to set | |||
* @param[in] val The value to set. If the field is not of a string | |||
* type, then the given string is parsed. | |||
* SI postfixes and some named scalars are supported. | |||
* If the field is of a numeric type, it has to be a numeric or named | |||
* scalar. Behavior with more than one scalar and +- infix operators | |||
* is undefined. | |||
* If the field is of a flags type, it has to be a sequence of numeric | |||
* scalars or named flags separated by '+' or '-'. Prefixing a flag | |||
* with '+' causes it to be set without affecting the other flags; | |||
* similarly, '-' unsets a flag. | |||
* @param[out] o_out if non-NULL put here a pointer to the AVOption | |||
* found | |||
* @param alloc when 1 then the old value will be av_freed() and the | |||
* new av_strduped() | |||
* when 0 then no av_free() nor av_strdup() will be used | |||
* @return 0 if the value has been set, an AVERROR* error code if no | |||
* matching option exists, or if the value \p val is not valid | |||
*/ | |||
int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); | |||
const AVOption *av_set_double(void *obj, const char *name, double n); | |||
const AVOption *av_set_q(void *obj, const char *name, AVRational n); | |||
const AVOption *av_set_int(void *obj, const char *name, int64_t n); | |||
double av_get_double(void *obj, const char *name, const AVOption **o_out); | |||
AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); | |||
int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); | |||
const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); | |||
const AVOption *av_next_option(void *obj, const AVOption *last); | |||
int av_opt_show(void *obj, void *av_log_obj); | |||
void av_opt_set_defaults(void *s); | |||
void av_opt_set_defaults2(void *s, int mask, int flags); | |||
#endif /* AVCODEC_OPT_H */ |
@@ -0,0 +1,86 @@ | |||
/* | |||
* The Video Decode and Presentation API for UNIX (VDPAU) is used for | |||
* hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. | |||
* | |||
* Copyright (C) 2008 NVIDIA | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVCODEC_VDPAU_H | |||
#define AVCODEC_VDPAU_H | |||
/** | |||
* \defgroup Decoder VDPAU Decoder and Renderer | |||
* | |||
* VDPAU hardware acceleration has two modules | |||
* - VDPAU decoding | |||
* - VDPAU presentation | |||
* | |||
* The VDPAU decoding module parses all headers using FFmpeg | |||
* parsing mechanisms and uses VDPAU for the actual decoding. | |||
* | |||
* As per the current implementation, the actual decoding | |||
* and rendering (API calls) are done as part of the VDPAU | |||
* presentation (vo_vdpau.c) module. | |||
* | |||
* @{ | |||
* \defgroup VDPAU_Decoding VDPAU Decoding | |||
* \ingroup Decoder | |||
* @{ | |||
*/ | |||
#include <vdpau/vdpau.h> | |||
#include <vdpau/vdpau_x11.h> | |||
/** \brief The videoSurface is used for rendering. */ | |||
#define FF_VDPAU_STATE_USED_FOR_RENDER 1 | |||
/** | |||
* \brief The videoSurface is needed for reference/prediction. | |||
* The codec manipulates this. | |||
*/ | |||
#define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 | |||
/** | |||
* \brief This structure is used as a callback between the FFmpeg | |||
* decoder (vd_) and presentation (vo_) module. | |||
* This is used for defining a video frame containing surface, | |||
* picture parameter, bitstream information etc which are passed | |||
* between the FFmpeg decoder and its clients. | |||
*/ | |||
struct vdpau_render_state { | |||
VdpVideoSurface surface; ///< Used as rendered surface, never changed. | |||
int state; ///< Holds FF_VDPAU_STATE_* values. | |||
/** picture parameter information for all supported codecs */ | |||
union VdpPictureInfo { | |||
VdpPictureInfoH264 h264; | |||
VdpPictureInfoMPEG1Or2 mpeg; | |||
VdpPictureInfoVC1 vc1; | |||
} info; | |||
/** Describe size/location of the compressed video data. */ | |||
int bitstream_buffers_allocated; | |||
int bitstream_buffers_used; | |||
VdpBitstreamBuffer *bitstream_buffers; | |||
}; | |||
/* @}*/ | |||
#endif /* AVCODEC_VDPAU_H */ |
@@ -0,0 +1,172 @@ | |||
/* | |||
* Copyright (C) 2003 Ivan Kalvachev | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVCODEC_XVMC_H | |||
#define AVCODEC_XVMC_H | |||
#include <X11/extensions/XvMC.h> | |||
#include "avcodec.h" | |||
#if LIBAVCODEC_VERSION_MAJOR < 53 | |||
#define AV_XVMC_STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */ | |||
#define AV_XVMC_STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */ | |||
#define AV_XVMC_STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */ | |||
#endif | |||
#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct | |||
the number is 1337 speak for the letters IDCT MCo (motion compensation) */ | |||
struct xvmc_pix_fmt { | |||
/** The field contains the special constant value AV_XVMC_ID. | |||
It is used as a test that the application correctly uses the API, | |||
and that there is no corruption caused by pixel routines. | |||
- application - set during initialization | |||
- libavcodec - unchanged | |||
*/ | |||
int xvmc_id; | |||
/** Pointer to the block array allocated by XvMCCreateBlocks(). | |||
The array has to be freed by XvMCDestroyBlocks(). | |||
Each group of 64 values represents one data block of differential | |||
pixel information (in MoCo mode) or coefficients for IDCT. | |||
- application - set the pointer during initialization | |||
- libavcodec - fills coefficients/pixel data into the array | |||
*/ | |||
short* data_blocks; | |||
/** Pointer to the macroblock description array allocated by | |||
XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). | |||
- application - set the pointer during initialization | |||
- libavcodec - fills description data into the array | |||
*/ | |||
XvMCMacroBlock* mv_blocks; | |||
/** Number of macroblock descriptions that can be stored in the mv_blocks | |||
array. | |||
- application - set during initialization | |||
- libavcodec - unchanged | |||
*/ | |||
int allocated_mv_blocks; | |||
/** Number of blocks that can be stored at once in the data_blocks array. | |||
- application - set during initialization | |||
- libavcodec - unchanged | |||
*/ | |||
int allocated_data_blocks; | |||
/** Indicates that the hardware would interpret data_blocks as IDCT | |||
coefficients and perform IDCT on them. | |||
- application - set during initialization | |||
- libavcodec - unchanged | |||
*/ | |||
int idct; | |||
/** In MoCo mode it indicates that intra macroblocks are assumed to be in | |||
unsigned format; same as the XVMC_INTRA_UNSIGNED flag. | |||
- application - set during initialization | |||
- libavcodec - unchanged | |||
*/ | |||
int unsigned_intra; | |||
/** Pointer to the surface allocated by XvMCCreateSurface(). | |||
It has to be freed by XvMCDestroySurface() on application exit. | |||
It identifies the frame and its state on the video hardware. | |||
- application - set during initialization | |||
- libavcodec - unchanged | |||
*/ | |||
XvMCSurface* p_surface; | |||
/** Set by the decoder before calling ff_draw_horiz_band(), | |||
needed by the XvMCRenderSurface function. */ | |||
//@{ | |||
/** Pointer to the surface used as past reference | |||
- application - unchanged | |||
- libavcodec - set | |||
*/ | |||
XvMCSurface* p_past_surface; | |||
/** Pointer to the surface used as future reference | |||
- application - unchanged | |||
- libavcodec - set | |||
*/ | |||
XvMCSurface* p_future_surface; | |||
/** top/bottom field or frame | |||
- application - unchanged | |||
- libavcodec - set | |||
*/ | |||
unsigned int picture_structure; | |||
/** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence | |||
- application - unchanged | |||
- libavcodec - set | |||
*/ | |||
unsigned int flags; | |||
//}@ | |||
/** Number of macroblock descriptions in the mv_blocks array | |||
that have already been passed to the hardware. | |||
- application - zeroes it on get_buffer(). | |||
A successful ff_draw_horiz_band() may increment it | |||
with filled_mb_block_num or zero both. | |||
- libavcodec - unchanged | |||
*/ | |||
int start_mv_blocks_num; | |||
/** Number of new macroblock descriptions in the mv_blocks array (after | |||
start_mv_blocks_num) that are filled by libavcodec and have to be | |||
passed to the hardware. | |||
- application - zeroes it on get_buffer() or after successful | |||
ff_draw_horiz_band(). | |||
- libavcodec - increment with one of each stored MB | |||
*/ | |||
int filled_mv_blocks_num; | |||
/** Number of the the next free data block; one data block consists of | |||
64 short values in the data_blocks array. | |||
All blocks before this one have already been claimed by placing their | |||
position into the corresponding block description structure field, | |||
that are part of the mv_blocks array. | |||
- application - zeroes it on get_buffer(). | |||
A successful ff_draw_horiz_band() may zero it together | |||
with start_mb_blocks_num. | |||
- libavcodec - each decoded macroblock increases it by the number | |||
of coded blocks it contains. | |||
*/ | |||
int next_free_data_block_num; | |||
/** extensions may be placed here */ | |||
#if LIBAVCODEC_VERSION_MAJOR < 53 | |||
//@{ | |||
/** State flags used to work around limitations in the MPlayer video system. | |||
0 - Surface is not used. | |||
1 - Surface is still held in application to be displayed or is | |||
still visible. | |||
2 - Surface is still held in libavcodec buffer for prediction. | |||
*/ | |||
int state; | |||
/** pointer to the surface where the subpicture is rendered */ | |||
void* p_osd_target_surface_render; | |||
//}@ | |||
#endif | |||
}; | |||
#endif /* AVCODEC_XVMC_H */ |
@@ -0,0 +1,46 @@ | |||
/* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVDEVICE_AVDEVICE_H | |||
#define AVDEVICE_AVDEVICE_H | |||
#define LIBAVDEVICE_VERSION_MAJOR 52 | |||
#define LIBAVDEVICE_VERSION_MINOR 1 | |||
#define LIBAVDEVICE_VERSION_MICRO 0 | |||
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ | |||
LIBAVDEVICE_VERSION_MINOR, \ | |||
LIBAVDEVICE_VERSION_MICRO) | |||
#define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \ | |||
LIBAVDEVICE_VERSION_MINOR, \ | |||
LIBAVDEVICE_VERSION_MICRO) | |||
#define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT | |||
/** | |||
* Returns the LIBAVDEVICE_VERSION_INT constant. | |||
*/ | |||
unsigned avdevice_version(void); | |||
/** | |||
* Initialize libavdevice and register all the input and output devices. | |||
* @warning This function is not thread safe. | |||
*/ | |||
void avdevice_register_all(void); | |||
#endif /* AVDEVICE_AVDEVICE_H */ | |||
@@ -0,0 +1,406 @@ | |||
/* | |||
* copyright (c) 2001 Fabrice Bellard | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVFORMAT_AVIO_H | |||
#define AVFORMAT_AVIO_H | |||
/** | |||
* @file libavformat/avio.h | |||
* unbuffered I/O operations | |||
* | |||
* @warning This file has to be considered an internal but installed | |||
* header, so it should not be directly included in your projects. | |||
*/ | |||
#include <stdint.h> | |||
#include "libavutil/common.h" | |||
/* unbuffered I/O */ | |||
/** | |||
* URL Context. | |||
* New fields can be added to the end with minor version bumps. | |||
* Removal, reordering and changes to existing fields require a major | |||
* version bump. | |||
* sizeof(URLContext) must not be used outside libav*. | |||
*/ | |||
struct URLContext { | |||
#if LIBAVFORMAT_VERSION_MAJOR >= 53 | |||
const AVClass *av_class; ///< information for av_log(). Set by url_open(). | |||
#endif | |||
struct URLProtocol *prot; | |||
int flags; | |||
int is_streamed; /**< true if streamed (no seek possible), default = false */ | |||
int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */ | |||
void *priv_data; | |||
char *filename; /**< specified filename */ | |||
}; | |||
typedef struct URLContext URLContext; | |||
typedef struct URLPollEntry { | |||
URLContext *handle; | |||
int events; | |||
int revents; | |||
} URLPollEntry; | |||
#define URL_RDONLY 0 | |||
#define URL_WRONLY 1 | |||
#define URL_RDWR 2 | |||
typedef int URLInterruptCB(void); | |||
int url_open_protocol (URLContext **puc, struct URLProtocol *up, | |||
const char *filename, int flags); | |||
int url_open(URLContext **h, const char *filename, int flags); | |||
int url_read(URLContext *h, unsigned char *buf, int size); | |||
int url_write(URLContext *h, unsigned char *buf, int size); | |||
int64_t url_seek(URLContext *h, int64_t pos, int whence); | |||
int url_close(URLContext *h); | |||
int url_exist(const char *filename); | |||
int64_t url_filesize(URLContext *h); | |||
/** | |||
* Return the file descriptor associated with this URL. For RTP, this | |||
* will return only the RTP file descriptor, not the RTCP file descriptor. | |||
* To get both, use rtp_get_file_handles(). | |||
* | |||
* @return the file descriptor associated with this URL, or <0 on error. | |||
*/ | |||
int url_get_file_handle(URLContext *h); | |||
/** | |||
* Return the maximum packet size associated to packetized file | |||
* handle. If the file is not packetized (stream like HTTP or file on | |||
* disk), then 0 is returned. | |||
* | |||
* @param h file handle | |||
* @return maximum packet size in bytes | |||
*/ | |||
int url_get_max_packet_size(URLContext *h); | |||
void url_get_filename(URLContext *h, char *buf, int buf_size); | |||
/** | |||
* The callback is called in blocking functions to test regulary if | |||
* asynchronous interruption is needed. AVERROR(EINTR) is returned | |||
* in this case by the interrupted function. 'NULL' means no interrupt | |||
* callback is given. | |||
*/ | |||
void url_set_interrupt_cb(URLInterruptCB *interrupt_cb); | |||
/* not implemented */ | |||
int url_poll(URLPollEntry *poll_table, int n, int timeout); | |||
/** | |||
* Pause and resume playing - only meaningful if using a network streaming | |||
* protocol (e.g. MMS). | |||
* @param pause 1 for pause, 0 for resume | |||
*/ | |||
int av_url_read_pause(URLContext *h, int pause); | |||
/** | |||
* Seek to a given timestamp relative to some component stream. | |||
* Only meaningful if using a network streaming protocol (e.g. MMS.). | |||
* @param stream_index The stream index that the timestamp is relative to. | |||
* If stream_index is (-1) the timestamp should be in AV_TIME_BASE | |||
* units from the beginning of the presentation. | |||
* If a stream_index >= 0 is used and the protocol does not support | |||
* seeking based on component streams, the call will fail with ENOTSUP. | |||
* @param timestamp timestamp in AVStream.time_base units | |||
* or if there is no stream specified then in AV_TIME_BASE units. | |||
* @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE | |||
* and AVSEEK_FLAG_ANY. The protocol may silently ignore | |||
* AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will | |||
* fail with ENOTSUP if used and not supported. | |||
* @return >= 0 on success | |||
* @see AVInputFormat::read_seek | |||
*/ | |||
int64_t av_url_read_seek(URLContext *h, int stream_index, | |||
int64_t timestamp, int flags); | |||
/** | |||
* Passing this as the "whence" parameter to a seek function causes it to | |||
* return the filesize without seeking anywhere. Supporting this is optional. | |||
* If it is not supported then the seek function will return <0. | |||
*/ | |||
#define AVSEEK_SIZE 0x10000 | |||
typedef struct URLProtocol { | |||
const char *name; | |||
int (*url_open)(URLContext *h, const char *filename, int flags); | |||
int (*url_read)(URLContext *h, unsigned char *buf, int size); | |||
int (*url_write)(URLContext *h, unsigned char *buf, int size); | |||
int64_t (*url_seek)(URLContext *h, int64_t pos, int whence); | |||
int (*url_close)(URLContext *h); | |||
struct URLProtocol *next; | |||
int (*url_read_pause)(URLContext *h, int pause); | |||
int64_t (*url_read_seek)(URLContext *h, int stream_index, | |||
int64_t timestamp, int flags); | |||
int (*url_get_file_handle)(URLContext *h); | |||
} URLProtocol; | |||
#if LIBAVFORMAT_VERSION_MAJOR < 53 | |||
extern URLProtocol *first_protocol; | |||
#endif | |||
extern URLInterruptCB *url_interrupt_cb; | |||
/** | |||
* If protocol is NULL, returns the first registered protocol, | |||
* if protocol is non-NULL, returns the next registered protocol after protocol, | |||
* or NULL if protocol is the last one. | |||
*/ | |||
URLProtocol *av_protocol_next(URLProtocol *p); | |||
#if LIBAVFORMAT_VERSION_MAJOR < 53 | |||
/** | |||
* @deprecated Use av_register_protocol() instead. | |||
*/ | |||
attribute_deprecated int register_protocol(URLProtocol *protocol); | |||
#endif | |||
int av_register_protocol(URLProtocol *protocol); | |||
/** | |||
* Bytestream IO Context. | |||
* New fields can be added to the end with minor version bumps. | |||
* Removal, reordering and changes to existing fields require a major | |||
* version bump. | |||
* sizeof(ByteIOContext) must not be used outside libav*. | |||
*/ | |||
typedef struct { | |||
unsigned char *buffer; | |||
int buffer_size; | |||
unsigned char *buf_ptr, *buf_end; | |||
void *opaque; | |||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); | |||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); | |||
int64_t (*seek)(void *opaque, int64_t offset, int whence); | |||
int64_t pos; /**< position in the file of the current buffer */ | |||
int must_flush; /**< true if the next seek should flush */ | |||
int eof_reached; /**< true if eof reached */ | |||
int write_flag; /**< true if open for writing */ | |||
int is_streamed; | |||
int max_packet_size; | |||
unsigned long checksum; | |||
unsigned char *checksum_ptr; | |||
unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); | |||
int error; ///< contains the error code or 0 if no error happened | |||
int (*read_pause)(void *opaque, int pause); | |||
int64_t (*read_seek)(void *opaque, int stream_index, | |||
int64_t timestamp, int flags); | |||
} ByteIOContext; | |||
int init_put_byte(ByteIOContext *s, | |||
unsigned char *buffer, | |||
int buffer_size, | |||
int write_flag, | |||
void *opaque, | |||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), | |||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), | |||
int64_t (*seek)(void *opaque, int64_t offset, int whence)); | |||
ByteIOContext *av_alloc_put_byte( | |||
unsigned char *buffer, | |||
int buffer_size, | |||
int write_flag, | |||
void *opaque, | |||
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), | |||
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), | |||
int64_t (*seek)(void *opaque, int64_t offset, int whence)); | |||
void put_byte(ByteIOContext *s, int b); | |||
void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); | |||
void put_le64(ByteIOContext *s, uint64_t val); | |||
void put_be64(ByteIOContext *s, uint64_t val); | |||
void put_le32(ByteIOContext *s, unsigned int val); | |||
void put_be32(ByteIOContext *s, unsigned int val); | |||
void put_le24(ByteIOContext *s, unsigned int val); | |||
void put_be24(ByteIOContext *s, unsigned int val); | |||
void put_le16(ByteIOContext *s, unsigned int val); | |||
void put_be16(ByteIOContext *s, unsigned int val); | |||
void put_tag(ByteIOContext *s, const char *tag); | |||
void put_strz(ByteIOContext *s, const char *buf); | |||
/** | |||
* fseek() equivalent for ByteIOContext. | |||
* @return new position or AVERROR. | |||
*/ | |||
int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence); | |||
/** | |||
* Skip given number of bytes forward. | |||
* @param offset number of bytes | |||
*/ | |||
void url_fskip(ByteIOContext *s, int64_t offset); | |||
/** | |||
* ftell() equivalent for ByteIOContext. | |||
* @return position or AVERROR. | |||
*/ | |||
int64_t url_ftell(ByteIOContext *s); | |||
/** | |||
* Gets the filesize. | |||
* @return filesize or AVERROR | |||
*/ | |||
int64_t url_fsize(ByteIOContext *s); | |||
/** | |||
* feof() equivalent for ByteIOContext. | |||
* @return non zero if and only if end of file | |||
*/ | |||
int url_feof(ByteIOContext *s); | |||
int url_ferror(ByteIOContext *s); | |||
int av_url_read_fpause(ByteIOContext *h, int pause); | |||
int64_t av_url_read_fseek(ByteIOContext *h, int stream_index, | |||
int64_t timestamp, int flags); | |||
#define URL_EOF (-1) | |||
/** @note return URL_EOF (-1) if EOF */ | |||
int url_fgetc(ByteIOContext *s); | |||
/** @warning currently size is limited */ | |||
#ifdef __GNUC__ | |||
int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); | |||
#else | |||
int url_fprintf(ByteIOContext *s, const char *fmt, ...); | |||
#endif | |||
/** @note unlike fgets, the EOL character is not returned and a whole | |||
line is parsed. return NULL if first char read was EOF */ | |||
char *url_fgets(ByteIOContext *s, char *buf, int buf_size); | |||
void put_flush_packet(ByteIOContext *s); | |||
/** | |||
* Reads size bytes from ByteIOContext into buf. | |||
* @returns number of bytes read or AVERROR | |||
*/ | |||
int get_buffer(ByteIOContext *s, unsigned char *buf, int size); | |||
/** | |||
* Reads size bytes from ByteIOContext into buf. | |||
* This reads at most 1 packet. If that is not enough fewer bytes will be | |||
* returned. | |||
* @returns number of bytes read or AVERROR | |||
*/ | |||
int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size); | |||
/** @note return 0 if EOF, so you cannot use it if EOF handling is | |||
necessary */ | |||
int get_byte(ByteIOContext *s); | |||
unsigned int get_le24(ByteIOContext *s); | |||
unsigned int get_le32(ByteIOContext *s); | |||
uint64_t get_le64(ByteIOContext *s); | |||
unsigned int get_le16(ByteIOContext *s); | |||
char *get_strz(ByteIOContext *s, char *buf, int maxlen); | |||
unsigned int get_be16(ByteIOContext *s); | |||
unsigned int get_be24(ByteIOContext *s); | |||
unsigned int get_be32(ByteIOContext *s); | |||
uint64_t get_be64(ByteIOContext *s); | |||
uint64_t ff_get_v(ByteIOContext *bc); | |||
__inline int url_is_streamed(ByteIOContext *s) | |||
{ | |||
return s->is_streamed; | |||
} | |||
/** @note when opened as read/write, the buffers are only used for | |||
writing */ | |||
int url_fdopen(ByteIOContext **s, URLContext *h); | |||
/** @warning must be called before any I/O */ | |||
int url_setbufsize(ByteIOContext *s, int buf_size); | |||
/** Reset the buffer for reading or writing. | |||
* @note Will drop any data currently in the buffer without transmitting it. | |||
* @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY | |||
* to set up the buffer for writing. */ | |||
int url_resetbuf(ByteIOContext *s, int flags); | |||
/** @note when opened as read/write, the buffers are only used for | |||
writing */ | |||
int url_fopen(ByteIOContext **s, const char *filename, int flags); | |||
int url_fclose(ByteIOContext *s); | |||
URLContext *url_fileno(ByteIOContext *s); | |||
/** | |||
* Return the maximum packet size associated to packetized buffered file | |||
* handle. If the file is not packetized (stream like http or file on | |||
* disk), then 0 is returned. | |||
* | |||
* @param s buffered file handle | |||
* @return maximum packet size in bytes | |||
*/ | |||
int url_fget_max_packet_size(ByteIOContext *s); | |||
int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags); | |||
/** return the written or read size */ | |||
int url_close_buf(ByteIOContext *s); | |||
/** | |||
* Open a write only memory stream. | |||
* | |||
* @param s new IO context | |||
* @return zero if no error. | |||
*/ | |||
int url_open_dyn_buf(ByteIOContext **s); | |||
/** | |||
* Open a write only packetized memory stream with a maximum packet | |||
* size of 'max_packet_size'. The stream is stored in a memory buffer | |||
* with a big endian 4 byte header giving the packet size in bytes. | |||
* | |||
* @param s new IO context | |||
* @param max_packet_size maximum packet size (must be > 0) | |||
* @return zero if no error. | |||
*/ | |||
int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size); | |||
/** | |||
* Return the written size and a pointer to the buffer. The buffer | |||
* must be freed with av_free(). | |||
* @param s IO context | |||
* @param pbuffer pointer to a byte buffer | |||
* @return the length of the byte buffer | |||
*/ | |||
int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer); | |||
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, | |||
unsigned int len); | |||
unsigned long get_checksum(ByteIOContext *s); | |||
void init_checksum(ByteIOContext *s, | |||
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), | |||
unsigned long checksum); | |||
/* udp.c */ | |||
int udp_set_remote_url(URLContext *h, const char *uri); | |||
int udp_get_local_port(URLContext *h); | |||
#if (LIBAVFORMAT_VERSION_MAJOR <= 52) | |||
int udp_get_file_handle(URLContext *h); | |||
#endif | |||
#endif /* AVFORMAT_AVIO_H */ |
@@ -0,0 +1,97 @@ | |||
/* | |||
* RTSP definitions | |||
* Copyright (c) 2002 Fabrice Bellard. | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef FFMPEG_RTSP_H | |||
#define FFMPEG_RTSP_H | |||
#include <stdint.h> | |||
#include "avformat.h" | |||
#include "rtspcodes.h" | |||
enum RTSPProtocol { | |||
RTSP_PROTOCOL_RTP_UDP = 0, | |||
RTSP_PROTOCOL_RTP_TCP = 1, | |||
RTSP_PROTOCOL_RTP_UDP_MULTICAST = 2, | |||
/** | |||
* This is not part of public API and shouldn't be used outside of ffmpeg. | |||
*/ | |||
RTSP_PROTOCOL_RTP_LAST | |||
}; | |||
#define RTSP_DEFAULT_PORT 554 | |||
#define RTSP_MAX_TRANSPORTS 8 | |||
#define RTSP_TCP_MAX_PACKET_SIZE 1472 | |||
#define RTSP_DEFAULT_NB_AUDIO_CHANNELS 2 | |||
#define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100 | |||
#define RTSP_RTP_PORT_MIN 5000 | |||
#define RTSP_RTP_PORT_MAX 10000 | |||
typedef struct RTSPTransportField { | |||
int interleaved_min, interleaved_max; /**< interleave ids, if TCP transport */ | |||
int port_min, port_max; /**< RTP ports */ | |||
int client_port_min, client_port_max; /**< RTP ports */ | |||
int server_port_min, server_port_max; /**< RTP ports */ | |||
int ttl; /**< ttl value */ | |||
uint32_t destination; /**< destination IP address */ | |||
enum RTSPProtocol protocol; | |||
} RTSPTransportField; | |||
typedef struct RTSPHeader { | |||
int content_length; | |||
enum RTSPStatusCode status_code; /**< response code from server */ | |||
int nb_transports; | |||
/** in AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */ | |||
int64_t range_start, range_end; | |||
RTSPTransportField transports[RTSP_MAX_TRANSPORTS]; | |||
int seq; /**< sequence number */ | |||
char session_id[512]; | |||
} RTSPHeader; | |||
/** the callback can be used to extend the connection setup/teardown step */ | |||
enum RTSPCallbackAction { | |||
RTSP_ACTION_SERVER_SETUP, | |||
RTSP_ACTION_SERVER_TEARDOWN, | |||
RTSP_ACTION_CLIENT_SETUP, | |||
RTSP_ACTION_CLIENT_TEARDOWN, | |||
}; | |||
typedef struct RTSPActionServerSetup { | |||
uint32_t ipaddr; | |||
char transport_option[512]; | |||
} RTSPActionServerSetup; | |||
typedef int FFRTSPCallback(enum RTSPCallbackAction action, | |||
const char *session_id, | |||
char *buf, int buf_size, | |||
void *arg); | |||
int rtsp_init(void); | |||
void rtsp_parse_line(RTSPHeader *reply, const char *buf); | |||
#if LIBAVFORMAT_VERSION_INT < (53 << 16) | |||
extern int rtsp_default_protocols; | |||
#endif | |||
extern int rtsp_rtp_port_min; | |||
extern int rtsp_rtp_port_max; | |||
int rtsp_pause(AVFormatContext *s); | |||
int rtsp_resume(AVFormatContext *s); | |||
#endif /* FFMPEG_RTSP_H */ |
@@ -0,0 +1,40 @@ | |||
/* | |||
* RTSP definitions | |||
* copyright (c) 2002 Fabrice Bellard | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef FFMPEG_RTSPCODES_H | |||
#define FFMPEG_RTSPCODES_H | |||
/** RTSP handling */ | |||
enum RTSPStatusCode { | |||
RTSP_STATUS_OK =200, /**< OK */ | |||
RTSP_STATUS_METHOD =405, /**< Method Not Allowed */ | |||
RTSP_STATUS_BANDWIDTH =453, /**< Not Enough Bandwidth */ | |||
RTSP_STATUS_SESSION =454, /**< Session Not Found */ | |||
RTSP_STATUS_STATE =455, /**< Method Not Valid in This State */ | |||
RTSP_STATUS_AGGREGATE =459, /**< Aggregate operation not allowed */ | |||
RTSP_STATUS_ONLY_AGGREGATE =460, /**< Only aggregate operation allowed */ | |||
RTSP_STATUS_TRANSPORT =461, /**< Unsupported transport */ | |||
RTSP_STATUS_INTERNAL =500, /**< Internal Server Error */ | |||
RTSP_STATUS_SERVICE =503, /**< Service Unavailable */ | |||
RTSP_STATUS_VERSION =505, /**< RTSP Version not supported */ | |||
}; | |||
#endif /* FFMPEG_RTSPCODES_H */ |
@@ -0,0 +1,30 @@ | |||
/* | |||
* copyright (c) 2006 Mans Rullgard | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_ADLER32_H | |||
#define AVUTIL_ADLER32_H | |||
#include <stdint.h> | |||
#include "common.h" | |||
unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, | |||
unsigned int len) av_pure; | |||
#endif /* AVUTIL_ADLER32_H */ |
@@ -0,0 +1,90 @@ | |||
/* | |||
* Copyright (c) 2007 Mans Rullgard | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_AVSTRING_H | |||
#define AVUTIL_AVSTRING_H | |||
#include <stddef.h> | |||
/** | |||
* Return non-zero if pfx is a prefix of str. If it is, *ptr is set to | |||
* the address of the first character in str after the prefix. | |||
* | |||
* @param str input string | |||
* @param pfx prefix to test | |||
* @param ptr updated if the prefix is matched inside str | |||
* @return non-zero if the prefix matches, zero otherwise | |||
*/ | |||
int av_strstart(const char *str, const char *pfx, const char **ptr); | |||
/** | |||
* Return non-zero if pfx is a prefix of str independent of case. If | |||
* it is, *ptr is set to the address of the first character in str | |||
* after the prefix. | |||
* | |||
* @param str input string | |||
* @param pfx prefix to test | |||
* @param ptr updated if the prefix is matched inside str | |||
* @return non-zero if the prefix matches, zero otherwise | |||
*/ | |||
int av_stristart(const char *str, const char *pfx, const char **ptr); | |||
/** | |||
* Copy the string src to dst, but no more than size - 1 bytes, and | |||
* null-terminate dst. | |||
* | |||
* This function is the same as BSD strlcpy(). | |||
* | |||
* @param dst destination buffer | |||
* @param src source string | |||
* @param size size of destination buffer | |||
* @return the length of src | |||
*/ | |||
size_t av_strlcpy(char *dst, const char *src, size_t size); | |||
/** | |||
* Append the string src to the string dst, but to a total length of | |||
* no more than size - 1 bytes, and null-terminate dst. | |||
* | |||
* This function is similar to BSD strlcat(), but differs when | |||
* size <= strlen(dst). | |||
* | |||
* @param dst destination buffer | |||
* @param src source string | |||
* @param size size of destination buffer | |||
* @return the total length of src and dst | |||
*/ | |||
size_t av_strlcat(char *dst, const char *src, size_t size); | |||
/** | |||
* Append output to a string, according to a format. Never write out of | |||
* the destination buffer, and and always put a terminating 0 within | |||
* the buffer. | |||
* @param dst destination buffer (string to which the output is | |||
* appended) | |||
* @param size total size of the destination buffer | |||
* @param fmt printf-compatible format string, specifying how the | |||
* following parameters are used | |||
* @return the length of the string that would have been generated | |||
* if enough space had been available | |||
*/ | |||
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...); | |||
#endif /* AVUTIL_AVSTRING_H */ |
@@ -0,0 +1,63 @@ | |||
/* | |||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_AVUTIL_H | |||
#define AVUTIL_AVUTIL_H | |||
/** | |||
* @file libavutil/avutil.h | |||
* external API header | |||
*/ | |||
#define AV_STRINGIFY(s) AV_TOSTRING(s) | |||
#define AV_TOSTRING(s) #s | |||
#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) | |||
#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c | |||
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) | |||
#define LIBAVUTIL_VERSION_MAJOR 50 | |||
#define LIBAVUTIL_VERSION_MINOR 0 | |||
#define LIBAVUTIL_VERSION_MICRO 0 | |||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | |||
LIBAVUTIL_VERSION_MINOR, \ | |||
LIBAVUTIL_VERSION_MICRO) | |||
#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ | |||
LIBAVUTIL_VERSION_MINOR, \ | |||
LIBAVUTIL_VERSION_MICRO) | |||
#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT | |||
#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) | |||
/** | |||
* Returns the LIBAVUTIL_VERSION_INT constant. | |||
*/ | |||
unsigned avutil_version(void); | |||
#include "common.h" | |||
#include "mathematics.h" | |||
#include "rational.h" | |||
#include "intfloat_readwrite.h" | |||
#include "log.h" | |||
#include "pixfmt.h" | |||
#endif /* AVUTIL_AVUTIL_H */ |
@@ -0,0 +1,49 @@ | |||
/* | |||
* Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_BASE64_H | |||
#define AVUTIL_BASE64_H | |||
#include <stdint.h> | |||
/** | |||
* Decodes the base64-encoded string in \p in and puts the decoded | |||
* data in \p out. | |||
* | |||
* @param out_size size in bytes of the \p out buffer, it should be at | |||
* least 3/4 of the length of \p in | |||
* @return the number of bytes written, or a negative value in case of | |||
* error | |||
*/ | |||
int av_base64_decode(uint8_t *out, const char *in, int out_size); | |||
/** | |||
* Encodes in base64 the data in \p in and puts the resulting string | |||
* in \p out. | |||
* | |||
* @param out_size size in bytes of the \p out string, it should be at | |||
* least ((\p in_size + 2) / 3) * 4 + 1 | |||
* @param in_size size in bytes of the \p in buffer | |||
* @return the string containing the encoded data, or NULL in case of | |||
* error | |||
*/ | |||
char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); | |||
#endif /* AVUTIL_BASE64_H */ |
@@ -0,0 +1,286 @@ | |||
/* | |||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
/** | |||
* @file libavutil/common.h | |||
* common internal and external API header | |||
*/ | |||
#ifndef AVUTIL_COMMON_H | |||
#define AVUTIL_COMMON_H | |||
#include <ctype.h> | |||
#include <errno.h> | |||
#include <inttypes.h> | |||
#include <limits.h> | |||
#include <math.h> | |||
#include <stdio.h> | |||
#include <stdlib.h> | |||
#include <string.h> | |||
#ifdef __GNUC__ | |||
# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) | |||
#else | |||
# define AV_GCC_VERSION_AT_LEAST(x,y) 0 | |||
#endif | |||
#ifndef av_always_inline | |||
#if AV_GCC_VERSION_AT_LEAST(3,1) | |||
# define av_always_inline __attribute__((always_inline)) inline | |||
#else | |||
# define av_always_inline inline | |||
#endif | |||
#endif | |||
#ifndef av_noinline | |||
#if AV_GCC_VERSION_AT_LEAST(3,1) | |||
# define av_noinline __attribute__((noinline)) | |||
#else | |||
# define av_noinline | |||
#endif | |||
#endif | |||
#ifndef av_pure | |||
#if AV_GCC_VERSION_AT_LEAST(3,1) | |||
# define av_pure __attribute__((pure)) | |||
#else | |||
# define av_pure | |||
#endif | |||
#endif | |||
#ifndef av_const | |||
#if AV_GCC_VERSION_AT_LEAST(2,6) | |||
# define av_const __attribute__((const)) | |||
#else | |||
# define av_const | |||
#endif | |||
#endif | |||
#ifndef av_cold | |||
#if (!defined(__ICC) || __ICC > 1100) && AV_GCC_VERSION_AT_LEAST(4,3) | |||
# define av_cold __attribute__((cold)) | |||
#else | |||
# define av_cold | |||
#endif | |||
#endif | |||
#ifndef av_flatten | |||
#if AV_GCC_VERSION_AT_LEAST(4,1) | |||
# define av_flatten __attribute__((flatten)) | |||
#else | |||
# define av_flatten | |||
#endif | |||
#endif | |||
#ifndef attribute_deprecated | |||
#if AV_GCC_VERSION_AT_LEAST(3,1) | |||
# define attribute_deprecated __attribute__((deprecated)) | |||
#else | |||
# define attribute_deprecated | |||
#endif | |||
#endif | |||
#ifndef av_unused | |||
#if defined(__GNUC__) | |||
# define av_unused __attribute__((unused)) | |||
#else | |||
# define av_unused | |||
#endif | |||
#endif | |||
#ifndef av_uninit | |||
#if defined(__GNUC__) && !defined(__ICC) | |||
# define av_uninit(x) x=x | |||
#else | |||
# define av_uninit(x) x | |||
#endif | |||
#endif | |||
//rounded division & shift | |||
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) | |||
/* assume b>0 */ | |||
#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) | |||
#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) | |||
#define FFSIGN(a) ((a) > 0 ? 1 : -1) | |||
#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) | |||
#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) | |||
#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) | |||
#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) | |||
#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) | |||
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) | |||
/* misc math functions */ | |||
extern const uint8_t ff_log2_tab[256]; | |||
__inline av_const int av_log2(unsigned int v) | |||
{ | |||
int n = 0; | |||
if (v & 0xffff0000) { | |||
v >>= 16; | |||
n += 16; | |||
} | |||
if (v & 0xff00) { | |||
v >>= 8; | |||
n += 8; | |||
} | |||
n += ff_log2_tab[v]; | |||
return n; | |||
} | |||
__inline av_const int av_log2_16bit(unsigned int v) | |||
{ | |||
int n = 0; | |||
if (v & 0xff00) { | |||
v >>= 8; | |||
n += 8; | |||
} | |||
n += ff_log2_tab[v]; | |||
return n; | |||
} | |||
/** | |||
* Clips a signed integer value into the amin-amax range. | |||
* @param a value to clip | |||
* @param amin minimum value of the clip range | |||
* @param amax maximum value of the clip range | |||
* @return clipped value | |||
*/ | |||
__inline av_const int av_clip(int a, int amin, int amax) | |||
{ | |||
if (a < amin) return amin; | |||
else if (a > amax) return amax; | |||
else return a; | |||
} | |||
/** | |||
* Clips a signed integer value into the 0-255 range. | |||
* @param a value to clip | |||
* @return clipped value | |||
*/ | |||
__inline av_const uint8_t av_clip_uint8(int a) | |||
{ | |||
if (a&(~255)) return (-a)>>31; | |||
else return a; | |||
} | |||
/** | |||
* Clips a signed integer value into the -32768,32767 range. | |||
* @param a value to clip | |||
* @return clipped value | |||
*/ | |||
__inline av_const int16_t av_clip_int16(int a) | |||
{ | |||
if ((a+32768) & ~65535) return (a>>31) ^ 32767; | |||
else return a; | |||
} | |||
/** | |||
* Clips a float value into the amin-amax range. | |||
* @param a value to clip | |||
* @param amin minimum value of the clip range | |||
* @param amax maximum value of the clip range | |||
* @return clipped value | |||
*/ | |||
__inline av_const float av_clipf(float a, float amin, float amax) | |||
{ | |||
if (a < amin) return amin; | |||
else if (a > amax) return amax; | |||
else return a; | |||
} | |||
#define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) | |||
#define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24)) | |||
/*! | |||
* \def GET_UTF8(val, GET_BYTE, ERROR) | |||
* Converts a UTF-8 character (up to 4 bytes long) to its 32-bit UCS-4 encoded form | |||
* \param val is the output and should be of type uint32_t. It holds the converted | |||
* UCS-4 character and should be a left value. | |||
* \param GET_BYTE gets UTF-8 encoded bytes from any proper source. It can be | |||
* a function or a statement whose return value or evaluated value is of type | |||
* uint8_t. It will be executed up to 4 times for values in the valid UTF-8 range, | |||
* and up to 7 times in the general case. | |||
* \param ERROR action that should be taken when an invalid UTF-8 byte is returned | |||
* from GET_BYTE. It should be a statement that jumps out of the macro, | |||
* like exit(), goto, return, break, or continue. | |||
*/ | |||
#define GET_UTF8(val, GET_BYTE, ERROR)\ | |||
val= GET_BYTE;\ | |||
{\ | |||
int ones= 7 - av_log2(val ^ 255);\ | |||
if(ones==1)\ | |||
ERROR\ | |||
val&= 127>>ones;\ | |||
while(--ones > 0){\ | |||
int tmp= GET_BYTE - 128;\ | |||
if(tmp>>6)\ | |||
ERROR\ | |||
val= (val<<6) + tmp;\ | |||
}\ | |||
} | |||
/*! | |||
* \def PUT_UTF8(val, tmp, PUT_BYTE) | |||
* Converts a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). | |||
* \param val is an input-only argument and should be of type uint32_t. It holds | |||
* a UCS-4 encoded Unicode character that is to be converted to UTF-8. If | |||
* val is given as a function it is executed only once. | |||
* \param tmp is a temporary variable and should be of type uint8_t. It | |||
* represents an intermediate value during conversion that is to be | |||
* output by PUT_BYTE. | |||
* \param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. | |||
* It could be a function or a statement, and uses tmp as the input byte. | |||
* For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be | |||
* executed up to 4 times for values in the valid UTF-8 range and up to | |||
* 7 times in the general case, depending on the length of the converted | |||
* Unicode character. | |||
*/ | |||
#define PUT_UTF8(val, tmp, PUT_BYTE)\ | |||
{\ | |||
int bytes, shift;\ | |||
uint32_t in = val;\ | |||
if (in < 0x80) {\ | |||
tmp = in;\ | |||
PUT_BYTE\ | |||
} else {\ | |||
bytes = (av_log2(in) + 4) / 5;\ | |||
shift = (bytes - 1) * 6;\ | |||
tmp = (256 - (256 >> bytes)) | (in >> shift);\ | |||
PUT_BYTE\ | |||
while (shift >= 6) {\ | |||
shift -= 6;\ | |||
tmp = 0x80 | ((in >> shift) & 0x3f);\ | |||
PUT_BYTE\ | |||
}\ | |||
}\ | |||
} | |||
#include "mem.h" | |||
#ifdef HAVE_AV_CONFIG_H | |||
# include "config.h" | |||
# include "internal.h" | |||
#endif /* HAVE_AV_CONFIG_H */ | |||
#endif /* AVUTIL_COMMON_H */ |
@@ -0,0 +1,44 @@ | |||
/* | |||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_CRC_H | |||
#define AVUTIL_CRC_H | |||
#include <stdint.h> | |||
#include <stddef.h> | |||
#include "common.h" | |||
typedef uint32_t AVCRC; | |||
typedef enum { | |||
AV_CRC_8_ATM, | |||
AV_CRC_16_ANSI, | |||
AV_CRC_16_CCITT, | |||
AV_CRC_32_IEEE, | |||
AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ | |||
AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ | |||
}AVCRCId; | |||
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); | |||
const AVCRC *av_crc_get_table(AVCRCId crc_id); | |||
uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure; | |||
#endif /* AVUTIL_CRC_H */ | |||
@@ -0,0 +1,109 @@ | |||
/* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
/** | |||
* @file libavutil/fifo.h | |||
* a very simple circular buffer FIFO implementation | |||
*/ | |||
#ifndef AVUTIL_FIFO_H | |||
#define AVUTIL_FIFO_H | |||
#include <stdint.h> | |||
#include "avutil.h" | |||
#include "common.h" | |||
typedef struct AVFifoBuffer { | |||
uint8_t *buffer; | |||
uint8_t *rptr, *wptr, *end; | |||
uint32_t rndx, wndx; | |||
} AVFifoBuffer; | |||
/** | |||
* Initializes an AVFifoBuffer. | |||
* @param size of FIFO | |||
* @return AVFifoBuffer or NULL if mem allocation failure | |||
*/ | |||
AVFifoBuffer *av_fifo_alloc(unsigned int size); | |||
/** | |||
* Frees an AVFifoBuffer. | |||
* @param *f AVFifoBuffer to free | |||
*/ | |||
void av_fifo_free(AVFifoBuffer *f); | |||
/** | |||
* Resets the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. | |||
* @param *f AVFifoBuffer to reset | |||
*/ | |||
void av_fifo_reset(AVFifoBuffer *f); | |||
/** | |||
* Returns the amount of data in bytes in the AVFifoBuffer, that is the | |||
* amount of data you can read from it. | |||
* @param *f AVFifoBuffer to read from | |||
* @return size | |||
*/ | |||
int av_fifo_size(AVFifoBuffer *f); | |||
/** | |||
* Feeds data from an AVFifoBuffer to a user-supplied callback. | |||
* @param *f AVFifoBuffer to read from | |||
* @param buf_size number of bytes to read | |||
* @param *func generic read function | |||
* @param *dest data destination | |||
*/ | |||
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); | |||
/** | |||
* Feeds data from a user-supplied callback to an AVFifoBuffer. | |||
* @param *f AVFifoBuffer to write to | |||
* @param *src data source | |||
* @param size number of bytes to write | |||
* @param *func generic write function; the first parameter is src, | |||
* the second is dest_buf, the third is dest_buf_size. | |||
* func must return the number of bytes written to dest_buf, or <= 0 to | |||
* indicate no more data available to write. | |||
* If func is NULL, src is interpreted as a simple byte array for source data. | |||
* @return the number of bytes written to the FIFO | |||
*/ | |||
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); | |||
/** | |||
* Resizes an AVFifoBuffer. | |||
* @param *f AVFifoBuffer to resize | |||
* @param size new AVFifoBuffer size in bytes | |||
* @return <0 for failure, >=0 otherwise | |||
*/ | |||
int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); | |||
/** | |||
* Reads and discards the specified amount of data from an AVFifoBuffer. | |||
* @param *f AVFifoBuffer to read from | |||
* @param size amount of data to read in bytes | |||
*/ | |||
void av_fifo_drain(AVFifoBuffer *f, int size); | |||
__inline uint8_t av_fifo_peek(AVFifoBuffer *f, int offs) | |||
{ | |||
uint8_t *ptr = f->rptr + offs; | |||
if (ptr >= f->end) | |||
ptr -= f->end - f->buffer; | |||
return *ptr; | |||
} | |||
#endif /* AVUTIL_FIFO_H */ |
@@ -0,0 +1,40 @@ | |||
/* | |||
* copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_INTFLOAT_READWRITE_H | |||
#define AVUTIL_INTFLOAT_READWRITE_H | |||
#include <stdint.h> | |||
#include "common.h" | |||
/* IEEE 80 bits extended float */ | |||
typedef struct AVExtFloat { | |||
uint8_t exponent[2]; | |||
uint8_t mantissa[8]; | |||
} AVExtFloat; | |||
double av_int2dbl(int64_t v) av_const; | |||
float av_int2flt(int32_t v) av_const; | |||
double av_ext2dbl(const AVExtFloat ext) av_const; | |||
int64_t av_dbl2int(double d) av_const; | |||
int32_t av_flt2int(float d) av_const; | |||
AVExtFloat av_dbl2ext(double d) av_const; | |||
#endif /* AVUTIL_INTFLOAT_READWRITE_H */ |
@@ -0,0 +1,116 @@ | |||
/* | |||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_LOG_H | |||
#define AVUTIL_LOG_H | |||
#include <stdarg.h> | |||
#include "avutil.h" | |||
/** | |||
* Describes the class of an AVClass context structure. That is an | |||
* arbitrary struct of which the first field is a pointer to an | |||
* AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). | |||
*/ | |||
typedef struct AVCLASS AVClass; | |||
struct AVCLASS { | |||
/** | |||
* The name of the class; usually it is the same name as the | |||
* context structure type to which the AVClass is associated. | |||
*/ | |||
const char* class_name; | |||
/** | |||
* A pointer to a function which returns the name of a context | |||
* instance \p ctx associated with the class. | |||
*/ | |||
const char* (*item_name)(void* ctx); | |||
/** | |||
* a pointer to the first option specified in the class if any or NULL | |||
* | |||
* @see av_set_default_options() | |||
*/ | |||
const struct AVOption *option; | |||
}; | |||
/* av_log API */ | |||
#define AV_LOG_QUIET -8 | |||
/** | |||
* Something went really wrong and we will crash now. | |||
*/ | |||
#define AV_LOG_PANIC 0 | |||
/** | |||
* Something went wrong and recovery is not possible. | |||
* For example, no header was found for a format which depends | |||
* on headers or an illegal combination of parameters is used. | |||
*/ | |||
#define AV_LOG_FATAL 8 | |||
/** | |||
* Something went wrong and cannot losslessly be recovered. | |||
* However, not all future data is affected. | |||
*/ | |||
#define AV_LOG_ERROR 16 | |||
/** | |||
* Something somehow does not look correct. This may or may not | |||
* lead to problems. An example would be the use of '-vstrict -2'. | |||
*/ | |||
#define AV_LOG_WARNING 24 | |||
#define AV_LOG_INFO 32 | |||
#define AV_LOG_VERBOSE 40 | |||
/** | |||
* Stuff which is only useful for libav* developers. | |||
*/ | |||
#define AV_LOG_DEBUG 48 | |||
/** | |||
* Sends the specified message to the log if the level is less than or equal | |||
* to the current av_log_level. By default, all logging messages are sent to | |||
* stderr. This behavior can be altered by setting a different av_vlog callback | |||
* function. | |||
* | |||
* @param avcl A pointer to an arbitrary struct of which the first field is a | |||
* pointer to an AVClass struct. | |||
* @param level The importance level of the message, lower values signifying | |||
* higher importance. | |||
* @param fmt The format string (printf-compatible) that specifies how | |||
* subsequent arguments are converted to output. | |||
* @see av_vlog | |||
*/ | |||
#ifdef __GNUC__ | |||
void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); | |||
#else | |||
void av_log(void*, int level, const char *fmt, ...); | |||
#endif | |||
void av_vlog(void*, int level, const char *fmt, va_list); | |||
int av_log_get_level(void); | |||
void av_log_set_level(int); | |||
void av_log_set_callback(void (*)(void*, int, const char*, va_list)); | |||
void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); | |||
#endif /* AVUTIL_LOG_H */ |
@@ -0,0 +1,66 @@ | |||
/* | |||
* LZO 1x decompression | |||
* copyright (c) 2006 Reimar Doeffinger | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_LZO_H | |||
#define AVUTIL_LZO_H | |||
#include <stdint.h> | |||
/** \defgroup errflags Error flags returned by av_lzo1x_decode | |||
* \{ */ | |||
//! end of the input buffer reached before decoding finished | |||
#define AV_LZO_INPUT_DEPLETED 1 | |||
//! decoded data did not fit into output buffer | |||
#define AV_LZO_OUTPUT_FULL 2 | |||
//! a reference to previously decoded data was wrong | |||
#define AV_LZO_INVALID_BACKPTR 4 | |||
//! a non-specific error in the compressed bitstream | |||
#define AV_LZO_ERROR 8 | |||
/** \} */ | |||
#define AV_LZO_INPUT_PADDING 8 | |||
#define AV_LZO_OUTPUT_PADDING 12 | |||
/** | |||
* \brief Decodes LZO 1x compressed data. | |||
* \param out output buffer | |||
* \param outlen size of output buffer, number of bytes left are returned here | |||
* \param in input buffer | |||
* \param inlen size of input buffer, number of bytes left are returned here | |||
* \return 0 on success, otherwise a combination of the error flags above | |||
* | |||
* Make sure all buffers are appropriately padded, in must provide | |||
* AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. | |||
*/ | |||
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); | |||
/** | |||
* \brief deliberately overlapping memcpy implementation | |||
* \param dst destination buffer; must be padded with 12 additional bytes | |||
* \param back how many bytes back we start (the initial size of the overlapping window) | |||
* \param cnt number of bytes to copy, must be >= 0 | |||
* | |||
* cnt > back is valid, this will copy the bytes we just copied, | |||
* thus creating a repeating pattern with a period length of back. | |||
*/ | |||
void av_memcpy_backptr(uint8_t *dst, int back, int cnt); | |||
#endif /* AVUTIL_LZO_H */ |
@@ -0,0 +1,72 @@ | |||
/* | |||
* copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_MATHEMATICS_H | |||
#define AVUTIL_MATHEMATICS_H | |||
#include <stdint.h> | |||
#include <math.h> | |||
#include "common.h" | |||
#include "rational.h" | |||
#ifndef M_E | |||
#define M_E 2.7182818284590452354 /* e */ | |||
#endif | |||
#ifndef M_LN2 | |||
#define M_LN2 0.69314718055994530942 /* log_e 2 */ | |||
#endif | |||
#ifndef M_LN10 | |||
#define M_LN10 2.30258509299404568402 /* log_e 10 */ | |||
#endif | |||
#ifndef M_PI | |||
#define M_PI 3.14159265358979323846 /* pi */ | |||
#endif | |||
#ifndef M_SQRT1_2 | |||
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ | |||
#endif | |||
enum AVRounding { | |||
AV_ROUND_ZERO = 0, ///< Round toward zero. | |||
AV_ROUND_INF = 1, ///< Round away from zero. | |||
AV_ROUND_DOWN = 2, ///< Round toward -infinity. | |||
AV_ROUND_UP = 3, ///< Round toward +infinity. | |||
AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. | |||
}; | |||
int64_t av_const av_gcd(int64_t a, int64_t b); | |||
/** | |||
* Rescales a 64-bit integer with rounding to nearest. | |||
* A simple a*b/c isn't possible as it can overflow. | |||
*/ | |||
int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; | |||
/** | |||
* Rescales a 64-bit integer with specified rounding. | |||
* A simple a*b/c isn't possible as it can overflow. | |||
*/ | |||
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; | |||
/** | |||
* Rescales a 64-bit integer by 2 rational numbers. | |||
*/ | |||
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; | |||
#endif /* AVUTIL_MATHEMATICS_H */ |
@@ -0,0 +1,36 @@ | |||
/* | |||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_MD5_H | |||
#define AVUTIL_MD5_H | |||
#include <stdint.h> | |||
extern const int av_md5_size; | |||
struct AVMD5; | |||
void av_md5_init(struct AVMD5 *ctx); | |||
void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); | |||
void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); | |||
void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); | |||
#endif /* AVUTIL_MD5_H */ | |||
@@ -0,0 +1,104 @@ | |||
/* | |||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
/** | |||
* @file libavutil/mem.h | |||
* memory handling functions | |||
*/ | |||
#ifndef AVUTIL_MEM_H | |||
#define AVUTIL_MEM_H | |||
#include "common.h" | |||
#if AV_GCC_VERSION_AT_LEAST(3,1) | |||
#define av_malloc_attrib __attribute__((__malloc__)) | |||
#else | |||
#define av_malloc_attrib | |||
#endif | |||
#if (!defined(__ICC) || __ICC > 1100) && AV_GCC_VERSION_AT_LEAST(4,3) | |||
#define av_alloc_size(n) __attribute__((alloc_size(n))) | |||
#else | |||
#define av_alloc_size(n) | |||
#endif | |||
/** | |||
* Allocates a block of \p size bytes with alignment suitable for all | |||
* memory accesses (including vectors if available on the CPU). | |||
* @param size Size in bytes for the memory block to be allocated. | |||
* @return Pointer to the allocated block, NULL if the block cannot | |||
* be allocated. | |||
* @see av_mallocz() | |||
*/ | |||
void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1); | |||
/** | |||
* Allocates or reallocates a block of memory. | |||
* If \p ptr is NULL and \p size > 0, allocates a new block. If \p | |||
* size is zero, frees the memory block pointed to by \p ptr. | |||
* @param size Size in bytes for the memory block to be allocated or | |||
* reallocated. | |||
* @param ptr Pointer to a memory block already allocated with | |||
* av_malloc(z)() or av_realloc() or NULL. | |||
* @return Pointer to a newly reallocated block or NULL if the block | |||
* cannot be reallocated or the function is used to free the memory block. | |||
* @see av_fast_realloc() | |||
*/ | |||
void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2); | |||
/** | |||
* Frees a memory block which has been allocated with av_malloc(z)() or | |||
* av_realloc(). | |||
* @param ptr Pointer to the memory block which should be freed. | |||
* @note ptr = NULL is explicitly allowed. | |||
* @note It is recommended that you use av_freep() instead. | |||
* @see av_freep() | |||
*/ | |||
void av_free(void *ptr); | |||
/** | |||
* Allocates a block of \p size bytes with alignment suitable for all | |||
* memory accesses (including vectors if available on the CPU) and | |||
* zeroes all the bytes of the block. | |||
* @param size Size in bytes for the memory block to be allocated. | |||
* @return Pointer to the allocated block, NULL if it cannot be allocated. | |||
* @see av_malloc() | |||
*/ | |||
void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1); | |||
/** | |||
* Duplicates the string \p s. | |||
* @param s string to be duplicated | |||
* @return Pointer to a newly allocated string containing a | |||
* copy of \p s or NULL if the string cannot be allocated. | |||
*/ | |||
char *av_strdup(const char *s) av_malloc_attrib; | |||
/** | |||
* Frees a memory block which has been allocated with av_malloc(z)() or | |||
* av_realloc() and set the pointer pointing to it to NULL. | |||
* @param ptr Pointer to the pointer to the memory block which should | |||
* be freed. | |||
* @see av_free() | |||
*/ | |||
void av_freep(void *ptr); | |||
#endif /* AVUTIL_MEM_H */ |
@@ -0,0 +1,131 @@ | |||
/* | |||
* copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_PIXFMT_H | |||
#define AVUTIL_PIXFMT_H | |||
/** | |||
* @file libavutil/pixfmt.h | |||
* pixel format definitions | |||
* | |||
* @warning This file has to be considered an internal but installed | |||
* header, so it should not be directly included in your projects. | |||
*/ | |||
/** | |||
* Pixel format. Notes: | |||
* | |||
* PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA | |||
* color is put together as: | |||
* (A << 24) | (R << 16) | (G << 8) | B | |||
* This is stored as BGRA on little-endian CPU architectures and ARGB on | |||
* big-endian CPUs. | |||
* | |||
* When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized | |||
* image data is stored in AVFrame.data[0]. The palette is transported in | |||
* AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is | |||
* formatted the same as in PIX_FMT_RGB32 described above (i.e., it is | |||
* also endian-specific). Note also that the individual RGB palette | |||
* components stored in AVFrame.data[1] should be in the range 0..255. | |||
* This is important as many custom PAL8 video codecs that were designed | |||
* to run on the IBM VGA graphics adapter use 6-bit palette components. | |||
* | |||
* For all the 8bit per pixel formats, an RGB32 palette is in data[1] like | |||
* for pal8. This palette is filled in automatically by the function | |||
* allocating the picture. | |||
* | |||
* Note, make sure that all newly added big endian formats have pix_fmt&1==1 | |||
* and that all newly added little endian formats have pix_fmt&1==0 | |||
* this allows simpler detection of big vs little endian. | |||
*/ | |||
enum PixelFormat { | |||
PIX_FMT_NONE= -1, | |||
PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) | |||
PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr | |||
PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... | |||
PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... | |||
PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) | |||
PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) | |||
PIX_FMT_RGB32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness | |||
PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) | |||
PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) | |||
PIX_FMT_RGB565, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in CPU endianness | |||
PIX_FMT_RGB555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in CPU endianness, most significant bit to 0 | |||
PIX_FMT_GRAY8, ///< Y , 8bpp | |||
PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black | |||
PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white | |||
PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette | |||
PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG) | |||
PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG) | |||
PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG) | |||
PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing | |||
PIX_FMT_XVMC_MPEG2_IDCT, | |||
PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 | |||
PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 | |||
PIX_FMT_BGR32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness | |||
PIX_FMT_BGR565, ///< packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in CPU endianness | |||
PIX_FMT_BGR555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in CPU endianness, most significant bit to 1 | |||
PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) | |||
PIX_FMT_BGR4, ///< packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) | |||
PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) | |||
PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) | |||
PIX_FMT_RGB4, ///< packed RGB 1:2:1, 4bpp, (msb)1R 2G 1B(lsb) | |||
PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) | |||
PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV | |||
PIX_FMT_NV21, ///< as above, but U and V bytes are swapped | |||
PIX_FMT_RGB32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness | |||
PIX_FMT_BGR32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness | |||
PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian | |||
PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian | |||
PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) | |||
PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG) | |||
PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) | |||
PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers | |||
PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers | |||
PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers | |||
PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers | |||
PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers | |||
PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, big-endian | |||
PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, little-endian | |||
PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers | |||
PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers | |||
PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers | |||
PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions | |||
}; | |||
#ifdef WORDS_BIGENDIAN | |||
#define PIX_FMT_RGBA PIX_FMT_RGB32_1 | |||
#define PIX_FMT_BGRA PIX_FMT_BGR32_1 | |||
#define PIX_FMT_ARGB PIX_FMT_RGB32 | |||
#define PIX_FMT_ABGR PIX_FMT_BGR32 | |||
#define PIX_FMT_GRAY16 PIX_FMT_GRAY16BE | |||
#define PIX_FMT_RGB48 PIX_FMT_RGB48BE | |||
#else | |||
#define PIX_FMT_RGBA PIX_FMT_BGR32 | |||
#define PIX_FMT_BGRA PIX_FMT_RGB32 | |||
#define PIX_FMT_ARGB PIX_FMT_BGR32_1 | |||
#define PIX_FMT_ABGR PIX_FMT_RGB32_1 | |||
#define PIX_FMT_GRAY16 PIX_FMT_GRAY16LE | |||
#define PIX_FMT_RGB48 PIX_FMT_RGB48LE | |||
#endif | |||
#endif /* AVUTIL_PIXFMT_H */ |
@@ -0,0 +1,69 @@ | |||
/* | |||
* Mersenne Twister Random Algorithm | |||
* Copyright (c) 2006 Ryan Martell. | |||
* Based on A C-program for MT19937, with initialization improved 2002/1/26. Coded by | |||
* Takuji Nishimura and Makoto Matsumoto. | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef FFMPEG_RANDOM_H | |||
#define FFMPEG_RANDOM_H | |||
#define AV_RANDOM_N 624 | |||
typedef struct { | |||
unsigned int mt[AV_RANDOM_N]; ///< the array for the state vector | |||
int index; ///< current untempered value we use as the base. | |||
} AVRandomState; | |||
void av_init_random(unsigned int seed, AVRandomState *state); ///< to be inlined, the struct must be visible, so it doesn't make sense to try and keep it opaque with malloc/free like calls | |||
void av_random_generate_untempered_numbers(AVRandomState *state); ///< Regenerate the untempered numbers (must be done every 624 iterations, or it will loop) | |||
/** generates a random number on [0,0xffffffff]-interval */ | |||
__inline unsigned int av_random(AVRandomState *state) | |||
{ | |||
unsigned int y; | |||
// regenerate the untempered numbers if we should... | |||
if (state->index >= AV_RANDOM_N) | |||
av_random_generate_untempered_numbers(state); | |||
// grab one... | |||
y = state->mt[state->index++]; | |||
/* Now temper (Mersenne Twister coefficients) The coefficients for MT19937 are.. */ | |||
y ^= (y >> 11); | |||
y ^= (y << 7) & 0x9d2c5680; | |||
y ^= (y << 15) & 0xefc60000; | |||
y ^= (y >> 18); | |||
return y; | |||
} | |||
/** return random in range [0-1] as double */ | |||
__inline double av_random_real1(AVRandomState *state) | |||
{ | |||
/* divided by 2^32-1 */ | |||
return av_random(state) * (1.0 / 4294967296.0); | |||
} | |||
// only available if DEBUG is defined in the .c file | |||
void av_benchmark_random(void); | |||
#endif /* FFMPEG_RANDOM_H */ |
@@ -0,0 +1,129 @@ | |||
/* | |||
* rational numbers | |||
* Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
/** | |||
* @file libavutil/rational.h | |||
* rational numbers | |||
* @author Michael Niedermayer <michaelni@gmx.at> | |||
*/ | |||
#ifndef AVUTIL_RATIONAL_H | |||
#define AVUTIL_RATIONAL_H | |||
#include <stdint.h> | |||
#include "common.h" | |||
/** | |||
* rational number numerator/denominator | |||
*/ | |||
typedef struct AVRational{ | |||
int num; ///< numerator | |||
int den; ///< denominator | |||
} AVRational; | |||
/** | |||
* Compares two rationals. | |||
* @param a first rational | |||
* @param b second rational | |||
* @return 0 if a==b, 1 if a>b and -1 if a<b | |||
*/ | |||
__inline int av_cmp_q(AVRational a, AVRational b){ | |||
const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den; | |||
if(tmp) return (tmp>>63)|1; | |||
else return 0; | |||
} | |||
/** | |||
* Converts rational to double. | |||
* @param a rational to convert | |||
* @return (double) a | |||
*/ | |||
__inline double av_q2d(AVRational a){ | |||
return a.num / (double) a.den; | |||
} | |||
/** | |||
* Reduces a fraction. | |||
* This is useful for framerate calculations. | |||
* @param dst_num destination numerator | |||
* @param dst_den destination denominator | |||
* @param num source numerator | |||
* @param den source denominator | |||
* @param max the maximum allowed for dst_num & dst_den | |||
* @return 1 if exact, 0 otherwise | |||
*/ | |||
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); | |||
/** | |||
* Multiplies two rationals. | |||
* @param b first rational | |||
* @param c second rational | |||
* @return b*c | |||
*/ | |||
AVRational av_mul_q(AVRational b, AVRational c) av_const; | |||
/** | |||
* Divides one rational by another. | |||
* @param b first rational | |||
* @param c second rational | |||
* @return b/c | |||
*/ | |||
AVRational av_div_q(AVRational b, AVRational c) av_const; | |||
/** | |||
* Adds two rationals. | |||
* @param b first rational | |||
* @param c second rational | |||
* @return b+c | |||
*/ | |||
AVRational av_add_q(AVRational b, AVRational c) av_const; | |||
/** | |||
* Subtracts one rational from another. | |||
* @param b first rational | |||
* @param c second rational | |||
* @return b-c | |||
*/ | |||
AVRational av_sub_q(AVRational b, AVRational c) av_const; | |||
/** | |||
* Converts a double precision floating point number to a rational. | |||
* @param d double to convert | |||
* @param max the maximum allowed numerator and denominator | |||
* @return (AVRational) d | |||
*/ | |||
AVRational av_d2q(double d, int max) av_const; | |||
/** | |||
* @return 1 if \q1 is nearer to \p q than \p q2, -1 if \p q2 is nearer | |||
* than \p q1, 0 if they have the same distance. | |||
*/ | |||
int av_nearer_q(AVRational q, AVRational q1, AVRational q2); | |||
/** | |||
* Finds the nearest value in \p q_list to \p q. | |||
* @param q_list an array of rationals terminated by {0, 0} | |||
* @return the index of the nearest value found in the array | |||
*/ | |||
int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); | |||
#endif /* AVUTIL_RATIONAL_H */ |
@@ -0,0 +1,34 @@ | |||
/* | |||
* Copyright (C) 2007 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef AVUTIL_SHA1_H | |||
#define AVUTIL_SHA1_H | |||
#include <stdint.h> | |||
extern const int av_sha1_size; | |||
struct AVSHA1; | |||
void av_sha1_init(struct AVSHA1* context); | |||
void av_sha1_update(struct AVSHA1* context, const uint8_t* data, unsigned int len); | |||
void av_sha1_final(struct AVSHA1* context, uint8_t digest[20]); | |||
#endif /* AVUTIL_SHA1_H */ |
@@ -0,0 +1,146 @@ | |||
/* | |||
* rgb2rgb.h, Software RGB to RGB convertor | |||
* pluralize by Software PAL8 to RGB convertor | |||
* Software YUV to YUV convertor | |||
* Software YUV to RGB convertor | |||
* Written by Nick Kurshev. | |||
* palette & YUV & runtime CPU stuff by Michael (michaelni@gmx.at) | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef FFMPEG_RGB2RGB_H | |||
#define FFMPEG_RGB2RGB_H | |||
#include <inttypes.h> | |||
/* A full collection of rgb to rgb(bgr) convertors */ | |||
extern void (*rgb24to32) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb24to16) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb24to15) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb32to24) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb32to16) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb32to15) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb15to16) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb15to24) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb15to32) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb16to15) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb16to24) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb16to32) (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb24tobgr32(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb32tobgr24(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb16tobgr24(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb15tobgr24(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void rgb8tobgr8 (const uint8_t *src, uint8_t *dst, long src_size); | |||
extern void palette8torgb32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); | |||
extern void palette8tobgr32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); | |||
extern void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); | |||
extern void palette8tobgr24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); | |||
extern void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); | |||
extern void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); | |||
extern void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); | |||
extern void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); | |||
/** | |||
* | |||
* height should be a multiple of 2 and width should be a multiple of 16 (if this is a | |||
* problem for anyone then tell me, and ill fix it) | |||
* chrominance data is only taken from every secound line others are ignored FIXME write HQ version | |||
*/ | |||
//void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | |||
/** | |||
* | |||
* height should be a multiple of 2 and width should be a multiple of 16 (if this is a | |||
* problem for anyone then tell me, and ill fix it) | |||
*/ | |||
extern void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, | |||
long width, long height, | |||
long lumStride, long chromStride, long dstStride); | |||
/** | |||
* | |||
* width should be a multiple of 16 | |||
*/ | |||
extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, | |||
long width, long height, | |||
long lumStride, long chromStride, long dstStride); | |||
/** | |||
* | |||
* height should be a multiple of 2 and width should be a multiple of 16 (if this is a | |||
* problem for anyone then tell me, and ill fix it) | |||
*/ | |||
extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | |||
long width, long height, | |||
long lumStride, long chromStride, long srcStride); | |||
/** | |||
* | |||
* height should be a multiple of 2 and width should be a multiple of 16 (if this is a | |||
* problem for anyone then tell me, and ill fix it) | |||
*/ | |||
extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, | |||
long width, long height, | |||
long lumStride, long chromStride, long dstStride); | |||
/** | |||
* | |||
* height should be a multiple of 2 and width should be a multiple of 2 (if this is a | |||
* problem for anyone then tell me, and ill fix it) | |||
* chrominance data is only taken from every secound line others are ignored FIXME write HQ version | |||
*/ | |||
extern void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | |||
long width, long height, | |||
long lumStride, long chromStride, long srcStride); | |||
extern void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height, | |||
long srcStride, long dstStride); | |||
extern void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst, | |||
long width, long height, long src1Stride, | |||
long src2Stride, long dstStride); | |||
extern void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, | |||
uint8_t *dst1, uint8_t *dst2, | |||
long width, long height, | |||
long srcStride1, long srcStride2, | |||
long dstStride1, long dstStride2); | |||
extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, | |||
uint8_t *dst, | |||
long width, long height, | |||
long srcStride1, long srcStride2, | |||
long srcStride3, long dstStride); | |||
void sws_rgb2rgb_init(int flags); | |||
#endif /* FFMPEG_RGB2RGB_H */ |
@@ -0,0 +1,247 @@ | |||
/* | |||
* Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at> | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 2.1 of the License, or (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef SWSCALE_SWSCALE_H | |||
#define SWSCALE_SWSCALE_H | |||
/** | |||
* @file libswscale/swscale.h | |||
* @brief | |||
* external api for the swscale stuff | |||
*/ | |||
#include "libavutil/avutil.h" | |||
#define LIBSWSCALE_VERSION_MAJOR 0 | |||
#define LIBSWSCALE_VERSION_MINOR 7 | |||
#define LIBSWSCALE_VERSION_MICRO 1 | |||
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ | |||
LIBSWSCALE_VERSION_MINOR, \ | |||
LIBSWSCALE_VERSION_MICRO) | |||
#define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \ | |||
LIBSWSCALE_VERSION_MINOR, \ | |||
LIBSWSCALE_VERSION_MICRO) | |||
#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT | |||
#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) | |||
/** | |||
* Returns the LIBSWSCALE_VERSION_INT constant. | |||
*/ | |||
unsigned swscale_version(void); | |||
/* values for the flags, the stuff on the command line is different */ | |||
#define SWS_FAST_BILINEAR 1 | |||
#define SWS_BILINEAR 2 | |||
#define SWS_BICUBIC 4 | |||
#define SWS_X 8 | |||
#define SWS_POINT 0x10 | |||
#define SWS_AREA 0x20 | |||
#define SWS_BICUBLIN 0x40 | |||
#define SWS_GAUSS 0x80 | |||
#define SWS_SINC 0x100 | |||
#define SWS_LANCZOS 0x200 | |||
#define SWS_SPLINE 0x400 | |||
#define SWS_SRC_V_CHR_DROP_MASK 0x30000 | |||
#define SWS_SRC_V_CHR_DROP_SHIFT 16 | |||
#define SWS_PARAM_DEFAULT 123456 | |||
#define SWS_PRINT_INFO 0x1000 | |||
//the following 3 flags are not completely implemented | |||
//internal chrominace subsampling info | |||
#define SWS_FULL_CHR_H_INT 0x2000 | |||
//input subsampling info | |||
#define SWS_FULL_CHR_H_INP 0x4000 | |||
#define SWS_DIRECT_BGR 0x8000 | |||
#define SWS_ACCURATE_RND 0x40000 | |||
#define SWS_BITEXACT 0x80000 | |||
#define SWS_CPU_CAPS_MMX 0x80000000 | |||
#define SWS_CPU_CAPS_MMX2 0x20000000 | |||
#define SWS_CPU_CAPS_3DNOW 0x40000000 | |||
#define SWS_CPU_CAPS_ALTIVEC 0x10000000 | |||
#define SWS_CPU_CAPS_BFIN 0x01000000 | |||
#define SWS_MAX_REDUCE_CUTOFF 0.002 | |||
#define SWS_CS_ITU709 1 | |||
#define SWS_CS_FCC 4 | |||
#define SWS_CS_ITU601 5 | |||
#define SWS_CS_ITU624 5 | |||
#define SWS_CS_SMPTE170M 5 | |||
#define SWS_CS_SMPTE240M 7 | |||
#define SWS_CS_DEFAULT 5 | |||
// when used for filters they must have an odd number of elements | |||
// coeffs cannot be shared between vectors | |||
typedef struct { | |||
double *coeff; ///< pointer to the list of coefficients | |||
int length; ///< number of coefficients in the vector | |||
} SwsVector; | |||
// vectors can be shared | |||
typedef struct { | |||
SwsVector *lumH; | |||
SwsVector *lumV; | |||
SwsVector *chrH; | |||
SwsVector *chrV; | |||
} SwsFilter; | |||
struct SwsContext; | |||
void sws_freeContext(struct SwsContext *swsContext); | |||
/** | |||
* Allocates and returns a SwsContext. You need it to perform | |||
* scaling/conversion operations using sws_scale(). | |||
* | |||
* @param srcW the width of the source image | |||
* @param srcH the height of the source image | |||
* @param srcFormat the source image format | |||
* @param dstW the width of the destination image | |||
* @param dstH the height of the destination image | |||
* @param dstFormat the destination image format | |||
* @param flags specify which algorithm and options to use for rescaling | |||
* @return a pointer to an allocated context, or NULL in case of error | |||
*/ | |||
struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int dstW, int dstH, enum PixelFormat dstFormat, int flags, | |||
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param); | |||
/** | |||
* Scales the image slice in \p srcSlice and puts the resulting scaled | |||
* slice in the image in \p dst. A slice is a sequence of consecutive | |||
* rows in an image. | |||
* | |||
* @param context the scaling context previously created with | |||
* sws_getContext() | |||
* @param srcSlice the array containing the pointers to the planes of | |||
* the source slice | |||
* @param srcStride the array containing the strides for each plane of | |||
* the source image | |||
* @param srcSliceY the position in the source image of the slice to | |||
* process, that is the number (counted starting from | |||
* zero) in the image of the first row of the slice | |||
* @param srcSliceH the height of the source slice, that is the number | |||
* of rows in the slice | |||
* @param dst the array containing the pointers to the planes of | |||
* the destination image | |||
* @param dstStride the array containing the strides for each plane of | |||
* the destination image | |||
* @return the height of the output slice | |||
*/ | |||
int sws_scale(struct SwsContext *context, uint8_t* srcSlice[], int srcStride[], int srcSliceY, | |||
int srcSliceH, uint8_t* dst[], int dstStride[]); | |||
#if LIBSWSCALE_VERSION_MAJOR < 1 | |||
/** | |||
* @deprecated Use sws_scale() instead. | |||
*/ | |||
int sws_scale_ordered(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY, | |||
int srcSliceH, uint8_t* dst[], int dstStride[]) attribute_deprecated; | |||
#endif | |||
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation); | |||
int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation); | |||
/** | |||
* Returns a normalized Gaussian curve used to filter stuff | |||
* quality=3 is high quality, lower is lower quality. | |||
*/ | |||
SwsVector *sws_getGaussianVec(double variance, double quality); | |||
/** | |||
* Allocates and returns a vector with \p length coefficients, all | |||
* with the same value \p c. | |||
*/ | |||
SwsVector *sws_getConstVec(double c, int length); | |||
/** | |||
* Allocates and returns a vector with just one coefficient, with | |||
* value 1.0. | |||
*/ | |||
SwsVector *sws_getIdentityVec(void); | |||
/** | |||
* Scales all the coefficients of \p a by the \p scalar value. | |||
*/ | |||
void sws_scaleVec(SwsVector *a, double scalar); | |||
/** | |||
* Scales all the coefficients of \p a so that their sum equals \p | |||
* height." | |||
*/ | |||
void sws_normalizeVec(SwsVector *a, double height); | |||
void sws_convVec(SwsVector *a, SwsVector *b); | |||
void sws_addVec(SwsVector *a, SwsVector *b); | |||
void sws_subVec(SwsVector *a, SwsVector *b); | |||
void sws_shiftVec(SwsVector *a, int shift); | |||
/** | |||
* Allocates and returns a clone of the vector \p a, that is a vector | |||
* with the same coefficients as \p a. | |||
*/ | |||
SwsVector *sws_cloneVec(SwsVector *a); | |||
#if LIBSWSCALE_VERSION_MAJOR < 1 | |||
/** | |||
* @deprecated Use sws_printVec2() instead. | |||
*/ | |||
attribute_deprecated void sws_printVec(SwsVector *a); | |||
#endif | |||
/** | |||
* Prints with av_log() a textual representation of the vector \p a | |||
* if \p log_level <= av_log_level. | |||
*/ | |||
void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); | |||
void sws_freeVec(SwsVector *a); | |||
SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, | |||
float lumaSharpen, float chromaSharpen, | |||
float chromaHShift, float chromaVShift, | |||
int verbose); | |||
void sws_freeFilter(SwsFilter *filter); | |||
/** | |||
* Checks if \p context can be reused, otherwise reallocates a new | |||
* one. | |||
* | |||
* If \p context is NULL, just calls sws_getContext() to get a new | |||
* context. Otherwise, checks if the parameters are the ones already | |||
* saved in \p context. If that is the case, returns the current | |||
* context. Otherwise, frees \p context and gets a new context with | |||
* the new parameters. | |||
* | |||
* Be warned that \p srcFilter and \p dstFilter are not checked, they | |||
* are assumed to remain the same. | |||
*/ | |||
struct SwsContext *sws_getCachedContext(struct SwsContext *context, | |||
int srcW, int srcH, enum PixelFormat srcFormat, | |||
int dstW, int dstH, enum PixelFormat dstFormat, int flags, | |||
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param); | |||
#endif /* SWSCALE_SWSCALE_H */ |
@@ -0,0 +1,84 @@ | |||
/* | |||
* Copyright (C) 2001-2003 Michael Niedermayer (michaelni@gmx.at) | |||
* | |||
* This file is part of FFmpeg. | |||
* | |||
* FFmpeg is free software; you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* FFmpeg is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with FFmpeg; if not, write to the Free Software | |||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | |||
#ifndef NEWPOSTPROCESS_H | |||
#define NEWPOSTPROCESS_H | |||
/** | |||
* @file postprocess.h | |||
* @brief | |||
* external api for the pp stuff | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" { | |||
#endif | |||
#define LIBPOSTPROC_VERSION_INT ((51<<16)+(1<<8)+0) | |||
#define LIBPOSTPROC_VERSION 51.1.0 | |||
#define LIBPOSTPROC_BUILD LIBPOSTPROC_VERSION_INT | |||
#define LIBPOSTPROC_IDENT "postproc" AV_STRINGIFY(LIBPOSTPROC_VERSION) | |||
#define PP_QUALITY_MAX 6 | |||
#define QP_STORE_T int8_t | |||
typedef void pp_context_t; | |||
typedef void pp_mode_t; | |||
extern char *pp_help; ///< a simple help text | |||
void pp_postprocess(uint8_t * src[3], int srcStride[3], | |||
uint8_t * dst[3], int dstStride[3], | |||
int horizontalSize, int verticalSize, | |||
QP_STORE_T *QP_store, int QP_stride, | |||
pp_mode_t *mode, pp_context_t *ppContext, int pict_type); | |||
/** | |||
* returns a pp_mode_t or NULL if an error occured | |||
* name is the string after "-pp" on the command line | |||
* quality is a number from 0 to PP_QUALITY_MAX | |||
*/ | |||
pp_mode_t *pp_get_mode_by_name_and_quality(char *name, int quality); | |||
void pp_free_mode(pp_mode_t *mode); | |||
pp_context_t *pp_get_context(int width, int height, int flags); | |||
void pp_free_context(pp_context_t *ppContext); | |||
#define PP_CPU_CAPS_MMX 0x80000000 | |||
#define PP_CPU_CAPS_MMX2 0x20000000 | |||
#define PP_CPU_CAPS_3DNOW 0x40000000 | |||
#define PP_CPU_CAPS_ALTIVEC 0x10000000 | |||
#define PP_FORMAT 0x00000008 | |||
#define PP_FORMAT_420 (0x00000011|PP_FORMAT) | |||
#define PP_FORMAT_422 (0x00000001|PP_FORMAT) | |||
#define PP_FORMAT_411 (0x00000002|PP_FORMAT) | |||
#define PP_FORMAT_444 (0x00000000|PP_FORMAT) | |||
#define PP_PICT_TYPE_QP2 0x00000010 ///< MPEG2 style QScale | |||
#ifdef __cplusplus | |||
} | |||
#endif | |||
#endif |
@@ -0,0 +1,264 @@ | |||
// ISO C9x compliant stdint.h for Microsoft Visual Studio | |||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 | |||
// | |||
// Copyright (c) 2006 Alexander Chemeris | |||
// | |||
// Redistribution and use in source and binary forms, with or without | |||
// modification, are permitted provided that the following conditions are met: | |||
// | |||
// 1. Redistributions of source code must retain the above copyright notice, | |||
// this list of conditions and the following disclaimer. | |||
// | |||
// 2. Redistributions in binary form must reproduce the above copyright | |||
// notice, this list of conditions and the following disclaimer in the | |||
// documentation and/or other materials provided with the distribution. | |||
// | |||
// 3. The name of the author may be used to endorse or promote products | |||
// derived from this software without specific prior written permission. | |||
// | |||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | |||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
// | |||
/////////////////////////////////////////////////////////////////////////////// | |||
#ifndef _MSC_VER // [ | |||
#error "Use this header only with Microsoft Visual C++ compilers!" | |||
#endif // _MSC_VER ] | |||
#ifndef _MSC_STDINT_H_ // [ | |||
#define _MSC_STDINT_H_ | |||
#if _MSC_VER > 1000 | |||
#pragma once | |||
#endif | |||
#include <limits.h> | |||
// For Visual Studio 6 in C++ mode wrap <wchar.h> include with 'extern "C++" {}' | |||
// or compiler give many errors like this: | |||
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed | |||
#if (_MSC_VER < 1300) && defined(__cplusplus) | |||
extern "C++" { | |||
#endif | |||
# include <wchar.h> | |||
#if (_MSC_VER < 1300) && defined(__cplusplus) | |||
} | |||
#endif | |||
// 7.18.1 Integer types | |||
// 7.18.1.1 Exact-width integer types | |||
typedef signed __int8 int8_t; | |||
typedef signed __int16 int16_t; | |||
typedef signed __int32 int32_t; | |||
typedef signed __int64 int64_t; | |||
typedef unsigned __int8 uint8_t; | |||
typedef unsigned __int16 uint16_t; | |||
typedef unsigned __int32 uint32_t; | |||
typedef unsigned __int64 uint64_t; | |||
// 7.18.1.2 Minimum-width integer types | |||
typedef int8_t int_least8_t; | |||
typedef int16_t int_least16_t; | |||
typedef int32_t int_least32_t; | |||
typedef int64_t int_least64_t; | |||
typedef uint8_t uint_least8_t; | |||
typedef uint16_t uint_least16_t; | |||
typedef uint32_t uint_least32_t; | |||
typedef uint64_t uint_least64_t; | |||
// 7.18.1.3 Fastest minimum-width integer types | |||
typedef int8_t int_fast8_t; | |||
typedef int16_t int_fast16_t; | |||
typedef int32_t int_fast32_t; | |||
typedef int64_t int_fast64_t; | |||
typedef uint8_t uint_fast8_t; | |||
typedef uint16_t uint_fast16_t; | |||
typedef uint32_t uint_fast32_t; | |||
typedef uint64_t uint_fast64_t; | |||
// 7.18.1.4 Integer types capable of holding object pointers | |||
#ifndef _INTPTR_T_DEFINED | |||
#ifdef _WIN64 // [ | |||
typedef __int64 intptr_t; | |||
#else // _WIN64 ][ | |||
typedef long intptr_t; | |||
#endif // _WIN64 ] | |||
#define _INTPTR_T_DEFINED | |||
#endif | |||
#ifndef _UINTPTR_T_DEFINED | |||
#ifdef _WIN64 // [ | |||
typedef unsigned __int64 uintptr_t; | |||
#else // _WIN64 ][ | |||
typedef unsigned long uintptr_t; | |||
#endif // _WIN64 ] | |||
#define _UINTPTR_T_DEFINED | |||
#endif | |||
// 7.18.1.5 Greatest-width integer types | |||
typedef int64_t intmax_t; | |||
typedef uint64_t uintmax_t; | |||
// 7.18.2 Limits of specified-width integer types | |||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 | |||
// 7.18.2.1 Limits of exact-width integer types | |||
#ifndef INT8_MIN | |||
#define INT8_MIN ((int8_t)_I8_MIN) | |||
#define INT8_MAX _I8_MAX | |||
#define INT16_MIN ((int16_t)_I16_MIN) | |||
#define INT16_MAX _I16_MAX | |||
#define INT32_MIN ((int32_t)_I32_MIN) | |||
#define INT32_MAX _I32_MAX | |||
#define INT64_MIN ((int64_t)_I64_MIN) | |||
#define INT64_MAX _I64_MAX | |||
#define UINT8_MAX _UI8_MAX | |||
#define UINT16_MAX _UI16_MAX | |||
#define UINT32_MAX _UI32_MAX | |||
#define UINT64_MAX _UI64_MAX | |||
#endif | |||
// 7.18.2.2 Limits of minimum-width integer types | |||
#ifndef INT_LEAST8_MIN | |||
#define INT_LEAST8_MIN INT8_MIN | |||
#define INT_LEAST8_MAX INT8_MAX | |||
#define INT_LEAST16_MIN INT16_MIN | |||
#define INT_LEAST16_MAX INT16_MAX | |||
#define INT_LEAST32_MIN INT32_MIN | |||
#define INT_LEAST32_MAX INT32_MAX | |||
#define INT_LEAST64_MIN INT64_MIN | |||
#define INT_LEAST64_MAX INT64_MAX | |||
#define UINT_LEAST8_MAX UINT8_MAX | |||
#define UINT_LEAST16_MAX UINT16_MAX | |||
#define UINT_LEAST32_MAX UINT32_MAX | |||
#define UINT_LEAST64_MAX UINT64_MAX | |||
#endif | |||
// 7.18.2.3 Limits of fastest minimum-width integer types | |||
#ifndef INT_FAST8_MIN | |||
#define INT_FAST8_MIN INT8_MIN | |||
#define INT_FAST8_MAX INT8_MAX | |||
#define INT_FAST16_MIN INT16_MIN | |||
#define INT_FAST16_MAX INT16_MAX | |||
#define INT_FAST32_MIN INT32_MIN | |||
#define INT_FAST32_MAX INT32_MAX | |||
#define INT_FAST64_MIN INT64_MIN | |||
#define INT_FAST64_MAX INT64_MAX | |||
#define UINT_FAST8_MAX UINT8_MAX | |||
#define UINT_FAST16_MAX UINT16_MAX | |||
#define UINT_FAST32_MAX UINT32_MAX | |||
#define UINT_FAST64_MAX UINT64_MAX | |||
#endif | |||
// 7.18.2.4 Limits of integer types capable of holding object pointers | |||
#ifndef INTPTR_MIN | |||
#ifdef _WIN64 // [ | |||
# define INTPTR_MIN INT64_MIN | |||
# define INTPTR_MAX INT64_MAX | |||
# define UINTPTR_MAX UINT64_MAX | |||
#else // _WIN64 ][ | |||
# define INTPTR_MIN INT32_MIN | |||
# define INTPTR_MAX INT32_MAX | |||
# define UINTPTR_MAX UINT32_MAX | |||
#endif // _WIN64 ] | |||
#endif | |||
// 7.18.2.5 Limits of greatest-width integer types | |||
#ifndef INTMAX_MIN | |||
#define INTMAX_MIN INT64_MIN | |||
#define INTMAX_MAX INT64_MAX | |||
#define UINTMAX_MAX UINT64_MAX | |||
#endif | |||
// 7.18.3 Limits of other integer types | |||
#ifndef PTRDIFF_MIN | |||
#ifdef _WIN64 // [ | |||
# define PTRDIFF_MIN _I64_MIN | |||
# define PTRDIFF_MAX _I64_MAX | |||
#else // _WIN64 ][ | |||
# define PTRDIFF_MIN _I32_MIN | |||
# define PTRDIFF_MAX _I32_MAX | |||
#endif // _WIN64 ] | |||
#endif | |||
#ifndef SIG_ATOMIC_MIN | |||
#define SIG_ATOMIC_MIN INT_MIN | |||
#define SIG_ATOMIC_MAX INT_MAX | |||
#endif | |||
#ifndef SIZE_MAX // [ | |||
# ifdef _WIN64 // [ | |||
# define SIZE_MAX _UI64_MAX | |||
# else // _WIN64 ][ | |||
# define SIZE_MAX _UI32_MAX | |||
# endif // _WIN64 ] | |||
#endif // SIZE_MAX ] | |||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h> | |||
#ifndef WCHAR_MIN // [ | |||
# define WCHAR_MIN 0 | |||
#endif // WCHAR_MIN ] | |||
#ifndef WCHAR_MAX // [ | |||
# define WCHAR_MAX _UI16_MAX | |||
#endif // WCHAR_MAX ] | |||
#ifndef WINT_MIN | |||
#define WINT_MIN 0 | |||
#define WINT_MAX _UI16_MAX | |||
#endif | |||
#endif // __STDC_LIMIT_MACROS ] | |||
// 7.18.4 Limits of other integer types | |||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 | |||
// 7.18.4.1 Macros for minimum-width integer constants | |||
#ifndef INT8_C | |||
#define INT8_C(val) val##i8 | |||
#endif | |||
#ifndef INT16_C | |||
#define INT16_C(val) val##i16 | |||
#endif | |||
#ifndef INT32_C | |||
#define INT32_C(val) val##i32 | |||
#endif | |||
#ifndef INT64_C | |||
#define INT64_C(val) val##i64 | |||
#endif | |||
#ifndef UINT8_C | |||
#define UINT8_C(val) val##ui8 | |||
#endif | |||
#ifndef UINT16_C | |||
#define UINT16_C(val) val##ui16 | |||
#endif | |||
#ifndef UINT32_C | |||
#define UINT32_C(val) val##ui32 | |||
#endif | |||
#ifndef UINT64_C | |||
#define UINT64_C(val) val##ui64 | |||
#endif | |||
// 7.18.4.2 Macros for greatest-width integer constants | |||
#ifndef INTMAX_C | |||
#define INTMAX_C INT64_C | |||
#define UINTMAX_C UINT64_C | |||
#endif | |||
#endif // __STDC_CONSTANT_MACROS ] | |||
#endif // _MSC_STDINT_H_ ] |