mirror of https://github.com/opencv/opencv.git
parent
b6e9ed4ec5
commit
f1e8b43c7a
62 changed files with 4386 additions and 1478 deletions
@ -1,3 +1,3 @@ |
||||
rem gcc -Wall -shared -o opencv_ffmpeg.dll -O3 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat -lavcodec -lavdevice -lswscale -lavutil -lwsock32 -lpthreadGŃE2 |
||||
gcc -Wall -shared -o opencv_ffmpeg.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat -lavcodec -lavdevice -lswscale -lavutil -lwsock32 |
||||
set path=c:\apps\mingw64\bin;%path% & gcc -Wall -shared -o opencv_ffmpeg_64.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat64 -lavcodec64 -lavdevice64 -lswscale64 -lavutil64 -lavcore64 -lwsock32 |
||||
rem set path=c:\dev\msys32\bin;%path% & gcc -Wall -shared -o opencv_ffmpeg.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat -lavcodec -lavdevice -lswscale -lavutil -lwsock32 |
||||
set path=c:\dev\msys64\bin;%path% & gcc -m64 -Wall -shared -o opencv_ffmpeg_64.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat64 -lavcodec64 -lavdevice64 -lswscale64 -lavutil64 -lavcore64 -lwsock32 -lws2_32 |
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,211 +1,34 @@ |
||||
/*
|
||||
* AVOptions |
||||
* copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> |
||||
* This file is part of Libav. |
||||
* |
||||
* This file is part of FFmpeg. |
||||
* |
||||
* FFmpeg is free software; you can redistribute it and/or |
||||
* Libav 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, |
||||
* Libav 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 |
||||
* License along with Libav; 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 |
||||
* 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; |
||||
|
||||
/**
|
||||
* AVOption2. |
||||
* THIS IS NOT PART OF THE API/ABI YET! |
||||
* This is identical to AVOption except that default_val was replaced by |
||||
* an union, it should be compatible with AVOption on normal platforms. |
||||
* This header is provided for compatibility only and will be removed |
||||
* on next major bump |
||||
*/ |
||||
typedef struct AVOption2 { |
||||
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 |
||||
*/ |
||||
union { |
||||
double dbl; |
||||
const char *str; |
||||
} 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; |
||||
} AVOption2; |
||||
|
||||
#ifndef AVCODEC_OPT_H |
||||
#define AVCODEC_OPT_H |
||||
|
||||
/**
|
||||
* Looks for an option in obj. Looks only for the options which |
||||
* have the flags set as specified in mask and 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); |
||||
#include "libavcodec/version.h" |
||||
|
||||
#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 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); |
||||
#if FF_API_OPT_H |
||||
#include "libavutil/opt.h" |
||||
#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, or an AVERROR code in case of |
||||
* error: |
||||
* AVERROR(ENOENT) if no matching option exists |
||||
* AVERROR(ERANGE) if the value is out of range |
||||
* AVERROR(EINVAL) if the value 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,72 @@ |
||||
/*
|
||||
* |
||||
* 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_VERSION_H |
||||
#define AVCODEC_VERSION_H |
||||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 53 |
||||
#define LIBAVCODEC_VERSION_MINOR 7 |
||||
#define LIBAVCODEC_VERSION_MICRO 0 |
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
||||
LIBAVCODEC_VERSION_MINOR, \
|
||||
LIBAVCODEC_VERSION_MICRO) |
||||
#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ |
||||
LIBAVCODEC_VERSION_MINOR, \
|
||||
LIBAVCODEC_VERSION_MICRO) |
||||
#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT |
||||
|
||||
#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) |
||||
|
||||
/**
|
||||
* Those FF_API_* defines are not part of public API. |
||||
* They may change, break or disappear at any time. |
||||
*/ |
||||
#ifndef FF_API_PALETTE_CONTROL |
||||
#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_OLD_SAMPLE_FMT |
||||
#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_OLD_AUDIOCONVERT |
||||
#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_ANTIALIAS_ALGO |
||||
#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_REQUEST_CHANNELS |
||||
#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_OPT_H |
||||
#define FF_API_OPT_H (LIBAVCODEC_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_THREAD_INIT |
||||
#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_OLD_FF_PICT_TYPES |
||||
#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_FLAC_GLOBAL_OPTS |
||||
#define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_GET_PIX_FMT_NAME |
||||
#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54) |
||||
#endif |
||||
|
||||
#endif /* AVCODEC_VERSION_H */ |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,81 @@ |
||||
/*
|
||||
* Version macros. |
||||
* |
||||
* 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_VERSION_H |
||||
#define AVFORMAT_VERSION_H |
||||
|
||||
#include "libavutil/avutil.h" |
||||
|
||||
#define LIBAVFORMAT_VERSION_MAJOR 53 |
||||
#define LIBAVFORMAT_VERSION_MINOR 4 |
||||
#define LIBAVFORMAT_VERSION_MICRO 0 |
||||
|
||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
LIBAVFORMAT_VERSION_MICRO) |
||||
#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ |
||||
LIBAVFORMAT_VERSION_MINOR, \
|
||||
LIBAVFORMAT_VERSION_MICRO) |
||||
#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT |
||||
|
||||
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) |
||||
|
||||
/**
|
||||
* Those FF_API_* defines are not part of public API. |
||||
* They may change, break or disappear at any time. |
||||
*/ |
||||
#ifndef FF_API_OLD_METADATA2 |
||||
#define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_READ_SEEK |
||||
#define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_OLD_AVIO |
||||
#define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_DUMP_FORMAT |
||||
#define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_PARSE_DATE |
||||
#define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_FIND_INFO_TAG |
||||
#define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_PKT_DUMP |
||||
#define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_GUESS_IMG2_CODEC |
||||
#define FF_API_GUESS_IMG2_CODEC (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_SDP_CREATE |
||||
#define FF_API_SDP_CREATE (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_ALLOC_OUTPUT_CONTEXT |
||||
#define FF_API_ALLOC_OUTPUT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_FORMAT_PARAMETERS |
||||
#define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
#ifndef FF_API_FLAG_RTP_HINT |
||||
#define FF_API_FLAG_RTP_HINT (LIBAVFORMAT_VERSION_MAJOR < 54) |
||||
#endif |
||||
|
||||
#endif /* AVFORMAT_VERSION_H */ |
@ -0,0 +1,47 @@ |
||||
/*
|
||||
* 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_AES_H |
||||
#define AVUTIL_AES_H |
||||
|
||||
#include <stdint.h> |
||||
|
||||
extern const int av_aes_size; |
||||
|
||||
struct AVAES; |
||||
|
||||
/**
|
||||
* Initialize an AVAES context. |
||||
* @param key_bits 128, 192 or 256 |
||||
* @param decrypt 0 for encryption, 1 for decryption |
||||
*/ |
||||
int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); |
||||
|
||||
/**
|
||||
* Encrypt or decrypt a buffer using a previously initialized context. |
||||
* @param count number of 16 byte blocks |
||||
* @param dst destination array, can be equal to src |
||||
* @param src source array, can be equal to dst |
||||
* @param iv initialization vector for CBC mode, if NULL then ECB will be used |
||||
* @param decrypt 0 for encryption, 1 for decryption |
||||
*/ |
||||
void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); |
||||
|
||||
#endif /* AVUTIL_AES_H */ |
@ -0,0 +1,95 @@ |
||||
/*
|
||||
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> |
||||
* Copyright (c) 2008 Peter Ross |
||||
* |
||||
* 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_AUDIOCONVERT_H |
||||
#define AVUTIL_AUDIOCONVERT_H |
||||
|
||||
#include <stdint.h> |
||||
|
||||
/**
|
||||
* @file |
||||
* audio conversion routines |
||||
*/ |
||||
|
||||
/* Audio channel masks */ |
||||
#define AV_CH_FRONT_LEFT 0x00000001 |
||||
#define AV_CH_FRONT_RIGHT 0x00000002 |
||||
#define AV_CH_FRONT_CENTER 0x00000004 |
||||
#define AV_CH_LOW_FREQUENCY 0x00000008 |
||||
#define AV_CH_BACK_LEFT 0x00000010 |
||||
#define AV_CH_BACK_RIGHT 0x00000020 |
||||
#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 |
||||
#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 |
||||
#define AV_CH_BACK_CENTER 0x00000100 |
||||
#define AV_CH_SIDE_LEFT 0x00000200 |
||||
#define AV_CH_SIDE_RIGHT 0x00000400 |
||||
#define AV_CH_TOP_CENTER 0x00000800 |
||||
#define AV_CH_TOP_FRONT_LEFT 0x00001000 |
||||
#define AV_CH_TOP_FRONT_CENTER 0x00002000 |
||||
#define AV_CH_TOP_FRONT_RIGHT 0x00004000 |
||||
#define AV_CH_TOP_BACK_LEFT 0x00008000 |
||||
#define AV_CH_TOP_BACK_CENTER 0x00010000 |
||||
#define AV_CH_TOP_BACK_RIGHT 0x00020000 |
||||
#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix.
|
||||
#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT.
|
||||
|
||||
/** Channel mask value used for AVCodecContext.request_channel_layout
|
||||
to indicate that the user requests the channel order of the decoder output |
||||
to be the native codec channel order. */ |
||||
#define AV_CH_LAYOUT_NATIVE 0x8000000000000000LL |
||||
|
||||
/* Audio channel convenience macros */ |
||||
#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) |
||||
#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) |
||||
#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) |
||||
#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) |
||||
#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) |
||||
#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) |
||||
#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) |
||||
#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) |
||||
#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) |
||||
#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) |
||||
#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) |
||||
#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) |
||||
#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) |
||||
#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) |
||||
#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) |
||||
|
||||
/**
|
||||
* Return a channel layout id that matches name, 0 if no match. |
||||
*/ |
||||
int64_t av_get_channel_layout(const char *name); |
||||
|
||||
/**
|
||||
* Return a description of a channel layout. |
||||
* If nb_channels is <= 0, it is guessed from the channel_layout. |
||||
* |
||||
* @param buf put here the string containing the channel layout |
||||
* @param buf_size size in bytes of the buffer |
||||
*/ |
||||
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout); |
||||
|
||||
/**
|
||||
* Return the number of channels in the channel layout. |
||||
*/ |
||||
int av_get_channel_layout_nb_channels(int64_t channel_layout); |
||||
|
||||
#endif /* AVUTIL_AUDIOCONVERT_H */ |
@ -0,0 +1,66 @@ |
||||
/*
|
||||
* copyright (c) 2010 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 |
||||
* simple assert() macros that are a bit more flexible than ISO C assert(). |
||||
* @author Michael Niedermayer <michaelni@gmx.at> |
||||
*/ |
||||
|
||||
#ifndef AVUTIL_AVASSERT_H |
||||
#define AVUTIL_AVASSERT_H |
||||
|
||||
#include <stdlib.h> |
||||
#include "avutil.h" |
||||
#include "log.h" |
||||
|
||||
/**
|
||||
* assert() equivalent, that is always enabled. |
||||
*/ |
||||
#define av_assert0(cond) do { \ |
||||
if (!(cond)) { \
|
||||
av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \
|
||||
AV_STRINGIFY(cond), __FILE__, __LINE__); \
|
||||
abort(); \
|
||||
} \
|
||||
} while (0) |
||||
|
||||
|
||||
/**
|
||||
* assert() equivalent, that does not lie in speed critical code. |
||||
* These asserts() thus can be enabled without fearing speedloss. |
||||
*/ |
||||
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 |
||||
#define av_assert1(cond) av_assert0(cond) |
||||
#else |
||||
#define av_assert1(cond) ((void)0) |
||||
#endif |
||||
|
||||
|
||||
/**
|
||||
* assert() equivalent, that does lie in speed critical code. |
||||
*/ |
||||
#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 |
||||
#define av_assert2(cond) av_assert0(cond) |
||||
#else |
||||
#define av_assert2(cond) ((void)0) |
||||
#endif |
||||
|
||||
#endif /* AVUTIL_AVASSERT_H */ |
@ -0,0 +1,124 @@ |
||||
/*
|
||||
* 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 |
||||
* byte swapping routines |
||||
*/ |
||||
|
||||
#ifndef AVUTIL_BSWAP_H |
||||
#define AVUTIL_BSWAP_H |
||||
|
||||
#include <stdint.h> |
||||
#include "libavutil/avconfig.h" |
||||
#include "attributes.h" |
||||
|
||||
#ifdef HAVE_AV_CONFIG_H |
||||
|
||||
#include "config.h" |
||||
|
||||
#if ARCH_ARM |
||||
# include "arm/bswap.h" |
||||
#elif ARCH_AVR32 |
||||
# include "avr32/bswap.h" |
||||
#elif ARCH_BFIN |
||||
# include "bfin/bswap.h" |
||||
#elif ARCH_SH4 |
||||
# include "sh4/bswap.h" |
||||
#elif ARCH_X86 |
||||
# include "x86/bswap.h" |
||||
#endif |
||||
|
||||
#endif /* HAVE_AV_CONFIG_H */ |
||||
|
||||
#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) |
||||
#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) |
||||
#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) |
||||
|
||||
#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) |
||||
|
||||
#ifndef av_bswap16 |
||||
static av_always_inline av_const uint16_t av_bswap16(uint16_t x) |
||||
{ |
||||
x= (x>>8) | (x<<8); |
||||
return x; |
||||
} |
||||
#endif |
||||
|
||||
#ifndef av_bswap32 |
||||
static av_always_inline av_const uint32_t av_bswap32(uint32_t x) |
||||
{ |
||||
x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); |
||||
x= (x>>16) | (x<<16); |
||||
return x; |
||||
} |
||||
#endif |
||||
|
||||
#ifndef av_bswap64 |
||||
static inline uint64_t av_const av_bswap64(uint64_t x) |
||||
{ |
||||
#if 0 |
||||
x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL); |
||||
x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL); |
||||
return (x>>32) | (x<<32); |
||||
#else |
||||
union { |
||||
uint64_t ll; |
||||
uint32_t l[2]; |
||||
} w, r; |
||||
w.ll = x; |
||||
r.l[0] = av_bswap32 (w.l[1]); |
||||
r.l[1] = av_bswap32 (w.l[0]); |
||||
return r.ll; |
||||
#endif |
||||
} |
||||
#endif |
||||
|
||||
// be2ne ... big-endian to native-endian
|
||||
// le2ne ... little-endian to native-endian
|
||||
|
||||
#if AV_HAVE_BIGENDIAN |
||||
#define av_be2ne16(x) (x) |
||||
#define av_be2ne32(x) (x) |
||||
#define av_be2ne64(x) (x) |
||||
#define av_le2ne16(x) av_bswap16(x) |
||||
#define av_le2ne32(x) av_bswap32(x) |
||||
#define av_le2ne64(x) av_bswap64(x) |
||||
#define AV_BE2NEC(s, x) (x) |
||||
#define AV_LE2NEC(s, x) AV_BSWAPC(s, x) |
||||
#else |
||||
#define av_be2ne16(x) av_bswap16(x) |
||||
#define av_be2ne32(x) av_bswap32(x) |
||||
#define av_be2ne64(x) av_bswap64(x) |
||||
#define av_le2ne16(x) (x) |
||||
#define av_le2ne32(x) (x) |
||||
#define av_le2ne64(x) (x) |
||||
#define AV_BE2NEC(s, x) AV_BSWAPC(s, x) |
||||
#define AV_LE2NEC(s, x) (x) |
||||
#endif |
||||
|
||||
#define AV_BE2NE16C(x) AV_BE2NEC(16, x) |
||||
#define AV_BE2NE32C(x) AV_BE2NEC(32, x) |
||||
#define AV_BE2NE64C(x) AV_BE2NEC(64, x) |
||||
#define AV_LE2NE16C(x) AV_LE2NEC(16, x) |
||||
#define AV_LE2NE32C(x) AV_LE2NEC(32, x) |
||||
#define AV_LE2NE64C(x) AV_LE2NEC(64, x) |
||||
|
||||
#endif /* AVUTIL_BSWAP_H */ |
@ -0,0 +1,61 @@ |
||||
/*
|
||||
* Copyright (c) 2000, 2001, 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 AVUTIL_CPU_H |
||||
#define AVUTIL_CPU_H |
||||
|
||||
#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ |
||||
|
||||
/* lower 16 bits - CPU features */ |
||||
#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX
|
||||
#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext
|
||||
#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW
|
||||
#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions
|
||||
#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions
|
||||
#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster
|
||||
#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt
|
||||
#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions
|
||||
#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
|
||||
#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
|
||||
#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower
|
||||
#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
|
||||
#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions
|
||||
#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
|
||||
#define AV_CPU_FLAG_IWMMXT 0x0100 ///< XScale IWMMXT
|
||||
#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard
|
||||
|
||||
/**
|
||||
* Return the flags which specify extensions supported by the CPU. |
||||
*/ |
||||
int av_get_cpu_flags(void); |
||||
|
||||
|
||||
/**
|
||||
* Disables cpu detection and forces the specified flags. |
||||
*/ |
||||
void av_force_cpu_flags(int flags); |
||||
|
||||
|
||||
/* The following CPU-specific functions shall not be called directly. */ |
||||
int ff_get_cpu_flags_arm(void); |
||||
int ff_get_cpu_flags_ppc(void); |
||||
int ff_get_cpu_flags_x86(void); |
||||
|
||||
#endif /* AVUTIL_CPU_H */ |
@ -0,0 +1,81 @@ |
||||
/*
|
||||
* |
||||
* 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 |
||||
* Public dictionary API. |
||||
*/ |
||||
|
||||
#ifndef AVUTIL_DICT_H |
||||
#define AVUTIL_DICT_H |
||||
|
||||
#define AV_DICT_MATCH_CASE 1 |
||||
#define AV_DICT_IGNORE_SUFFIX 2 |
||||
#define AV_DICT_DONT_STRDUP_KEY 4 |
||||
#define AV_DICT_DONT_STRDUP_VAL 8 |
||||
#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
|
||||
#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no |
||||
delimiter is added, the strings are simply concatenated. */ |
||||
|
||||
typedef struct { |
||||
char *key; |
||||
char *value; |
||||
} AVDictionaryEntry; |
||||
|
||||
typedef struct AVDictionary AVDictionary; |
||||
|
||||
/**
|
||||
* Get a dictionary entry with matching key. |
||||
* |
||||
* @param prev Set to the previous matching element to find the next. |
||||
* If set to NULL the first matching element is returned. |
||||
* @param flags Allows case as well as suffix-insensitive comparisons. |
||||
* @return Found entry or NULL, changing key or value leads to undefined behavior. |
||||
*/ |
||||
AVDictionaryEntry * |
||||
av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); |
||||
|
||||
/**
|
||||
* Set the given entry in *pm, overwriting an existing entry. |
||||
* |
||||
* @param pm pointer to a pointer to a dictionary struct. If *pm is NULL |
||||
* a dictionary struct is allocated and put in *pm. |
||||
* @param key entry key to add to *pm (will be av_strduped depending on flags) |
||||
* @param value entry value to add to *pm (will be av_strduped depending on flags). |
||||
* Passing a NULL value will cause an existing tag to be deleted. |
||||
* @return >= 0 on success otherwise an error code <0 |
||||
*/ |
||||
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); |
||||
|
||||
/**
|
||||
* Copy entries from one AVDictionary struct into another. |
||||
* @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, |
||||
* this function will allocate a struct for you and put it in *dst |
||||
* @param src pointer to source AVDictionary struct |
||||
* @param flags flags to use when setting entries in *dst |
||||
* @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag |
||||
*/ |
||||
void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); |
||||
|
||||
/**
|
||||
* Free all the memory allocated for an AVDictionary struct. |
||||
*/ |
||||
void av_dict_free(AVDictionary **m); |
||||
|
||||
#endif // AVUTIL_DICT_H
|
@ -0,0 +1,146 @@ |
||||
/*
|
||||
* Copyright (c) 2002 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 |
||||
* simple arithmetic expression evaluator |
||||
*/ |
||||
|
||||
#ifndef AVUTIL_EVAL_H |
||||
#define AVUTIL_EVAL_H |
||||
|
||||
#include "avutil.h" |
||||
|
||||
typedef struct AVExpr AVExpr; |
||||
|
||||
/**
|
||||
* Parse and evaluate an expression. |
||||
* Note, this is significantly slower than av_expr_eval(). |
||||
* |
||||
* @param res a pointer to a double where is put the result value of |
||||
* the expression, or NAN in case of error |
||||
* @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" |
||||
* @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} |
||||
* @param const_values a zero terminated array of values for the identifiers from const_names |
||||
* @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers |
||||
* @param funcs1 NULL terminated array of function pointers for functions which take 1 argument |
||||
* @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers |
||||
* @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments |
||||
* @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 |
||||
* @param log_ctx parent logging context |
||||
* @return 0 in case of success, a negative value corresponding to an |
||||
* AVERROR code otherwise |
||||
*/ |
||||
int av_expr_parse_and_eval(double *res, const char *s, |
||||
const char * const *const_names, const double *const_values, |
||||
const char * const *func1_names, double (* const *funcs1)(void *, double), |
||||
const char * const *func2_names, double (* const *funcs2)(void *, double, double), |
||||
void *opaque, int log_offset, void *log_ctx); |
||||
|
||||
/**
|
||||
* Parse an expression. |
||||
* |
||||
* @param expr a pointer where is put an AVExpr containing the parsed |
||||
* value in case of successfull parsing, or NULL otherwise. |
||||
* The pointed to AVExpr must be freed with av_expr_free() by the user |
||||
* when it is not needed anymore. |
||||
* @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" |
||||
* @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} |
||||
* @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers |
||||
* @param funcs1 NULL terminated array of function pointers for functions which take 1 argument |
||||
* @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers |
||||
* @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments |
||||
* @param log_ctx parent logging context |
||||
* @return 0 in case of success, a negative value corresponding to an |
||||
* AVERROR code otherwise |
||||
*/ |
||||
int av_expr_parse(AVExpr **expr, const char *s, |
||||
const char * const *const_names, |
||||
const char * const *func1_names, double (* const *funcs1)(void *, double), |
||||
const char * const *func2_names, double (* const *funcs2)(void *, double, double), |
||||
int log_offset, void *log_ctx); |
||||
|
||||
/**
|
||||
* Evaluate a previously parsed expression. |
||||
* |
||||
* @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names |
||||
* @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 |
||||
* @return the value of the expression |
||||
*/ |
||||
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); |
||||
|
||||
/**
|
||||
* Free a parsed expression previously created with av_expr_parse(). |
||||
*/ |
||||
void av_expr_free(AVExpr *e); |
||||
|
||||
#if FF_API_OLD_EVAL_NAMES |
||||
/**
|
||||
* @deprecated Deprecated in favor of av_expr_parse_and_eval(). |
||||
*/ |
||||
attribute_deprecated |
||||
int av_parse_and_eval_expr(double *res, const char *s, |
||||
const char * const *const_names, const double *const_values, |
||||
const char * const *func1_names, double (* const *funcs1)(void *, double), |
||||
const char * const *func2_names, double (* const *funcs2)(void *, double, double), |
||||
void *opaque, int log_offset, void *log_ctx); |
||||
|
||||
/**
|
||||
* @deprecated Deprecated in favor of av_expr_parse(). |
||||
*/ |
||||
attribute_deprecated |
||||
int av_parse_expr(AVExpr **expr, const char *s, |
||||
const char * const *const_names, |
||||
const char * const *func1_names, double (* const *funcs1)(void *, double), |
||||
const char * const *func2_names, double (* const *funcs2)(void *, double, double), |
||||
int log_offset, void *log_ctx); |
||||
/**
|
||||
* @deprecated Deprecated in favor of av_expr_eval(). |
||||
*/ |
||||
attribute_deprecated |
||||
double av_eval_expr(AVExpr *e, const double *const_values, void *opaque); |
||||
|
||||
/**
|
||||
* @deprecated Deprecated in favor of av_expr_free(). |
||||
*/ |
||||
attribute_deprecated |
||||
void av_free_expr(AVExpr *e); |
||||
#endif /* FF_API_OLD_EVAL_NAMES */ |
||||
|
||||
/**
|
||||
* Parse the string in numstr and return its value as a double. If |
||||
* the string is empty, contains only whitespaces, or does not contain |
||||
* an initial substring that has the expected syntax for a |
||||
* floating-point number, no conversion is performed. In this case, |
||||
* returns a value of zero and the value returned in tail is the value |
||||
* of numstr. |
||||
* |
||||
* @param numstr a string representing a number, may contain one of |
||||
* the International System number postfixes, for example 'K', 'M', |
||||
* 'G'. If 'i' is appended after the postfix, powers of 2 are used |
||||
* instead of powers of 10. The 'B' postfix multiplies the value for |
||||
* 8, and can be appended after another postfix or used alone. This |
||||
* allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. |
||||
* @param tail if non-NULL puts here the pointer to the char next |
||||
* after the last parsed character |
||||
*/ |
||||
double av_strtod(const char *numstr, char **tail); |
||||
|
||||
#endif /* AVUTIL_EVAL_H */ |
@ -0,0 +1,52 @@ |
||||
/*
|
||||
* 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_FILE_H |
||||
#define AVUTIL_FILE_H |
||||
|
||||
#include "avutil.h" |
||||
|
||||
/**
|
||||
* @file |
||||
* Misc file utilities. |
||||
*/ |
||||
|
||||
/**
|
||||
* Read the file with name filename, and put its content in a newly |
||||
* allocated buffer or map it with mmap() when available. |
||||
* In case of success set *bufptr to the read or mmapped buffer, and |
||||
* *size to the size in bytes of the buffer in *bufptr. |
||||
* The returned buffer must be released with av_file_unmap(). |
||||
* |
||||
* @param log_offset loglevel offset used for logging |
||||
* @param log_ctx context used for logging |
||||
* @return a non negative number in case of success, a negative value |
||||
* corresponding to an AVERROR error code in case of failure |
||||
*/ |
||||
int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, |
||||
int log_offset, void *log_ctx); |
||||
|
||||
/**
|
||||
* Unmap or free the buffer bufptr created by av_file_map(). |
||||
* |
||||
* @param size size in bytes of bufptr, must be the same as returned |
||||
* by av_file_map() |
||||
*/ |
||||
void av_file_unmap(uint8_t *bufptr, size_t size); |
||||
|
||||
#endif /* AVUTIL_FILE_H */ |
@ -0,0 +1,130 @@ |
||||
/*
|
||||
* 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_IMGUTILS_H |
||||
#define AVUTIL_IMGUTILS_H |
||||
|
||||
/**
|
||||
* @file |
||||
* misc image utilities |
||||
*/ |
||||
|
||||
#include "avutil.h" |
||||
#include "pixdesc.h" |
||||
|
||||
/**
|
||||
* Compute the max pixel step for each plane of an image with a |
||||
* format described by pixdesc. |
||||
* |
||||
* The pixel step is the distance in bytes between the first byte of |
||||
* the group of bytes which describe a pixel component and the first |
||||
* byte of the successive group in the same plane for the same |
||||
* component. |
||||
* |
||||
* @param max_pixsteps an array which is filled with the max pixel step |
||||
* for each plane. Since a plane may contain different pixel |
||||
* components, the computed max_pixsteps[plane] is relative to the |
||||
* component in the plane with the max pixel step. |
||||
* @param max_pixstep_comps an array which is filled with the component |
||||
* for each plane which has the max pixel step. May be NULL. |
||||
*/ |
||||
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], |
||||
const AVPixFmtDescriptor *pixdesc); |
||||
|
||||
/**
|
||||
* Compute the size of an image line with format pix_fmt and width |
||||
* width for the plane plane. |
||||
* |
||||
* @return the computed size in bytes |
||||
*/ |
||||
int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane); |
||||
|
||||
/**
|
||||
* Fill plane linesizes for an image with pixel format pix_fmt and |
||||
* width width. |
||||
* |
||||
* @param linesizes array to be filled with the linesize for each plane |
||||
* @return >= 0 in case of success, a negative error code otherwise |
||||
*/ |
||||
int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width); |
||||
|
||||
/**
|
||||
* Fill plane data pointers for an image with pixel format pix_fmt and |
||||
* height height. |
||||
* |
||||
* @param data pointers array to be filled with the pointer for each image plane |
||||
* @param ptr the pointer to a buffer which will contain the image |
||||
* @param linesizes the array containing the linesize for each |
||||
* plane, should be filled by av_image_fill_linesizes() |
||||
* @return the size in bytes required for the image buffer, a negative |
||||
* error code in case of failure |
||||
*/ |
||||
int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, |
||||
uint8_t *ptr, const int linesizes[4]); |
||||
|
||||
/**
|
||||
* Allocate an image with size w and h and pixel format pix_fmt, and |
||||
* fill pointers and linesizes accordingly. |
||||
* The allocated image buffer has to be freed by using |
||||
* av_freep(&pointers[0]). |
||||
* |
||||
* @param align the value to use for buffer size alignment |
||||
* @return the size in bytes required for the image buffer, a negative |
||||
* error code in case of failure |
||||
*/ |
||||
int av_image_alloc(uint8_t *pointers[4], int linesizes[4], |
||||
int w, int h, enum PixelFormat pix_fmt, int align); |
||||
|
||||
/**
|
||||
* Copy image plane from src to dst. |
||||
* That is, copy "height" number of lines of "bytewidth" bytes each. |
||||
* The first byte of each successive line is separated by *_linesize |
||||
* bytes. |
||||
* |
||||
* @param dst_linesize linesize for the image plane in dst |
||||
* @param src_linesize linesize for the image plane in src |
||||
*/ |
||||
void av_image_copy_plane(uint8_t *dst, int dst_linesize, |
||||
const uint8_t *src, int src_linesize, |
||||
int bytewidth, int height); |
||||
|
||||
/**
|
||||
* Copy image in src_data to dst_data. |
||||
* |
||||
* @param dst_linesize linesizes for the image in dst_data |
||||
* @param src_linesize linesizes for the image in src_data |
||||
*/ |
||||
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], |
||||
const uint8_t *src_data[4], const int src_linesizes[4], |
||||
enum PixelFormat pix_fmt, int width, int height); |
||||
|
||||
/**
|
||||
* Check if the given dimension of an image is valid, meaning that all |
||||
* bytes of the image can be addressed with a signed int. |
||||
* |
||||
* @param w the width of the picture |
||||
* @param h the height of the picture |
||||
* @param log_offset the offset to sum to the log level for logging with log_ctx |
||||
* @param log_ctx the parent logging context, it may be NULL |
||||
* @return >= 0 if valid, a negative error code otherwise |
||||
*/ |
||||
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); |
||||
|
||||
int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt); |
||||
|
||||
#endif /* AVUTIL_IMGUTILS_H */ |
@ -0,0 +1,522 @@ |
||||
/*
|
||||
* 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_INTREADWRITE_H |
||||
#define AVUTIL_INTREADWRITE_H |
||||
|
||||
#include <stdint.h> |
||||
#include "libavutil/avconfig.h" |
||||
#include "attributes.h" |
||||
#include "bswap.h" |
||||
|
||||
typedef union { |
||||
uint64_t u64; |
||||
uint32_t u32[2]; |
||||
uint16_t u16[4]; |
||||
uint8_t u8 [8]; |
||||
double f64; |
||||
float f32[2]; |
||||
} av_alias av_alias64; |
||||
|
||||
typedef union { |
||||
uint32_t u32; |
||||
uint16_t u16[2]; |
||||
uint8_t u8 [4]; |
||||
float f32; |
||||
} av_alias av_alias32; |
||||
|
||||
typedef union { |
||||
uint16_t u16; |
||||
uint8_t u8 [2]; |
||||
} av_alias av_alias16; |
||||
|
||||
/*
|
||||
* Arch-specific headers can provide any combination of |
||||
* AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. |
||||
* Preprocessor symbols must be defined, even if these are implemented |
||||
* as inline functions. |
||||
*/ |
||||
|
||||
#ifdef HAVE_AV_CONFIG_H |
||||
|
||||
#include "config.h" |
||||
|
||||
#if ARCH_ARM |
||||
# include "arm/intreadwrite.h" |
||||
#elif ARCH_AVR32 |
||||
# include "avr32/intreadwrite.h" |
||||
#elif ARCH_MIPS |
||||
# include "mips/intreadwrite.h" |
||||
#elif ARCH_PPC |
||||
# include "ppc/intreadwrite.h" |
||||
#elif ARCH_TOMI |
||||
# include "tomi/intreadwrite.h" |
||||
#elif ARCH_X86 |
||||
# include "x86/intreadwrite.h" |
||||
#endif |
||||
|
||||
#endif /* HAVE_AV_CONFIG_H */ |
||||
|
||||
/*
|
||||
* Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. |
||||
*/ |
||||
|
||||
#if AV_HAVE_BIGENDIAN |
||||
|
||||
# if defined(AV_RN16) && !defined(AV_RB16) |
||||
# define AV_RB16(p) AV_RN16(p) |
||||
# elif !defined(AV_RN16) && defined(AV_RB16) |
||||
# define AV_RN16(p) AV_RB16(p) |
||||
# endif |
||||
|
||||
# if defined(AV_WN16) && !defined(AV_WB16) |
||||
# define AV_WB16(p, v) AV_WN16(p, v) |
||||
# elif !defined(AV_WN16) && defined(AV_WB16) |
||||
# define AV_WN16(p, v) AV_WB16(p, v) |
||||
# endif |
||||
|
||||
# if defined(AV_RN24) && !defined(AV_RB24) |
||||
# define AV_RB24(p) AV_RN24(p) |
||||
# elif !defined(AV_RN24) && defined(AV_RB24) |
||||
# define AV_RN24(p) AV_RB24(p) |
||||
# endif |
||||
|
||||
# if defined(AV_WN24) && !defined(AV_WB24) |
||||
# define AV_WB24(p, v) AV_WN24(p, v) |
||||
# elif !defined(AV_WN24) && defined(AV_WB24) |
||||
# define AV_WN24(p, v) AV_WB24(p, v) |
||||
# endif |
||||
|
||||
# if defined(AV_RN32) && !defined(AV_RB32) |
||||
# define AV_RB32(p) AV_RN32(p) |
||||
# elif !defined(AV_RN32) && defined(AV_RB32) |
||||
# define AV_RN32(p) AV_RB32(p) |
||||
# endif |
||||
|
||||
# if defined(AV_WN32) && !defined(AV_WB32) |
||||
# define AV_WB32(p, v) AV_WN32(p, v) |
||||
# elif !defined(AV_WN32) && defined(AV_WB32) |
||||
# define AV_WN32(p, v) AV_WB32(p, v) |
||||
# endif |
||||
|
||||
# if defined(AV_RN64) && !defined(AV_RB64) |
||||
# define AV_RB64(p) AV_RN64(p) |
||||
# elif !defined(AV_RN64) && defined(AV_RB64) |
||||
# define AV_RN64(p) AV_RB64(p) |
||||
# endif |
||||
|
||||
# if defined(AV_WN64) && !defined(AV_WB64) |
||||
# define AV_WB64(p, v) AV_WN64(p, v) |
||||
# elif !defined(AV_WN64) && defined(AV_WB64) |
||||
# define AV_WN64(p, v) AV_WB64(p, v) |
||||
# endif |
||||
|
||||
#else /* AV_HAVE_BIGENDIAN */ |
||||
|
||||
# if defined(AV_RN16) && !defined(AV_RL16) |
||||
# define AV_RL16(p) AV_RN16(p) |
||||
# elif !defined(AV_RN16) && defined(AV_RL16) |
||||
# define AV_RN16(p) AV_RL16(p) |
||||
# endif |
||||
|
||||
# if defined(AV_WN16) && !defined(AV_WL16) |
||||
# define AV_WL16(p, v) AV_WN16(p, v) |
||||
# elif !defined(AV_WN16) && defined(AV_WL16) |
||||
# define AV_WN16(p, v) AV_WL16(p, v) |
||||
# endif |
||||
|
||||
# if defined(AV_RN24) && !defined(AV_RL24) |
||||
# define AV_RL24(p) AV_RN24(p) |
||||
# elif !defined(AV_RN24) && defined(AV_RL24) |
||||
# define AV_RN24(p) AV_RL24(p) |
||||
# endif |
||||
|
||||
# if defined(AV_WN24) && !defined(AV_WL24) |
||||
# define AV_WL24(p, v) AV_WN24(p, v) |
||||
# elif !defined(AV_WN24) && defined(AV_WL24) |
||||
# define AV_WN24(p, v) AV_WL24(p, v) |
||||
# endif |
||||
|
||||
# if defined(AV_RN32) && !defined(AV_RL32) |
||||
# define AV_RL32(p) AV_RN32(p) |
||||
# elif !defined(AV_RN32) && defined(AV_RL32) |
||||
# define AV_RN32(p) AV_RL32(p) |
||||
# endif |
||||
|
||||
# if defined(AV_WN32) && !defined(AV_WL32) |
||||
# define AV_WL32(p, v) AV_WN32(p, v) |
||||
# elif !defined(AV_WN32) && defined(AV_WL32) |
||||
# define AV_WN32(p, v) AV_WL32(p, v) |
||||
# endif |
||||
|
||||
# if defined(AV_RN64) && !defined(AV_RL64) |
||||
# define AV_RL64(p) AV_RN64(p) |
||||
# elif !defined(AV_RN64) && defined(AV_RL64) |
||||
# define AV_RN64(p) AV_RL64(p) |
||||
# endif |
||||
|
||||
# if defined(AV_WN64) && !defined(AV_WL64) |
||||
# define AV_WL64(p, v) AV_WN64(p, v) |
||||
# elif !defined(AV_WN64) && defined(AV_WL64) |
||||
# define AV_WN64(p, v) AV_WL64(p, v) |
||||
# endif |
||||
|
||||
#endif /* !AV_HAVE_BIGENDIAN */ |
||||
|
||||
/*
|
||||
* Define AV_[RW]N helper macros to simplify definitions not provided |
||||
* by per-arch headers. |
||||
*/ |
||||
|
||||
#if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__) |
||||
|
||||
union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; |
||||
union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; |
||||
union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; |
||||
|
||||
# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) |
||||
# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) |
||||
|
||||
#elif defined(__DECC) |
||||
|
||||
# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) |
||||
# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) |
||||
|
||||
#elif AV_HAVE_FAST_UNALIGNED |
||||
|
||||
# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) |
||||
# define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) |
||||
|
||||
#else |
||||
|
||||
#ifndef AV_RB16 |
||||
# define AV_RB16(x) \ |
||||
((((const uint8_t*)(x))[0] << 8) | \
|
||||
((const uint8_t*)(x))[1]) |
||||
#endif |
||||
#ifndef AV_WB16 |
||||
# define AV_WB16(p, d) do { \ |
||||
((uint8_t*)(p))[1] = (d); \
|
||||
((uint8_t*)(p))[0] = (d)>>8; \
|
||||
} while(0) |
||||
#endif |
||||
|
||||
#ifndef AV_RL16 |
||||
# define AV_RL16(x) \ |
||||
((((const uint8_t*)(x))[1] << 8) | \
|
||||
((const uint8_t*)(x))[0]) |
||||
#endif |
||||
#ifndef AV_WL16 |
||||
# define AV_WL16(p, d) do { \ |
||||
((uint8_t*)(p))[0] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
} while(0) |
||||
#endif |
||||
|
||||
#ifndef AV_RB32 |
||||
# define AV_RB32(x) \ |
||||
(((uint32_t)((const uint8_t*)(x))[0] << 24) | \
|
||||
(((const uint8_t*)(x))[1] << 16) | \
|
||||
(((const uint8_t*)(x))[2] << 8) | \
|
||||
((const uint8_t*)(x))[3]) |
||||
#endif |
||||
#ifndef AV_WB32 |
||||
# define AV_WB32(p, d) do { \ |
||||
((uint8_t*)(p))[3] = (d); \
|
||||
((uint8_t*)(p))[2] = (d)>>8; \
|
||||
((uint8_t*)(p))[1] = (d)>>16; \
|
||||
((uint8_t*)(p))[0] = (d)>>24; \
|
||||
} while(0) |
||||
#endif |
||||
|
||||
#ifndef AV_RL32 |
||||
# define AV_RL32(x) \ |
||||
(((uint32_t)((const uint8_t*)(x))[3] << 24) | \
|
||||
(((const uint8_t*)(x))[2] << 16) | \
|
||||
(((const uint8_t*)(x))[1] << 8) | \
|
||||
((const uint8_t*)(x))[0]) |
||||
#endif |
||||
#ifndef AV_WL32 |
||||
# define AV_WL32(p, d) do { \ |
||||
((uint8_t*)(p))[0] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
((uint8_t*)(p))[2] = (d)>>16; \
|
||||
((uint8_t*)(p))[3] = (d)>>24; \
|
||||
} while(0) |
||||
#endif |
||||
|
||||
#ifndef AV_RB64 |
||||
# define AV_RB64(x) \ |
||||
(((uint64_t)((const uint8_t*)(x))[0] << 56) | \
|
||||
((uint64_t)((const uint8_t*)(x))[1] << 48) | \
|
||||
((uint64_t)((const uint8_t*)(x))[2] << 40) | \
|
||||
((uint64_t)((const uint8_t*)(x))[3] << 32) | \
|
||||
((uint64_t)((const uint8_t*)(x))[4] << 24) | \
|
||||
((uint64_t)((const uint8_t*)(x))[5] << 16) | \
|
||||
((uint64_t)((const uint8_t*)(x))[6] << 8) | \
|
||||
(uint64_t)((const uint8_t*)(x))[7]) |
||||
#endif |
||||
#ifndef AV_WB64 |
||||
# define AV_WB64(p, d) do { \ |
||||
((uint8_t*)(p))[7] = (d); \
|
||||
((uint8_t*)(p))[6] = (d)>>8; \
|
||||
((uint8_t*)(p))[5] = (d)>>16; \
|
||||
((uint8_t*)(p))[4] = (d)>>24; \
|
||||
((uint8_t*)(p))[3] = (d)>>32; \
|
||||
((uint8_t*)(p))[2] = (d)>>40; \
|
||||
((uint8_t*)(p))[1] = (d)>>48; \
|
||||
((uint8_t*)(p))[0] = (d)>>56; \
|
||||
} while(0) |
||||
#endif |
||||
|
||||
#ifndef AV_RL64 |
||||
# define AV_RL64(x) \ |
||||
(((uint64_t)((const uint8_t*)(x))[7] << 56) | \
|
||||
((uint64_t)((const uint8_t*)(x))[6] << 48) | \
|
||||
((uint64_t)((const uint8_t*)(x))[5] << 40) | \
|
||||
((uint64_t)((const uint8_t*)(x))[4] << 32) | \
|
||||
((uint64_t)((const uint8_t*)(x))[3] << 24) | \
|
||||
((uint64_t)((const uint8_t*)(x))[2] << 16) | \
|
||||
((uint64_t)((const uint8_t*)(x))[1] << 8) | \
|
||||
(uint64_t)((const uint8_t*)(x))[0]) |
||||
#endif |
||||
#ifndef AV_WL64 |
||||
# define AV_WL64(p, d) do { \ |
||||
((uint8_t*)(p))[0] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
((uint8_t*)(p))[2] = (d)>>16; \
|
||||
((uint8_t*)(p))[3] = (d)>>24; \
|
||||
((uint8_t*)(p))[4] = (d)>>32; \
|
||||
((uint8_t*)(p))[5] = (d)>>40; \
|
||||
((uint8_t*)(p))[6] = (d)>>48; \
|
||||
((uint8_t*)(p))[7] = (d)>>56; \
|
||||
} while(0) |
||||
#endif |
||||
|
||||
#if AV_HAVE_BIGENDIAN |
||||
# define AV_RN(s, p) AV_RB##s(p) |
||||
# define AV_WN(s, p, v) AV_WB##s(p, v) |
||||
#else |
||||
# define AV_RN(s, p) AV_RL##s(p) |
||||
# define AV_WN(s, p, v) AV_WL##s(p, v) |
||||
#endif |
||||
|
||||
#endif /* HAVE_FAST_UNALIGNED */ |
||||
|
||||
#ifndef AV_RN16 |
||||
# define AV_RN16(p) AV_RN(16, p) |
||||
#endif |
||||
|
||||
#ifndef AV_RN32 |
||||
# define AV_RN32(p) AV_RN(32, p) |
||||
#endif |
||||
|
||||
#ifndef AV_RN64 |
||||
# define AV_RN64(p) AV_RN(64, p) |
||||
#endif |
||||
|
||||
#ifndef AV_WN16 |
||||
# define AV_WN16(p, v) AV_WN(16, p, v) |
||||
#endif |
||||
|
||||
#ifndef AV_WN32 |
||||
# define AV_WN32(p, v) AV_WN(32, p, v) |
||||
#endif |
||||
|
||||
#ifndef AV_WN64 |
||||
# define AV_WN64(p, v) AV_WN(64, p, v) |
||||
#endif |
||||
|
||||
#if AV_HAVE_BIGENDIAN |
||||
# define AV_RB(s, p) AV_RN##s(p) |
||||
# define AV_WB(s, p, v) AV_WN##s(p, v) |
||||
# define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) |
||||
# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) |
||||
#else |
||||
# define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) |
||||
# define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) |
||||
# define AV_RL(s, p) AV_RN##s(p) |
||||
# define AV_WL(s, p, v) AV_WN##s(p, v) |
||||
#endif |
||||
|
||||
#define AV_RB8(x) (((const uint8_t*)(x))[0]) |
||||
#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) |
||||
|
||||
#define AV_RL8(x) AV_RB8(x) |
||||
#define AV_WL8(p, d) AV_WB8(p, d) |
||||
|
||||
#ifndef AV_RB16 |
||||
# define AV_RB16(p) AV_RB(16, p) |
||||
#endif |
||||
#ifndef AV_WB16 |
||||
# define AV_WB16(p, v) AV_WB(16, p, v) |
||||
#endif |
||||
|
||||
#ifndef AV_RL16 |
||||
# define AV_RL16(p) AV_RL(16, p) |
||||
#endif |
||||
#ifndef AV_WL16 |
||||
# define AV_WL16(p, v) AV_WL(16, p, v) |
||||
#endif |
||||
|
||||
#ifndef AV_RB32 |
||||
# define AV_RB32(p) AV_RB(32, p) |
||||
#endif |
||||
#ifndef AV_WB32 |
||||
# define AV_WB32(p, v) AV_WB(32, p, v) |
||||
#endif |
||||
|
||||
#ifndef AV_RL32 |
||||
# define AV_RL32(p) AV_RL(32, p) |
||||
#endif |
||||
#ifndef AV_WL32 |
||||
# define AV_WL32(p, v) AV_WL(32, p, v) |
||||
#endif |
||||
|
||||
#ifndef AV_RB64 |
||||
# define AV_RB64(p) AV_RB(64, p) |
||||
#endif |
||||
#ifndef AV_WB64 |
||||
# define AV_WB64(p, v) AV_WB(64, p, v) |
||||
#endif |
||||
|
||||
#ifndef AV_RL64 |
||||
# define AV_RL64(p) AV_RL(64, p) |
||||
#endif |
||||
#ifndef AV_WL64 |
||||
# define AV_WL64(p, v) AV_WL(64, p, v) |
||||
#endif |
||||
|
||||
#ifndef AV_RB24 |
||||
# define AV_RB24(x) \ |
||||
((((const uint8_t*)(x))[0] << 16) | \
|
||||
(((const uint8_t*)(x))[1] << 8) | \
|
||||
((const uint8_t*)(x))[2]) |
||||
#endif |
||||
#ifndef AV_WB24 |
||||
# define AV_WB24(p, d) do { \ |
||||
((uint8_t*)(p))[2] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
((uint8_t*)(p))[0] = (d)>>16; \
|
||||
} while(0) |
||||
#endif |
||||
|
||||
#ifndef AV_RL24 |
||||
# define AV_RL24(x) \ |
||||
((((const uint8_t*)(x))[2] << 16) | \
|
||||
(((const uint8_t*)(x))[1] << 8) | \
|
||||
((const uint8_t*)(x))[0]) |
||||
#endif |
||||
#ifndef AV_WL24 |
||||
# define AV_WL24(p, d) do { \ |
||||
((uint8_t*)(p))[0] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
((uint8_t*)(p))[2] = (d)>>16; \
|
||||
} while(0) |
||||
#endif |
||||
|
||||
/*
|
||||
* The AV_[RW]NA macros access naturally aligned data |
||||
* in a type-safe way. |
||||
*/ |
||||
|
||||
#define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) |
||||
#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) |
||||
|
||||
#ifndef AV_RN16A |
||||
# define AV_RN16A(p) AV_RNA(16, p) |
||||
#endif |
||||
|
||||
#ifndef AV_RN32A |
||||
# define AV_RN32A(p) AV_RNA(32, p) |
||||
#endif |
||||
|
||||
#ifndef AV_RN64A |
||||
# define AV_RN64A(p) AV_RNA(64, p) |
||||
#endif |
||||
|
||||
#ifndef AV_WN16A |
||||
# define AV_WN16A(p, v) AV_WNA(16, p, v) |
||||
#endif |
||||
|
||||
#ifndef AV_WN32A |
||||
# define AV_WN32A(p, v) AV_WNA(32, p, v) |
||||
#endif |
||||
|
||||
#ifndef AV_WN64A |
||||
# define AV_WN64A(p, v) AV_WNA(64, p, v) |
||||
#endif |
||||
|
||||
/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be
|
||||
* naturally aligned. They may be implemented using MMX, |
||||
* so emms_c() must be called before using any float code |
||||
* afterwards. |
||||
*/ |
||||
|
||||
#define AV_COPY(n, d, s) \ |
||||
(((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) |
||||
|
||||
#ifndef AV_COPY16 |
||||
# define AV_COPY16(d, s) AV_COPY(16, d, s) |
||||
#endif |
||||
|
||||
#ifndef AV_COPY32 |
||||
# define AV_COPY32(d, s) AV_COPY(32, d, s) |
||||
#endif |
||||
|
||||
#ifndef AV_COPY64 |
||||
# define AV_COPY64(d, s) AV_COPY(64, d, s) |
||||
#endif |
||||
|
||||
#ifndef AV_COPY128 |
||||
# define AV_COPY128(d, s) \ |
||||
do { \
|
||||
AV_COPY64(d, s); \
|
||||
AV_COPY64((char*)(d)+8, (char*)(s)+8); \
|
||||
} while(0) |
||||
#endif |
||||
|
||||
#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) |
||||
|
||||
#ifndef AV_SWAP64 |
||||
# define AV_SWAP64(a, b) AV_SWAP(64, a, b) |
||||
#endif |
||||
|
||||
#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) |
||||
|
||||
#ifndef AV_ZERO16 |
||||
# define AV_ZERO16(d) AV_ZERO(16, d) |
||||
#endif |
||||
|
||||
#ifndef AV_ZERO32 |
||||
# define AV_ZERO32(d) AV_ZERO(32, d) |
||||
#endif |
||||
|
||||
#ifndef AV_ZERO64 |
||||
# define AV_ZERO64(d) AV_ZERO(64, d) |
||||
#endif |
||||
|
||||
#ifndef AV_ZERO128 |
||||
# define AV_ZERO128(d) \ |
||||
do { \
|
||||
AV_ZERO64(d); \
|
||||
AV_ZERO64((char*)(d)+8); \
|
||||
} while(0) |
||||
#endif |
||||
|
||||
#endif /* AVUTIL_INTREADWRITE_H */ |
@ -0,0 +1,62 @@ |
||||
/*
|
||||
* Lagged Fibonacci PRNG |
||||
* Copyright (c) 2008 Michael Niedermayer |
||||
* |
||||
* 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_LFG_H |
||||
#define AVUTIL_LFG_H |
||||
|
||||
typedef struct { |
||||
unsigned int state[64]; |
||||
int index; |
||||
} AVLFG; |
||||
|
||||
void av_lfg_init(AVLFG *c, unsigned int seed); |
||||
|
||||
/**
|
||||
* Get the next random unsigned 32-bit number using an ALFG. |
||||
* |
||||
* Please also consider a simple LCG like state= state*1664525+1013904223, |
||||
* it may be good enough and faster for your specific use case. |
||||
*/ |
||||
static inline unsigned int av_lfg_get(AVLFG *c){ |
||||
c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; |
||||
return c->state[c->index++ & 63]; |
||||
} |
||||
|
||||
/**
|
||||
* Get the next random unsigned 32-bit number using a MLFG. |
||||
* |
||||
* Please also consider av_lfg_get() above, it is faster. |
||||
*/ |
||||
static inline unsigned int av_mlfg_get(AVLFG *c){ |
||||
unsigned int a= c->state[(c->index-55) & 63]; |
||||
unsigned int b= c->state[(c->index-24) & 63]; |
||||
return c->state[c->index++ & 63] = 2*a*b+a+b; |
||||
} |
||||
|
||||
/**
|
||||
* Get the next two numbers generated by a Box-Muller Gaussian |
||||
* generator using the random numbers issued by lfg. |
||||
* |
||||
* @param out array where the two generated numbers are placed |
||||
*/ |
||||
void av_bmg_get(AVLFG *lfg, double out[2]); |
||||
|
||||
#endif /* AVUTIL_LFG_H */ |
@ -0,0 +1,243 @@ |
||||
/*
|
||||
* 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 AVUTIL_OPT_H |
||||
#define AVUTIL_OPT_H |
||||
|
||||
/**
|
||||
* @file |
||||
* AVOptions |
||||
*/ |
||||
|
||||
#include "rational.h" |
||||
#include "avutil.h" |
||||
#include "dict.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 |
||||
*/ |
||||
union { |
||||
double dbl; |
||||
const char *str; |
||||
/* TODO those are unused now */ |
||||
int64_t i64; |
||||
AVRational q; |
||||
} 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; |
||||
|
||||
#if FF_API_FIND_OPT |
||||
/**
|
||||
* Look for an option in obj. Look only for the options which |
||||
* have the flags set as specified in mask and 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 |
||||
* |
||||
* @deprecated use av_opt_find. |
||||
*/ |
||||
attribute_deprecated |
||||
const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); |
||||
#endif |
||||
|
||||
/**
|
||||
* Set 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, or an AVERROR code in case of |
||||
* error: |
||||
* AVERROR(ENOENT) if no matching option exists |
||||
* AVERROR(ERANGE) if the value is out of range |
||||
* AVERROR(EINVAL) if the value 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); |
||||
|
||||
/**
|
||||
* Show the obj options. |
||||
* |
||||
* @param req_flags requested flags for the options to show. Show only the |
||||
* options for which it is opt->flags & req_flags. |
||||
* @param rej_flags rejected flags for the options to show. Show only the |
||||
* options for which it is !(opt->flags & req_flags). |
||||
* @param av_log_obj log context to use for showing the options |
||||
*/ |
||||
int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); |
||||
|
||||
void av_opt_set_defaults(void *s); |
||||
void av_opt_set_defaults2(void *s, int mask, int flags); |
||||
|
||||
/**
|
||||
* Parse the key/value pairs list in opts. For each key/value pair |
||||
* found, stores the value in the field in ctx that is named like the |
||||
* key. ctx must be an AVClass context, storing is done using |
||||
* AVOptions. |
||||
* |
||||
* @param opts options string to parse, may be NULL |
||||
* @param key_val_sep a 0-terminated list of characters used to |
||||
* separate key from value |
||||
* @param pairs_sep a 0-terminated list of characters used to separate |
||||
* two pairs from each other |
||||
* @return the number of successfully set key/value pairs, or a negative |
||||
* value corresponding to an AVERROR code in case of error: |
||||
* AVERROR(EINVAL) if opts cannot be parsed, |
||||
* the error code issued by av_set_string3() if a key/value pair |
||||
* cannot be set |
||||
*/ |
||||
int av_set_options_string(void *ctx, const char *opts, |
||||
const char *key_val_sep, const char *pairs_sep); |
||||
|
||||
/**
|
||||
* Free all string and binary options in obj. |
||||
*/ |
||||
void av_opt_free(void *obj); |
||||
|
||||
/**
|
||||
* Check whether a particular flag is set in a flags field. |
||||
* |
||||
* @param field_name the name of the flag field option |
||||
* @param flag_name the name of the flag to check |
||||
* @return non-zero if the flag is set, zero if the flag isn't set, |
||||
* isn't of the right type, or the flags field doesn't exist. |
||||
*/ |
||||
int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); |
||||
|
||||
/*
|
||||
* Set all the options from a given dictionary on an object. |
||||
* |
||||
* @param obj a struct whose first element is a pointer to AVClass |
||||
* @param options options to process. This dictionary will be freed and replaced |
||||
* by a new one containing all options not found in obj. |
||||
* Of course this new dictionary needs to be freed by caller |
||||
* with av_dict_free(). |
||||
* |
||||
* @return 0 on success, a negative AVERROR if some option was found in obj, |
||||
* but could not be set. |
||||
* |
||||
* @see av_dict_copy() |
||||
*/ |
||||
int av_opt_set_dict(void *obj, struct AVDictionary **options); |
||||
|
||||
#define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the |
||||
given object first. */ |
||||
|
||||
/**
|
||||
* Look for an option in an object. Consider only options which |
||||
* have all the specified flags set. |
||||
* |
||||
* @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 When searching for named constants, name of the unit |
||||
* it belongs to. |
||||
* @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). |
||||
* @param search_flags A combination of AV_OPT_SEARCH_*. |
||||
* |
||||
* @return A pointer to the option found, or NULL if no option |
||||
* was found. |
||||
* |
||||
* @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable |
||||
* directly with av_set_string3(). Use special calls which take an options |
||||
* AVDictionary (e.g. avformat_open_input()) to set options found with this |
||||
* flag. |
||||
*/ |
||||
const AVOption *av_opt_find(void *obj, const char *name, const char *unit, |
||||
int opt_flags, int search_flags); |
||||
|
||||
#endif /* AVUTIL_OPT_H */ |
@ -0,0 +1,117 @@ |
||||
/*
|
||||
* 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_PARSEUTILS_H |
||||
#define AVUTIL_PARSEUTILS_H |
||||
|
||||
#include "rational.h" |
||||
|
||||
/**
|
||||
* @file |
||||
* misc parsing utilities |
||||
*/ |
||||
|
||||
/**
|
||||
* Parse str and put in width_ptr and height_ptr the detected values. |
||||
* |
||||
* @param[in,out] width_ptr pointer to the variable which will contain the detected |
||||
* width value |
||||
* @param[in,out] height_ptr pointer to the variable which will contain the detected |
||||
* height value |
||||
* @param[in] str the string to parse: it has to be a string in the format |
||||
* width x height or a valid video size abbreviation. |
||||
* @return >= 0 on success, a negative error code otherwise |
||||
*/ |
||||
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); |
||||
|
||||
/**
|
||||
* Parse str and store the detected values in *rate. |
||||
* |
||||
* @param[in,out] rate pointer to the AVRational which will contain the detected |
||||
* frame rate |
||||
* @param[in] str the string to parse: it has to be a string in the format |
||||
* rate_num / rate_den, a float number or a valid video rate abbreviation |
||||
* @return >= 0 on success, a negative error code otherwise |
||||
*/ |
||||
int av_parse_video_rate(AVRational *rate, const char *str); |
||||
|
||||
/**
|
||||
* Put the RGBA values that correspond to color_string in rgba_color. |
||||
* |
||||
* @param color_string a string specifying a color. It can be the name of |
||||
* a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, |
||||
* possibly followed by "@" and a string representing the alpha |
||||
* component. |
||||
* The alpha component may be a string composed by "0x" followed by an |
||||
* hexadecimal number or a decimal number between 0.0 and 1.0, which |
||||
* represents the opacity value (0x00/0.0 means completely transparent, |
||||
* 0xff/1.0 completely opaque). |
||||
* If the alpha component is not specified then 0xff is assumed. |
||||
* The string "random" will result in a random color. |
||||
* @param slen length of the initial part of color_string containing the |
||||
* color. It can be set to -1 if color_string is a null terminated string |
||||
* containing nothing else than the color. |
||||
* @return >= 0 in case of success, a negative value in case of |
||||
* failure (for example if color_string cannot be parsed). |
||||
*/ |
||||
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, |
||||
void *log_ctx); |
||||
|
||||
/**
|
||||
* Parses timestr and returns in *time a corresponding number of |
||||
* microseconds. |
||||
* |
||||
* @param timeval puts here the number of microseconds corresponding |
||||
* to the string in timestr. If the string represents a duration, it |
||||
* is the number of microseconds contained in the time interval. If |
||||
* the string is a date, is the number of microseconds since 1st of |
||||
* January, 1970 up to the time of the parsed date. If timestr cannot |
||||
* be successfully parsed, set *time to INT64_MIN. |
||||
|
||||
* @param datestr a string representing a date or a duration. |
||||
* - If a date the syntax is: |
||||
* @code |
||||
* [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z] |
||||
* now |
||||
* @endcode |
||||
* If the value is "now" it takes the current time. |
||||
* Time is local time unless Z is appended, in which case it is |
||||
* interpreted as UTC. |
||||
* If the year-month-day part is not specified it takes the current |
||||
* year-month-day. |
||||
* - If a duration the syntax is: |
||||
* @code |
||||
* [-]HH[:MM[:SS[.m...]]] |
||||
* [-]S+[.m...] |
||||
* @endcode |
||||
* @param duration flag which tells how to interpret timestr, if not |
||||
* zero timestr is interpreted as a duration, otherwise as a date |
||||
* @return 0 in case of success, a negative value corresponding to an |
||||
* AVERROR code otherwise |
||||
*/ |
||||
int av_parse_time(int64_t *timeval, const char *timestr, int duration); |
||||
|
||||
/**
|
||||
* Attempt to find a specific tag in a URL. |
||||
* |
||||
* syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. |
||||
* Return 1 if found. |
||||
*/ |
||||
int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); |
||||
|
||||
#endif /* AVUTIL_PARSEUTILS_H */ |
@ -0,0 +1,31 @@ |
||||
/*
|
||||
* Copyright (c) 2009 Baptiste Coudurier <baptiste.coudurier@gmail.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_RANDOM_SEED_H |
||||
#define AVUTIL_RANDOM_SEED_H |
||||
|
||||
#include <stdint.h> |
||||
|
||||
/**
|
||||
* Get a seed to use in conjunction with random functions. |
||||
*/ |
||||
uint32_t av_get_random_seed(void); |
||||
|
||||
#endif /* AVUTIL_RANDOM_SEED_H */ |
@ -0,0 +1,125 @@ |
||||
/*
|
||||
* 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_SAMPLEFMT_H |
||||
#define AVUTIL_SAMPLEFMT_H |
||||
|
||||
#include "avutil.h" |
||||
|
||||
/**
|
||||
* all in native-endian format |
||||
*/ |
||||
enum AVSampleFormat { |
||||
AV_SAMPLE_FMT_NONE = -1, |
||||
AV_SAMPLE_FMT_U8, ///< unsigned 8 bits
|
||||
AV_SAMPLE_FMT_S16, ///< signed 16 bits
|
||||
AV_SAMPLE_FMT_S32, ///< signed 32 bits
|
||||
AV_SAMPLE_FMT_FLT, ///< float
|
||||
AV_SAMPLE_FMT_DBL, ///< double
|
||||
AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
|
||||
}; |
||||
|
||||
/**
|
||||
* Return the name of sample_fmt, or NULL if sample_fmt is not |
||||
* recognized. |
||||
*/ |
||||
const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); |
||||
|
||||
/**
|
||||
* Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE |
||||
* on error. |
||||
*/ |
||||
enum AVSampleFormat av_get_sample_fmt(const char *name); |
||||
|
||||
/**
|
||||
* Generate a string corresponding to the sample format with |
||||
* sample_fmt, or a header if sample_fmt is negative. |
||||
* |
||||
* @param buf the buffer where to write the string |
||||
* @param buf_size the size of buf |
||||
* @param sample_fmt the number of the sample format to print the |
||||
* corresponding info string, or a negative value to print the |
||||
* corresponding header. |
||||
* @return the pointer to the filled buffer or NULL if sample_fmt is |
||||
* unknown or in case of other errors |
||||
*/ |
||||
char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); |
||||
|
||||
#if FF_API_GET_BITS_PER_SAMPLE_FMT |
||||
/**
|
||||
* @deprecated Use av_get_bytes_per_sample() instead. |
||||
*/ |
||||
attribute_deprecated |
||||
int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); |
||||
#endif |
||||
|
||||
/**
|
||||
* Return number of bytes per sample. |
||||
* |
||||
* @param sample_fmt the sample format |
||||
* @return number of bytes per sample or zero if unknown for the given |
||||
* sample format |
||||
*/ |
||||
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); |
||||
|
||||
/**
|
||||
* Fill channel data pointers and linesizes for samples with sample |
||||
* format sample_fmt. |
||||
* |
||||
* The pointers array is filled with the pointers to the samples data: |
||||
* for planar, set the start point of each plane's data within the buffer, |
||||
* for packed, set the start point of the entire buffer only. |
||||
* |
||||
* The linesize array is filled with the aligned size of each samples |
||||
* plane, that is linesize[i] will contain the linesize of the plane i, |
||||
* and will be zero for all the unused planes. All linesize values are |
||||
* equal. |
||||
* |
||||
* @param pointers array to be filled with the pointer for each plane, may be NULL |
||||
* @param linesizes array to be filled with the linesize, may be NULL |
||||
* @param buf the pointer to a buffer containing the samples |
||||
* @param nb_samples the number of samples in a single channel |
||||
* @param planar 1 if the samples layout is planar, 0 if it is packed |
||||
* @param nb_channels the number of channels |
||||
* @return the total size of the buffer, a negative |
||||
* error code in case of failure |
||||
*/ |
||||
int av_samples_fill_arrays(uint8_t *pointers[8], int linesizes[8], |
||||
uint8_t *buf, int nb_channels, int nb_samples, |
||||
enum AVSampleFormat sample_fmt, int planar, int align); |
||||
|
||||
/**
|
||||
* Allocate a samples buffer for nb_samples samples, and |
||||
* fill pointers and linesizes accordingly. |
||||
* The allocated samples buffer has to be freed by using |
||||
* av_freep(&pointers[0]). |
||||
* |
||||
* @param nb_channels number of audio channels |
||||
* @param nb_samples number of samples per channel |
||||
* @param planar 1 if the samples layout is planar, 0 if packed, |
||||
* @param align the value to use for buffer size alignment |
||||
* @return the size in bytes required for the samples buffer, a negative |
||||
* error code in case of failure |
||||
* @see av_samples_fill_arrays() |
||||
*/ |
||||
int av_samples_alloc(uint8_t *pointers[8], int linesizes[8], |
||||
int nb_channels, int nb_samples, |
||||
enum AVSampleFormat sample_fmt, int planar, |
||||
int align); |
||||
|
||||
#endif /* AVCORE_SAMPLEFMT_H */ |
@ -0,0 +1,56 @@ |
||||
/*
|
||||
* 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_SHA_H |
||||
#define AVUTIL_SHA_H |
||||
|
||||
#include <stdint.h> |
||||
|
||||
extern const int av_sha_size; |
||||
|
||||
struct AVSHA; |
||||
|
||||
/**
|
||||
* Initialize SHA-1 or SHA-2 hashing. |
||||
* |
||||
* @param context pointer to the function context (of size av_sha_size) |
||||
* @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) |
||||
* @return zero if initialization succeeded, -1 otherwise |
||||
*/ |
||||
int av_sha_init(struct AVSHA* context, int bits); |
||||
|
||||
/**
|
||||
* Update hash value. |
||||
* |
||||
* @param context hash function context |
||||
* @param data input data to update hash with |
||||
* @param len input data length |
||||
*/ |
||||
void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); |
||||
|
||||
/**
|
||||
* Finish hashing and output digest value. |
||||
* |
||||
* @param context hash function context |
||||
* @param digest buffer where output digest value is stored |
||||
*/ |
||||
void av_sha_final(struct AVSHA* context, uint8_t *digest); |
||||
|
||||
#endif /* AVUTIL_SHA_H */ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue