Commit 26c6b955 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

updated ffmpeg to 0.6.0

parent d8ad4e22
/*
* Misc image conversion routines
* most functionality is exported to the public API, see avcodec.h
*
* Copyright (c) 2008 Vitor Sessak
*
* 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_IMGCONVERT_H
#define AVCODEC_IMGCONVERT_H
//#include <stdint.h>
#include "avcodec.h"
int ff_fill_linesize(AVPicture *picture, int pix_fmt, int width);
int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, int pix_fmt, int height);
int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane);
int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt);
int img_convert(AVPicture *dst, int dst_pix_fmt, const AVPicture *src,
int src_pix_fmt, int src_width, int src_height);
#endif /* AVCODEC_IMGCONVERT_H */
/*
* arbitrary precision integers
* Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file libavutil/integer.h
* arbitrary precision integers
* @author Michael Niedermayer <michaelni@gmx.at>
*/
#ifndef AVUTIL_INTEGER_H
#define AVUTIL_INTEGER_H
#include <stdint.h>
#include "common.h"
#define AV_INTEGER_SIZE 8
typedef struct AVInteger{
uint16_t v[AV_INTEGER_SIZE];
} AVInteger;
AVInteger av_add_i(AVInteger a, AVInteger b) av_const;
AVInteger av_sub_i(AVInteger a, AVInteger b) av_const;
/**
* Returns the rounded-down value of the base 2 logarithm of the given
* AVInteger. This is simply the index of the most significant bit
* which is 1, or 0 if all bits are 0.
*/
int av_log2_i(AVInteger a) av_const;
AVInteger av_mul_i(AVInteger a, AVInteger b) av_const;
/**
* Returns 0 if a==b, 1 if a>b and -1 if a<b.
*/
int av_cmp_i(AVInteger a, AVInteger b) av_const;
/**
* bitwise shift
* @param s the number of bits by which the value should be shifted right,
may be negative for shifting left
*/
AVInteger av_shr_i(AVInteger a, int s) av_const;
/**
* Returns a % b.
* @param quot a/b will be stored here.
*/
AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b);
/**
* Returns a/b.
*/
AVInteger av_div_i(AVInteger a, AVInteger b) av_const;
/**
* Converts the given int64_t to an AVInteger.
*/
AVInteger av_int2i(int64_t a) av_const;
/**
* Converts the given AVInteger to an int64_t.
* If the AVInteger is too large to fit into an int64_t,
* then only the least significant 64 bits will be used.
*/
int64_t av_i2int(AVInteger a) av_const;
#endif /* AVUTIL_INTEGER_H */
/*
* 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_AVFFT_H
#define AVCODEC_AVFFT_H
typedef float FFTSample;
typedef struct FFTComplex {
FFTSample re, im;
} FFTComplex;
typedef struct FFTContext FFTContext;
/**
* Set up a complex FFT.
* @param nbits log2 of the length of the input array
* @param inverse if 0 perform the forward transform, if 1 perform the inverse
*/
FFTContext *av_fft_init(int nbits, int inverse);
/**
* Do the permutation needed BEFORE calling ff_fft_calc().
*/
void av_fft_permute(FFTContext *s, FFTComplex *z);
/**
* Do a complex FFT with the parameters defined in av_fft_init(). The
* input data must be permuted before. No 1.0/sqrt(n) normalization is done.
*/
void av_fft_calc(FFTContext *s, FFTComplex *z);
void av_fft_end(FFTContext *s);
FFTContext *av_mdct_init(int nbits, int inverse, double scale);
void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
void av_mdct_end(FFTContext *s);
/* Real Discrete Fourier Transform */
enum RDFTransformType {
DFT_R2C,
IDFT_C2R,
IDFT_R2C,
DFT_C2R,
};
typedef struct RDFTContext RDFTContext;
/**
* Set up a real FFT.
* @param nbits log2 of the length of the input array
* @param trans the type of transform
*/
RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
void av_rdft_calc(RDFTContext *s, FFTSample *data);
void av_rdft_end(RDFTContext *s);
/* Discrete Cosine Transform */
typedef struct DCTContext DCTContext;
enum DCTTransformType {
DCT_II = 0,
DCT_III,
DCT_I,
DST_I,
};
/**
* Sets up DCT.
* @param nbits size of the input array:
* (1 << nbits) for DCT-II, DCT-III and DST-I
* (1 << nbits) + 1 for DCT-I
*
* @note the first element of the input of DST-I is ignored
*/
DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
void av_dct_calc(DCTContext *s, FFTSample *data);
void av_dct_end (DCTContext *s);
#endif /* AVCODEC_AVFFT_H */
/*
* DXVA2 HW acceleration
*
* copyright (c) 2009 Laurent Aimar
*
* 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_DXVA_H
#define AVCODEC_DXVA_H
#include <stdint.h>
#include <dxva2api.h>
/**
* This structure is used to provides the necessary configurations and data
* to the DXVA2 FFmpeg HWAccel implementation.
*
* The application must make it available as AVCodecContext.hwaccel_context.
*/
struct dxva_context {
/**
* DXVA2 decoder object
*/
IDirectXVideoDecoder *decoder;
/**
* DXVA2 configuration used to create the decoder
*/
const DXVA2_ConfigPictureDecode *cfg;
/**
* The number of surface in the surface array
*/
unsigned surface_count;
/**
* The array of Direct3D surfaces used to create the decoder
*/
LPDIRECT3DSURFACE9 *surface;
/**
* A bit field configuring the workarounds needed for using the decoder
*/
uint64_t workaround;
/**
* Private to the FFmpeg AVHWAccel implementation
*/
unsigned report_id;
};
#endif /* AVCODEC_DXVA_H */
......@@ -23,7 +23,7 @@
#define AVCODEC_OPT_H
/**
* @file libavcodec/opt.h
* @file
* AVOptions
*/
......@@ -85,10 +85,62 @@ typedef struct AVOption {
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.
*/
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;
/**
* Looks for an option in \p obj. Looks only for the options which
* have the flags set as specified in \p mask and \p flags (that is,
* 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
......@@ -108,7 +160,7 @@ attribute_deprecated const AVOption *av_set_string(void *obj, const char *name,
/**
* @return a pointer to the AVOption corresponding to the field set or
* NULL if no matching AVOption exists, or if the value \p val is not
* NULL if no matching AVOption exists, or if the value val is not
* valid
* @see av_set_string3()
*/
......@@ -136,8 +188,11 @@ attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name,
* @param alloc when 1 then the old value will be av_freed() and the
* new av_strduped()
* when 0 then no av_free() nor av_strdup() will be used
* @return 0 if the value has been set, an AVERROR* error code if no
* matching option exists, or if the value \p val is not valid
* @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);
......
/*
* Video Acceleration API (shared data between FFmpeg and the video player)
* HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1
*
* Copyright (C) 2008-2009 Splitted-Desktop Systems
*
* 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_VAAPI_H
#define AVCODEC_VAAPI_H
#include <stdint.h>
/**
* \defgroup VAAPI_Decoding VA API Decoding
* \ingroup Decoder
* @{
*/
/**
* This structure is used to share data between the FFmpeg library and
* the client video application.
* This shall be zero-allocated and available as
* AVCodecContext.hwaccel_context. All user members can be set once
* during initialization or through each AVCodecContext.get_buffer()
* function call. In any case, they must be valid prior to calling
* decoding functions.
*/
struct vaapi_context {
/**
* Window system dependent data
*
* - encoding: unused
* - decoding: Set by user
*/
void *display;
/**
* Configuration ID
*
* - encoding: unused
* - decoding: Set by user
*/
uint32_t config_id;
/**
* Context ID (video decode pipeline)
*
* - encoding: unused
* - decoding: Set by user
*/
uint32_t context_id;
/**
* VAPictureParameterBuffer ID
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
uint32_t pic_param_buf_id;
/**
* VAIQMatrixBuffer ID
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
uint32_t iq_matrix_buf_id;
/**
* VABitPlaneBuffer ID (for VC-1 decoding)
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
uint32_t bitplane_buf_id;
/**
* Slice parameter/data buffer IDs
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
uint32_t *slice_buf_ids;
/**
* Number of effective slice buffer IDs to send to the HW
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
unsigned int n_slice_buf_ids;
/**
* Size of pre-allocated slice_buf_ids
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
unsigned int slice_buf_ids_alloc;
/**
* Pointer to VASliceParameterBuffers
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
void *slice_params;
/**
* Size of a VASliceParameterBuffer element
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
unsigned int slice_param_size;
/**
* Size of pre-allocated slice_params
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
unsigned int slice_params_alloc;
/**
* Number of slices currently filled in
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
unsigned int slice_count;
/**
* Pointer to slice data buffer base
* - encoding: unused
* - decoding: Set by libavcodec
*/
const uint8_t *slice_data;
/**
* Current size of slice data
*
* - encoding: unused
* - decoding: Set by libavcodec
*/
uint32_t slice_data_size;
};
/* @} */
#endif /* AVCODEC_VAAPI_H */
......@@ -70,14 +70,17 @@ struct vdpau_render_state {
/** picture parameter information for all supported codecs */
union VdpPictureInfo {
VdpPictureInfoH264 h264;
VdpPictureInfoMPEG1Or2 mpeg;
VdpPictureInfoVC1 vc1;
VdpPictureInfoH264 h264;
VdpPictureInfoMPEG1Or2 mpeg;
VdpPictureInfoVC1 vc1;
VdpPictureInfoMPEG4Part2 mpeg4;
} info;
/** Describe size/location of the compressed video data. */
/** Describe size/location of the compressed video data.
Set to 0 when freeing bitstream_buffers. */
int bitstream_buffers_allocated;
int bitstream_buffers_used;
/** The user is responsible for freeing this buffer using av_freep(). */
VdpBitstreamBuffer *bitstream_buffers;
};
......
......@@ -141,9 +141,9 @@ struct xvmc_pix_fmt {
/** Number of the the next free data block; one data block consists of
64 short values in the data_blocks array.
All blocks before this one are already claimed by filling their number
into the corresponding blocks description structure field,
that are hold in mv_blocks array.
All blocks before this one have already been claimed by placing their
position into the corresponding block description structure field,
that are part of the mv_blocks array.
- application - zeroes it on get_buffer().
A successful ff_draw_horiz_band() may zero it together
with start_mb_blocks_num.
......
......@@ -19,8 +19,10 @@
#ifndef AVDEVICE_AVDEVICE_H
#define AVDEVICE_AVDEVICE_H
#include "libavutil/avutil.h"
#define LIBAVDEVICE_VERSION_MAJOR 52
#define LIBAVDEVICE_VERSION_MINOR 1
#define LIBAVDEVICE_VERSION_MINOR 2
#define LIBAVDEVICE_VERSION_MICRO 0
#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
......@@ -36,6 +38,16 @@
*/
unsigned avdevice_version(void);
/**
* Returns the libavdevice build-time configuration.
*/
const char *avdevice_configuration(void);
/**
* Returns the libavdevice license.
*/
const char *avdevice_license(void);
/**
* Initialize libavdevice and register all the input and output devices.
* @warning This function is not thread safe.
......
......@@ -21,16 +21,16 @@
#define AVFORMAT_AVIO_H
/**
* @file libavformat/avio.h
* @file
* unbuffered I/O operations
*
* @warning This file has to be considered an internal but installed
* header, so it should not be directly included in your projects.
*/
//#include <stdint.h>
#include <stdint.h>
#include "common.h"
#include "libavutil/common.h"
/* unbuffered I/O */
......@@ -41,7 +41,7 @@
* version bump.
* sizeof(URLContext) must not be used outside libav*.
*/
struct URLContext {
typedef struct URLContext {
#if LIBAVFORMAT_VERSION_MAJOR >= 53
const AVClass *av_class; ///< information for av_log(). Set by url_open().
#endif
......@@ -50,10 +50,8 @@ struct URLContext {
int is_streamed; /**< true if streamed (no seek possible), default = false */
int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */
void *priv_data;
char *filename; /**< specified filename */
};
typedef struct URLContext URLContext;
char *filename; /**< specified URL */
} URLContext;
typedef struct URLPollEntry {
URLContext *handle;
......@@ -67,16 +65,97 @@ typedef struct URLPollEntry {
typedef int URLInterruptCB(void);
/**
* Creates an URLContext for accessing to the resource indicated by
* url, and opens it using the URLProtocol up.
*
* @param puc pointer to the location where, in case of success, the
* function puts the pointer to the created URLContext
* @param flags flags which control how the resource indicated by url
* is to be opened
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int url_open_protocol (URLContext **puc, struct URLProtocol *up,
const char *filename, int flags);
int url_open(URLContext **h, const char *filename, int flags);
const char *url, int flags);
/**
* Creates an URLContext for accessing to the resource indicated by
* url, and opens it.
*
* @param puc pointer to the location where, in case of success, the
* function puts the pointer to the created URLContext
* @param flags flags which control how the resource indicated by url
* is to be opened
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int url_open(URLContext **h, const char *url, int flags);
/**
* Reads up to size bytes from the resource accessed by h, and stores
* the read bytes in buf.
*
* @return The number of bytes actually read, or a negative value
* corresponding to an AVERROR code in case of error. A value of zero
* indicates that it is not possible to read more from the accessed
* resource (except if the value of the size argument is also zero).
*/
int url_read(URLContext *h, unsigned char *buf, int size);
/**
* Read as many bytes as possible (up to size), calling the
* read function multiple times if necessary.
* Will also retry if the read function returns AVERROR(EAGAIN).
* This makes special short-read handling in applications
* unnecessary, if the return value is < size then it is
* certain there was either an error or the end of file was reached.
*/
int url_read_complete(URLContext *h, unsigned char *buf, int size);
int url_write(URLContext *h, unsigned char *buf, int size);
/**
* Changes the position that will be used by the next read/write
* operation on the resource accessed by h.
*
* @param pos specifies the new position to set
* @param whence specifies how pos should be interpreted, it must be
* one of SEEK_SET (seek from the beginning), SEEK_CUR (seek from the
* current position), SEEK_END (seek from the end), or AVSEEK_SIZE
* (return the filesize of the requested resource, pos is ignored).
* @return a negative value corresponding to an AVERROR code in case
* of failure, or the resulting file position, measured in bytes from
* the beginning of the file. You can use this feature together with
* SEEK_CUR to read the current file position.
*/
int64_t url_seek(URLContext *h, int64_t pos, int whence);
/**
* Closes the resource accessed by the URLContext h, and frees the
* memory used by it.
*
* @return a negative value if an error condition occurred, 0
* otherwise
*/
int url_close(URLContext *h);
int url_exist(const char *filename);
/**
* Returns a non-zero value if the resource indicated by url
* exists, 0 otherwise.
*/
int url_exist(const char *url);
int64_t url_filesize(URLContext *h);
/**
* Return the file descriptor associated with this URL. For RTP, this
* will return only the RTP file descriptor, not the RTCP file descriptor.
* To get both, use rtp_get_file_handles().
*
* @return the file descriptor associated with this URL, or <0 on error.
*/
int url_get_file_handle(URLContext *h);
/**
* Return the maximum packet size associated to packetized file
* handle. If the file is not packetized (stream like HTTP or file on
......@@ -133,9 +212,17 @@ int64_t av_url_read_seek(URLContext *h, int stream_index,
*/
#define AVSEEK_SIZE 0x10000
/**
* Oring this flag as into the "whence" parameter to a seek function causes it to
* seek by any means (like reopening and linear reading) or other normally unreasonble
* means that can be extreemly slow.
* This may be ignored by the seek code.
*/
#define AVSEEK_FORCE 0x20000
typedef struct URLProtocol {
const char *name;
int (*url_open)(URLContext *h, const char *filename, int flags);
int (*url_open)(URLContext *h, const char *url, int flags);
int (*url_read)(URLContext *h, unsigned char *buf, int size);
int (*url_write)(URLContext *h, unsigned char *buf, int size);
int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
......@@ -144,6 +231,7 @@ typedef struct URLProtocol {
int (*url_read_pause)(URLContext *h, int pause);
int64_t (*url_read_seek)(URLContext *h, int stream_index,
int64_t timestamp, int flags);
int (*url_get_file_handle)(URLContext *h);
} URLProtocol;
#if LIBAVFORMAT_VERSION_MAJOR < 53
......@@ -166,6 +254,9 @@ URLProtocol *av_protocol_next(URLProtocol *p);
attribute_deprecated int register_protocol(URLProtocol *protocol);
#endif
/**
* Registers the URLProtocol protocol.
*/
int av_register_protocol(URLProtocol *protocol);
/**
......@@ -285,7 +376,7 @@ void put_flush_packet(ByteIOContext *s);
/**
* Reads size bytes from ByteIOContext into buf.
* @returns number of bytes read or AVERROR
* @return number of bytes read or AVERROR
*/
int get_buffer(ByteIOContext *s, unsigned char *buf, int size);
......@@ -293,7 +384,7 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size);
* Reads size bytes from ByteIOContext into buf.
* This reads at most 1 packet. If that is not enough fewer bytes will be
* returned.
* @returns number of bytes read or AVERROR
* @return number of bytes read or AVERROR
*/
int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size);
......@@ -318,21 +409,59 @@ static inline int url_is_streamed(ByteIOContext *s)
return s->is_streamed;
}
/** @note when opened as read/write, the buffers are only used for
writing */
/**
* Creates and initializes a ByteIOContext for accessing the
* resource referenced by the URLContext h.
* @note When the URLContext h has been opened in read+write mode, the
* ByteIOContext can be used only for writing.
*
* @param s Used to return the pointer to the created ByteIOContext.
* In case of failure the pointed to value is set to NULL.
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int url_fdopen(ByteIOContext **s, URLContext *h);
/** @warning must be called before any I/O */
int url_setbufsize(ByteIOContext *s, int buf_size);
#if LIBAVFORMAT_VERSION_MAJOR < 53
/** Reset the buffer for reading or writing.
* @note Will drop any data currently in the buffer without transmitting it.
* @param flags URL_RDONLY to set up the buffer for reading, or URL_WRONLY
* to set up the buffer for writing. */
int url_resetbuf(ByteIOContext *s, int flags);
#endif
/**
* Rewinds the ByteIOContext using the specified buffer containing the first buf_size bytes of the file.
* Used after probing to avoid seeking.
* Joins buf and s->buffer, taking any overlap into consideration.
* @note s->buffer must overlap with buf or they can't be joined and the function fails
* @note This function is NOT part of the public API
*
* @param s The read-only ByteIOContext to rewind
* @param buf The probe buffer containing the first buf_size bytes of the file
* @param buf_size The size of buf
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int ff_rewind_with_probe_data(ByteIOContext *s, unsigned char *buf, int buf_size);
/**
* Creates and initializes a ByteIOContext for accessing the
* resource indicated by url.
* @note When the resource indicated by url has been opened in
* read+write mode, the ByteIOContext can be used only for writing.
*
* @param s Used to return the pointer to the created ByteIOContext.
* In case of failure the pointed to value is set to NULL.
* @param flags flags which control how the resource indicated by url
* is to be opened
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code in case of failure
*/
int url_fopen(ByteIOContext **s, const char *url, int flags);
/** @note when opened as read/write, the buffers are only used for
writing */
int url_fopen(ByteIOContext **s, const char *filename, int flags);
int url_fclose(ByteIOContext *s);
URLContext *url_fileno(ByteIOContext *s);
......@@ -389,6 +518,8 @@ void init_checksum(ByteIOContext *s,
/* udp.c */
int udp_set_remote_url(URLContext *h, const char *uri);
int udp_get_local_port(URLContext *h);
#if (LIBAVFORMAT_VERSION_MAJOR <= 52)
int udp_get_file_handle(URLContext *h);
#endif
#endif /* AVFORMAT_AVIO_H */
......@@ -22,7 +22,7 @@
#define AVUTIL_ADLER32_H
#include <stdint.h>
#include "common.h"
#include "attributes.h"
unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf,
unsigned int len) av_pure;
......
/*
* 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
* Macro definitions for various function/variable attributes
*/
#ifndef AVUTIL_ATTRIBUTES_H
#define AVUTIL_ATTRIBUTES_H
#ifdef __GNUC__
# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
#else
# define AV_GCC_VERSION_AT_LEAST(x,y) 0
#endif
#ifndef av_always_inline
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_always_inline __attribute__((always_inline)) inline
#else
# define av_always_inline inline
#endif
#endif
#ifndef av_noinline
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_noinline __attribute__((noinline))
#else
# define av_noinline
#endif
#endif
#ifndef av_pure
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_pure __attribute__((pure))
#else
# define av_pure
#endif
#endif
#ifndef av_const
#if AV_GCC_VERSION_AT_LEAST(2,6)
# define av_const __attribute__((const))
#else
# define av_const
#endif
#endif
#ifndef av_cold
#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3)
# define av_cold __attribute__((cold))
#else
# define av_cold
#endif
#endif
#ifndef av_flatten
#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,1)
# define av_flatten __attribute__((flatten))
#else
# define av_flatten
#endif
#endif
#ifndef attribute_deprecated
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define attribute_deprecated __attribute__((deprecated))
#else
# define attribute_deprecated
#endif
#endif
#ifndef av_unused
#if defined(__GNUC__)
# define av_unused __attribute__((unused))
#else
# define av_unused
#endif
#endif
#ifndef av_uninit
#if defined(__GNUC__) && !defined(__ICC)
# define av_uninit(x) x=x
#else
# define av_uninit(x) x
#endif
#endif
#ifdef __GNUC__
# define av_builtin_constant_p __builtin_constant_p
#else
# define av_builtin_constant_p(x) 0
#endif
#endif /* AVUTIL_ATTRIBUTES_H */
/* Generated by ffconf */
#ifndef AVUTIL_AVCONFIG_H
#define AVUTIL_AVCONFIG_H
#define AV_HAVE_BIGENDIAN 0
#endif /* AVUTIL_AVCONFIG_H */
......@@ -46,6 +46,20 @@ int av_strstart(const char *str, const char *pfx, const char **ptr);
*/
int av_stristart(const char *str, const char *pfx, const char **ptr);
/**
* Locate the first case-independent occurrence in the string haystack
* of the string needle. A zero-length string needle is considered to
* match at the start of haystack.
*
* This function is a case-insensitive version of the standard strstr().
*
* @param haystack string to search in
* @param needle string to search for
* @return pointer to the located match within haystack
* or a null pointer if no match
*/
char *av_stristr(const char *haystack, const char *needle);
/**
* Copy the string src to dst, but no more than size - 1 bytes, and
* null-terminate dst.
......@@ -56,6 +70,10 @@ int av_stristart(const char *str, const char *pfx, const char **ptr);
* @param src source string
* @param size size of destination buffer
* @return the length of src
*
* WARNING: since the return value is the length of src, src absolutely
* _must_ be a properly 0-terminated string, otherwise this will read beyond
* the end of the buffer and possibly crash.
*/
size_t av_strlcpy(char *dst, const char *src, size_t size);
......@@ -70,12 +88,16 @@ size_t av_strlcpy(char *dst, const char *src, size_t size);
* @param src source string
* @param size size of destination buffer
* @return the total length of src and dst
*
* WARNING: since the return value use the length of src and dst, these absolutely
* _must_ be a properly 0-terminated strings, otherwise this will read beyond
* the end of the buffer and possibly crash.
*/
size_t av_strlcat(char *dst, const char *src, size_t size);
/**
* Append output to a string, according to a format. Never write out of
* the destination buffer, and and always put a terminating 0 within
* the destination buffer, and always put a terminating 0 within
* the buffer.
* @param dst destination buffer (string to which the output is
* appended)
......@@ -87,4 +109,9 @@ size_t av_strlcat(char *dst, const char *src, size_t size);
*/
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...);
/**
* Convert a number to a av_malloced string.
*/
char *av_d2str(double d);
#endif /* AVUTIL_AVSTRING_H */
......@@ -22,7 +22,7 @@
#define AVUTIL_AVUTIL_H
/**
* @file libavutil/avutil.h
* @file
* external API header
*/
......@@ -30,13 +30,18 @@
#define AV_STRINGIFY(s) AV_TOSTRING(s)
#define AV_TOSTRING(s) #s
#define AV_GLUE(a, b) a ## b
#define AV_JOIN(a, b) AV_GLUE(a, b)
#define AV_PRAGMA(s) _Pragma(#s)
#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c)
#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 49
#define LIBAVUTIL_VERSION_MAJOR 50
#define LIBAVUTIL_VERSION_MINOR 15
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_MICRO 1
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
......@@ -53,7 +58,28 @@
*/
unsigned avutil_version(void);
/**
* Returns the libavutil build-time configuration.
*/
const char *avutil_configuration(void);
/**
* Returns the libavutil license.
*/
const char *avutil_license(void);
enum AVMediaType {
AVMEDIA_TYPE_UNKNOWN = -1,
AVMEDIA_TYPE_VIDEO,
AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_DATA,
AVMEDIA_TYPE_SUBTITLE,
AVMEDIA_TYPE_ATTACHMENT,
AVMEDIA_TYPE_NB
};
#include "common.h"
#include "error.h"
#include "mathematics.h"
#include "rational.h"
#include "intfloat_readwrite.h"
......
......@@ -24,23 +24,23 @@
#include <stdint.h>
/**
* Decodes the base64-encoded string in \p in and puts the decoded
* data in \p out.
* Decodes the base64-encoded string in in and puts the decoded
* data in out.
*
* @param out_size size in bytes of the \p out buffer, it should be at
* least 3/4 of the length of \p in
* @param out_size size in bytes of the out buffer, it should be at
* least 3/4 of the length of in
* @return the number of bytes written, or a negative value in case of
* error
*/
int av_base64_decode(uint8_t *out, const char *in, int out_size);
/**
* Encodes in base64 the data in \p in and puts the resulting string
* in \p out.
* Encodes in base64 the data in in and puts the resulting string
* in out.
*
* @param out_size size in bytes of the \p out string, it should be at
* least ((\p in_size + 2) / 3) * 4 + 1
* @param in_size size in bytes of the \p in buffer
* @param out_size size in bytes of the out string, it should be at
* least ((in_size + 2) / 3) * 4 + 1
* @param in_size size in bytes of the in buffer
* @return the string containing the encoded data, or NULL in case of
* error
*/
......
......@@ -19,7 +19,7 @@
*/
/**
* @file libavutil/common.h
* @file
* common internal and external API header
*/
......@@ -28,90 +28,17 @@
#include <ctype.h>
#include <errno.h>
//#include <inttypes.h>
#ifdef _MSC_VER
#include <msc_inttypes.h>
#else
#include <inttypes.h>
#endif
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __GNUC__
# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
#else
# define AV_GCC_VERSION_AT_LEAST(x,y) 0
#endif
#ifndef av_always_inline
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_always_inline __attribute__((always_inline)) inline
#else
# define av_always_inline inline
#endif
#endif
#ifndef av_noinline
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_noinline __attribute__((noinline))
#else
# define av_noinline
#endif
#endif
#ifndef av_pure
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define av_pure __attribute__((pure))
#else
# define av_pure
#endif
#endif
#ifndef av_const
#if AV_GCC_VERSION_AT_LEAST(2,6)
# define av_const __attribute__((const))
#else
# define av_const
#endif
#endif
#ifndef av_cold
#if (!defined(__ICC) || __ICC > 1100) && AV_GCC_VERSION_AT_LEAST(4,3)
# define av_cold __attribute__((cold))
#else
# define av_cold
#endif
#endif
#ifndef av_flatten
#if AV_GCC_VERSION_AT_LEAST(4,1)
# define av_flatten __attribute__((flatten))
#else
# define av_flatten
#endif
#endif
#ifndef attribute_deprecated
#if AV_GCC_VERSION_AT_LEAST(3,1)
# define attribute_deprecated __attribute__((deprecated))
#else
# define attribute_deprecated
#endif
#endif
#ifndef av_unused
#if defined(__GNUC__)
# define av_unused __attribute__((unused))
#else
# define av_unused
#endif
#endif
#ifndef av_uninit
#if defined(__GNUC__) && !defined(__ICC)
# define av_uninit(x) x=x
#else
# define av_uninit(x) x
#endif
#endif
#include "attributes.h"
//rounded division & shift
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b))
......@@ -127,11 +54,14 @@
#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1))
/* misc math functions */
extern const uint8_t ff_log2_tab[256];
static inline av_const int av_log2(unsigned int v)
extern const uint8_t av_reverse[256];
static inline av_const int av_log2_c(unsigned int v)
{
int n = 0;
if (v & 0xffff0000) {
......@@ -147,7 +77,7 @@ static inline av_const int av_log2(unsigned int v)
return n;
}
static inline av_const int av_log2_16bit(unsigned int v)
static inline av_const int av_log2_16bit_c(unsigned int v)
{
int n = 0;
if (v & 0xff00) {
......@@ -159,6 +89,18 @@ static inline av_const int av_log2_16bit(unsigned int v)
return n;
}
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
# include "intmath.h"
#endif
#ifndef av_log2
# define av_log2 av_log2_c
#endif
#ifndef av_log2_16bit
# define av_log2_16bit av_log2_16bit_c
#endif
/**
* Clips a signed integer value into the amin-amax range.
* @param a value to clip
......@@ -180,8 +122,19 @@ static inline av_const int av_clip(int a, int amin, int amax)
*/
static inline av_const uint8_t av_clip_uint8(int a)
{
if (a&(~255)) return (-a)>>31;
else return a;
if (a&(~0xFF)) return (-a)>>31;
else return a;
}
/**
* Clips a signed integer value into the 0-65535 range.
* @param a value to clip
* @return clipped value
*/
static inline av_const uint16_t av_clip_uint16(int a)
{
if (a&(~0xFFFF)) return (-a)>>31;
else return a;
}
/**
......@@ -191,8 +144,19 @@ static inline av_const uint8_t av_clip_uint8(int a)
*/
static inline av_const int16_t av_clip_int16(int a)
{
if ((a+32768) & ~65535) return (a>>31) ^ 32767;
else return a;
if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
else return a;
}
/**
* Clips a signed 64-bit integer value into the -2147483648,2147483647 range.
* @param a value to clip
* @return clipped value
*/
static inline av_const int32_t av_clipl_int32(int64_t a)
{
if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF;
else return a;
}
/**
......@@ -209,6 +173,15 @@ static inline av_const float av_clipf(float a, float amin, float amax)
else return a;
}
/** Computes ceil(log2(x)).
* @param x value used to compute ceil(log2(x))
* @return computed ceiling of log2(x)
*/
static inline av_const int av_ceil_log2(int x)
{
return av_log2((x - 1) << 1);
}
#define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24))
#define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24))
......@@ -240,6 +213,30 @@ static inline av_const float av_clipf(float a, float amin, float amax)
}\
}
/*!
* \def GET_UTF16(val, GET_16BIT, ERROR)
* Converts a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form
* \param val is the output and should be of type uint32_t. It holds the converted
* UCS-4 character and should be a left value.
* \param GET_16BIT gets two bytes of UTF-16 encoded data converted to native endianness.
* It can be a function or a statement whose return value or evaluated value is of type
* uint16_t. It will be executed up to 2 times.
* \param ERROR action that should be taken when an invalid UTF-16 surrogate is
* returned from GET_BYTE. It should be a statement that jumps out of the macro,
* like exit(), goto, return, break, or continue.
*/
#define GET_UTF16(val, GET_16BIT, ERROR)\
val = GET_16BIT;\
{\
unsigned int hi = val - 0xD800;\
if (hi < 0x800) {\
val = GET_16BIT - 0xDC00;\
if (val > 0x3FFU || hi > 0x3FFU)\
ERROR\
val += (hi<<10) + 0x10000;\
}\
}\
/*!
* \def PUT_UTF8(val, tmp, PUT_BYTE)
* Converts a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
......@@ -276,10 +273,39 @@ static inline av_const float av_clipf(float a, float amin, float amax)
}\
}
/*!
* \def PUT_UTF16(val, tmp, PUT_16BIT)
* Converts a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
* \param val is an input-only argument and should be of type uint32_t. It holds
* a UCS-4 encoded Unicode character that is to be converted to UTF-16. If
* val is given as a function it is executed only once.
* \param tmp is a temporary variable and should be of type uint16_t. It
* represents an intermediate value during conversion that is to be
* output by PUT_16BIT.
* \param PUT_16BIT writes the converted UTF-16 data to any proper destination
* in desired endianness. It could be a function or a statement, and uses tmp
* as the input byte. For example, PUT_BYTE could be "*output++ = tmp;"
* PUT_BYTE will be executed 1 or 2 times depending on input character.
*/
#define PUT_UTF16(val, tmp, PUT_16BIT)\
{\
uint32_t in = val;\
if (in < 0x10000) {\
tmp = in;\
PUT_16BIT\
} else {\
tmp = 0xD800 | ((in - 0x10000) >> 10);\
PUT_16BIT\
tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\
PUT_16BIT\
}\
}\
#include "mem.h"
#ifdef HAVE_AV_CONFIG_H
# include "config.h"
# include "internal.h"
#endif /* HAVE_AV_CONFIG_H */
......
......@@ -23,7 +23,7 @@
#include <stdint.h>
#include <stddef.h>
#include "common.h"
#include "attributes.h"
typedef uint32_t AVCRC;
......
/*
* 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
* error code definitions
*/
#ifndef AVUTIL_ERROR_H
#define AVUTIL_ERROR_H
#include <errno.h>
#include "avutil.h"
/* error handling */
#if EDOM > 0
#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions.
#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value.
#else
/* Some platforms have E* and errno already negated. */
#define AVERROR(e) (e)
#define AVUNERROR(e) (e)
#endif
#if LIBAVUTIL_VERSION_MAJOR < 51
#define AVERROR_INVALIDDATA AVERROR(EINVAL) ///< Invalid data found when processing input
#define AVERROR_IO AVERROR(EIO) ///< I/O error
#define AVERROR_NOENT AVERROR(ENOENT) ///< No such file or directory
#define AVERROR_NOFMT AVERROR(EILSEQ) ///< Unknown format
#define AVERROR_NOMEM AVERROR(ENOMEM) ///< Not enough memory
#define AVERROR_NOTSUPP AVERROR(ENOSYS) ///< Operation not supported
#define AVERROR_NUMEXPECTED AVERROR(EDOM) ///< Number syntax expected in filename
#define AVERROR_UNKNOWN AVERROR(EINVAL) ///< Unknown error
#endif
#define AVERROR_EOF AVERROR(EPIPE) ///< End of file
#define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome
#if LIBAVUTIL_VERSION_MAJOR > 50
#define AVERROR_INVALIDDATA (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input
#define AVERROR_NUMEXPECTED (-MKTAG('N','U','E','X')) ///< Number syntax expected in filename
#endif
/**
* Puts a description of the AVERROR code errnum in errbuf.
* In case of failure the global variable errno is set to indicate the
* error. Even in case of failure av_strerror() will print a generic
* error message indicating the errnum provided to errbuf.
*
* @param errbuf_size the size in bytes of errbuf
* @return 0 on success, a negative value if a description for errnum
* cannot be found
*/
int av_strerror(int errnum, char *errbuf, size_t errbuf_size);
#endif /* AVUTIL_ERROR_H */
......@@ -17,7 +17,7 @@
*/
/**
* @file libavutil/fifo.h
* @file
* a very simple circular buffer FIFO implementation
*/
......@@ -25,21 +25,19 @@
#define AVUTIL_FIFO_H
#include <stdint.h>
#include "avutil.h"
#include "common.h"
typedef struct AVFifoBuffer {
uint8_t *buffer;
uint8_t *rptr, *wptr, *end;
uint32_t rndx, wndx;
} AVFifoBuffer;
/**
* Initializes an AVFifoBuffer.
* @param *f AVFifoBuffer to initialize
* @param size of FIFO
* @return <0 for failure >=0 otherwise
* @return AVFifoBuffer or NULL in case of memory allocation failure
*/
int av_fifo_init(AVFifoBuffer *f, unsigned int size);
AVFifoBuffer *av_fifo_alloc(unsigned int size);
/**
* Frees an AVFifoBuffer.
......@@ -47,6 +45,12 @@ int av_fifo_init(AVFifoBuffer *f, unsigned int size);
*/
void av_fifo_free(AVFifoBuffer *f);
/**
* Resets the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied.
* @param *f AVFifoBuffer to reset
*/
void av_fifo_reset(AVFifoBuffer *f);
/**
* Returns the amount of data in bytes in the AVFifoBuffer, that is the
* amount of data you can read from it.
......@@ -56,12 +60,12 @@ void av_fifo_free(AVFifoBuffer *f);
int av_fifo_size(AVFifoBuffer *f);
/**
* Reads data from an AVFifoBuffer.
* @param *f AVFifoBuffer to read from
* @param *buf data destination
* @param buf_size number of bytes to read
* Returns the amount of space in bytes in the AVFifoBuffer, that is the
* amount of data you can write into it.
* @param *f AVFifoBuffer to write into
* @return size
*/
int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size);
int av_fifo_space(AVFifoBuffer *f);
/**
* Feeds data from an AVFifoBuffer to a user-supplied callback.
......@@ -70,22 +74,13 @@ int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size);
* @param *func generic read function
* @param *dest data destination
*/
int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest);
#if LIBAVUTIL_VERSION_MAJOR < 50
/**
* Writes data into an AVFifoBuffer.
* @param *f AVFifoBuffer to write to
* @param *buf data source
* @param size data size
*/
attribute_deprecated void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size);
#endif
int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int));
/**
* Feeds data from a user-supplied callback to an AVFifoBuffer.
* @param *f AVFifoBuffer to write to
* @param *src data source
* @param *src data source; non-const since it may be used as a
* modifiable context by the function defined in func
* @param size number of bytes to write
* @param *func generic write function; the first parameter is src,
* the second is dest_buf, the third is dest_buf_size.
......@@ -96,16 +91,6 @@ attribute_deprecated void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int
*/
int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int));
#if LIBAVUTIL_VERSION_MAJOR < 50
/**
* Resizes an AVFifoBuffer.
* @param *f AVFifoBuffer to resize
* @param size new AVFifoBuffer size in bytes
* @see av_fifo_realloc2()
*/
attribute_deprecated void av_fifo_realloc(AVFifoBuffer *f, unsigned int size);
#endif
/**
* Resizes an AVFifoBuffer.
* @param *f AVFifoBuffer to resize
......
......@@ -21,8 +21,8 @@
#ifndef AVUTIL_INTFLOAT_READWRITE_H
#define AVUTIL_INTFLOAT_READWRITE_H
//#include <stdint.h>
#include "common.h"
#include <stdint.h>
#include "attributes.h"
/* IEEE 80 bits extended float */
typedef struct AVExtFloat {
......
......@@ -29,8 +29,7 @@
* arbitrary struct of which the first field is a pointer to an
* AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
*/
typedef struct AVCLASS AVClass;
struct AVCLASS {
typedef struct {
/**
* The name of the class; usually it is the same name as the
* context structure type to which the AVClass is associated.
......@@ -39,7 +38,7 @@ struct AVCLASS {
/**
* A pointer to a function which returns the name of a context
* instance \p ctx associated with the class.
* instance ctx associated with the class.
*/
const char* (*item_name)(void* ctx);
......@@ -49,19 +48,18 @@ struct AVCLASS {
* @see av_set_default_options()
*/
const struct AVOption *option;
};
/**
* LIBAVUTIL_VERSION with which this structure was created.
* This is used to allow fields to be added without requiring major
* version bumps everywhere.
*/
int version;
} AVClass;
/* av_log API */
#if LIBAVUTIL_VERSION_INT < (50<<16)
#define AV_LOG_QUIET -1
#define AV_LOG_FATAL 0
#define AV_LOG_ERROR 0
#define AV_LOG_WARNING 1
#define AV_LOG_INFO 1
#define AV_LOG_VERBOSE 1
#define AV_LOG_DEBUG 2
#else
#define AV_LOG_QUIET -8
/**
......@@ -95,11 +93,6 @@ struct AVCLASS {
* Stuff which is only useful for libav* developers.
*/
#define AV_LOG_DEBUG 48
#endif
#if LIBAVUTIL_VERSION_INT < (50<<16)
extern int av_log_level;
#endif
/**
* Sends the specified message to the log if the level is less than or equal
......
......@@ -21,9 +21,9 @@
#ifndef AVUTIL_MATHEMATICS_H
#define AVUTIL_MATHEMATICS_H
//#include <stdint.h>
#include <stdint.h>
#include <math.h>
#include "common.h"
#include "attributes.h"
#include "rational.h"
#ifndef M_E
......@@ -35,12 +35,24 @@
#ifndef M_LN10
#define M_LN10 2.30258509299404568402 /* log_e 10 */
#endif
#ifndef M_LOG2_10
#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
#endif
#ifndef M_SQRT1_2
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
#endif
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#endif
#ifndef NAN
#define NAN (0.0/0.0)
#endif
#ifndef INFINITY
#define INFINITY (1.0/0.0)
#endif
enum AVRounding {
AV_ROUND_ZERO = 0, ///< Round toward zero.
......@@ -50,6 +62,11 @@ enum AVRounding {
AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero.
};
/**
* Returns the greatest common divisor of a and b.
* If both a and b are 0 or either or both are <0 then behavior is
* undefined.
*/
int64_t av_const av_gcd(int64_t a, int64_t b);
/**
......@@ -69,4 +86,13 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_cons
*/
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
/**
* Compares 2 timestamps each in its own timebases.
* The result of the function is undefined if one of the timestamps
* is outside the int64_t range when represented in the others timebase.
* @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position
*/
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
#endif /* AVUTIL_MATHEMATICS_H */
......@@ -19,14 +19,35 @@
*/
/**
* @file libavutil/mem.h
* @file
* memory handling functions
*/
#ifndef AVUTIL_MEM_H
#define AVUTIL_MEM_H
#include "common.h"
#include "attributes.h"
#if defined(__ICC) || defined(__SUNPRO_C)
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
#define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
#elif defined(__TI_COMPILER_VERSION__)
#define DECLARE_ALIGNED(n,t,v) \
AV_PRAGMA(DATA_ALIGN(v,n)) \
t __attribute__((aligned(n))) v
#define DECLARE_ASM_CONST(n,t,v) \
AV_PRAGMA(DATA_ALIGN(v,n)) \
static const t __attribute__((aligned(n))) v
#elif defined(__GNUC__)
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
#define DECLARE_ASM_CONST(n,t,v) static const t attribute_used __attribute__ ((aligned (n))) v
#elif defined(_MSC_VER)
#define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
#define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
#else
#define DECLARE_ALIGNED(n,t,v) t v
#define DECLARE_ASM_CONST(n,t,v) static const t v
#endif
#if AV_GCC_VERSION_AT_LEAST(3,1)
#define av_malloc_attrib __attribute__((__malloc__))
......@@ -34,14 +55,14 @@
#define av_malloc_attrib
#endif
#if (!defined(__ICC) || __ICC > 1100) && AV_GCC_VERSION_AT_LEAST(4,3)
#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3)
#define av_alloc_size(n) __attribute__((alloc_size(n)))
#else
#define av_alloc_size(n)
#endif
/**
* Allocates a block of \p size bytes with alignment suitable for all
* Allocates a block of size bytes with alignment suitable for all
* memory accesses (including vectors if available on the CPU).
* @param size Size in bytes for the memory block to be allocated.
* @return Pointer to the allocated block, NULL if the block cannot
......@@ -52,8 +73,8 @@ void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1);
/**
* Allocates or reallocates a block of memory.
* If \p ptr is NULL and \p size > 0, allocates a new block. If \p
* size is zero, frees the memory block pointed to by \p ptr.
* If ptr is NULL and size > 0, allocates a new block. If
* size is zero, frees the memory block pointed to by ptr.
* @param size Size in bytes for the memory block to be allocated or
* reallocated.
* @param ptr Pointer to a memory block already allocated with
......@@ -75,7 +96,7 @@ void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2);
void av_free(void *ptr);
/**
* Allocates a block of \p size bytes with alignment suitable for all
* Allocates a block of size bytes with alignment suitable for all
* memory accesses (including vectors if available on the CPU) and
* zeroes all the bytes of the block.
* @param size Size in bytes for the memory block to be allocated.
......@@ -85,10 +106,10 @@ void av_free(void *ptr);
void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1);
/**
* Duplicates the string \p s.
* Duplicates the string s.
* @param s string to be duplicated
* @return Pointer to a newly allocated string containing a
* copy of \p s or NULL if the string cannot be allocated.
* copy of s or NULL if the string cannot be allocated.
*/
char *av_strdup(const char *s) av_malloc_attrib;
......
/*
* pixel format descriptor
* Copyright (c) 2009 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_PIXDESC_H
#define AVUTIL_PIXDESC_H
#include <inttypes.h>
typedef struct AVComponentDescriptor{
uint16_t plane :2; ///< which of the 4 planes contains the component
/**
* Number of elements between 2 horizontally consecutive pixels minus 1.
* Elements are bits for bitstream formats, bytes otherwise.
*/
uint16_t step_minus1 :3;
/**
* Number of elements before the component of the first pixel plus 1.
* Elements are bits for bitstream formats, bytes otherwise.
*/
uint16_t offset_plus1 :3;
uint16_t shift :3; ///< number of least significant bits that must be shifted away to get the value
uint16_t depth_minus1 :4; ///< number of bits in the component minus 1
}AVComponentDescriptor;
/**
* Descriptor that unambiguously describes how the bits of a pixel are
* stored in the up to 4 data planes of an image. It also stores the
* subsampling factors and number of components.
*
* @note This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV
* and all the YUV variants) AVPixFmtDescriptor just stores how values
* are stored not what these values represent.
*/
typedef struct AVPixFmtDescriptor{
const char *name;
uint8_t nb_components; ///< The number of components each pixel has, (1-4)
/**
* Amount to shift the luma width right to find the chroma width.
* For YV12 this is 1 for example.
* chroma_width = -((-luma_width) >> log2_chroma_w)
* The note above is needed to ensure rounding up.
* This value only refers to the chroma components.
*/
uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w)
/**
* Amount to shift the luma height right to find the chroma height.
* For YV12 this is 1 for example.
* chroma_height= -((-luma_height) >> log2_chroma_h)
* The note above is needed to ensure rounding up.
* This value only refers to the chroma components.
*/
uint8_t log2_chroma_h;
uint8_t flags;
/**
* Parameters that describe how pixels are packed. If the format
* has chroma components, they must be stored in comp[1] and
* comp[2].
*/
AVComponentDescriptor comp[4];
}AVPixFmtDescriptor;
#define PIX_FMT_BE 1 ///< Pixel format is big-endian.
#define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette.
#define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end.
#define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format.
/**
* The array of all the pixel format descriptors.
*/
extern const AVPixFmtDescriptor av_pix_fmt_descriptors[];
/**
* Reads a line from an image, and writes the values of the
* pixel format component c to dst.
*
* @param data the array containing the pointers to the planes of the image
* @param linesizes the array containing the linesizes of the image
* @param desc the pixel format descriptor for the image
* @param x the horizontal coordinate of the first pixel to read
* @param y the vertical coordinate of the first pixel to read
* @param w the width of the line to read, that is the number of
* values to write to dst
* @param read_pal_component if not zero and the format is a paletted
* format writes the values corresponding to the palette
* component c in data[1] to dst, rather than the palette indexes in
* data[0]. The behavior is undefined if the format is not paletted.
*/
void read_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4],
const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component);
/**
* Writes the values from src to the pixel format component c of an
* image line.
*
* @param src array containing the values to write
* @param data the array containing the pointers to the planes of the
* image to write into. It is supposed to be zeroed.
* @param linesizes the array containing the linesizes of the image
* @param desc the pixel format descriptor for the image
* @param x the horizontal coordinate of the first pixel to write
* @param y the vertical coordinate of the first pixel to write
* @param w the width of the line to write, that is the number of
* values to write to the image line
*/
void write_line(const uint16_t *src, uint8_t *data[4], const int linesize[4],
const AVPixFmtDescriptor *desc, int x, int y, int c, int w);
/**
* Returns the pixel format corresponding to name.
*
* If there is no pixel format with name name, then looks for a
* pixel format with the name corresponding to the native endian
* format of name.
* For example in a little-endian system, first looks for "gray16",
* then for "gray16le".
*
* Finally if no pixel format has been found, returns PIX_FMT_NONE.
*/
enum PixelFormat av_get_pix_fmt(const char *name);
/**
* Returns the number of bits per pixel used by the pixel format
* described by pixdesc.
*
* The returned number of bits refers to the number of bits actually
* used for storing the pixel information, that is padding bits are
* not counted.
*/
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc);
#endif /* AVUTIL_PIXDESC_H */
......@@ -20,7 +20,7 @@
*/
/**
* @file libavutil/rational.h
* @file
* rational numbers
* @author Michael Niedermayer <michaelni@gmx.at>
*/
......@@ -28,8 +28,8 @@
#ifndef AVUTIL_RATIONAL_H
#define AVUTIL_RATIONAL_H
//#include <stdint.h>
#include "common.h"
#include <stdint.h>
#include "attributes.h"
/**
* rational number numerator/denominator
......@@ -114,13 +114,13 @@ AVRational av_sub_q(AVRational b, AVRational c) av_const;
AVRational av_d2q(double d, int max) av_const;
/**
* @return 1 if \q1 is nearer to \p q than \p q2, -1 if \p q2 is nearer
* than \p q1, 0 if they have the same distance.
* @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer
* than q1, 0 if they have the same distance.
*/
int av_nearer_q(AVRational q, AVRational q1, AVRational q2);
/**
* Finds the nearest value in \p q_list to \p q.
* Finds the nearest value in q_list to q.
* @param q_list an array of rationals terminated by {0, 0}
* @return the index of the nearest value found in the array
*/
......
......@@ -27,8 +27,31 @@ extern const int av_sha1_size;
struct AVSHA1;
/**
* Initializes SHA-1 hashing.
*
* @param context pointer to the function context (of size av_sha_size)
* @deprecated use av_sha_init() instead
*/
void av_sha1_init(struct AVSHA1* context);
/**
* Updates hash value.
*
* @param context hash function context
* @param data input data to update hash with
* @param len input data length
* @deprecated use av_sha_update() instead
*/
void av_sha1_update(struct AVSHA1* context, const uint8_t* data, unsigned int len);
/**
* Finishes hashing and output digest value.
*
* @param context hash function context
* @param digest buffer where output digest value is stored
* @deprecated use av_sha_final() instead
*/
void av_sha1_final(struct AVSHA1* context, uint8_t digest[20]);
#endif /* AVUTIL_SHA1_H */
This diff is collapsed.
/*
* Mersenne Twister PRNG algorithm
* Copyright (c) 2006 Ryan Martell
* Based on a C program for MT19937, with initialization improved 2002/1/26.
* Coded by Takuji Nishimura and Makoto Matsumoto.
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVUTIL_RANDOM_H
#define AVUTIL_RANDOM_H
#define AV_RANDOM_N 624
#include "avutil.h"
#include "common.h"
typedef struct {
unsigned int mt[AV_RANDOM_N]; ///< the array for the state vector
int index; ///< Current untempered value we use as the base.
} AVRandomState;
#if LIBAVUTIL_VERSION_MAJOR < 50
attribute_deprecated void av_init_random(unsigned int seed, AVRandomState *state);
#endif
void av_random_init(AVRandomState *state, unsigned int seed); ///< To be inlined, the struct must be visible. So it does not make sense to try and keep it opaque with malloc/free-like calls.
void av_random_generate_untempered_numbers(AVRandomState *state); ///< Regenerate the untempered numbers (must be done every 624 iterations, or it will loop).
/**
* Generates a random number from the interval [0,0xffffffff].
*
* Please do NOT use the Mersenne Twister, it is slow. Use the random number
* generator from lfg.c/h or a simple LCG like state = state*1664525+1013904223.
* If you still choose to use MT, expect that you will have to provide
* some evidence that it makes a difference for the case where you use it.
*/
static inline unsigned int av_random(AVRandomState *state)
{
unsigned int y;
// Regenerate the untempered numbers if we should...
if (state->index >= AV_RANDOM_N)
av_random_generate_untempered_numbers(state);
// Grab one...
y = state->mt[state->index++];
/* Now temper (Mersenne Twister coefficients). The coefficients for MT19937 are.. */
y ^= (y >> 11);
y ^= (y << 7) & 0x9d2c5680;
y ^= (y << 15) & 0xefc60000;
y ^= (y >> 18);
return y;
}
/** Returns a random number in the range [0-1] as double. */
static inline double av_random_real1(AVRandomState *state)
{
/* divided by 2^32-1 */
return av_random(state) * (1.0 / 4294967296.0);
}
#endif /* AVUTIL_RANDOM_H */
/*
* software RGB to RGB converter
* pluralize by Software PAL8 to RGB converter
* Software YUV to YUV converter
* Software YUV to RGB converter
* Written by Nick Kurshev.
* palette & YUV & runtime CPU stuff by Michael (michaelni@gmx.at)
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SWSCALE_RGB2RGB_H
#define SWSCALE_RGB2RGB_H
#include <inttypes.h>
/* A full collection of RGB to RGB(BGR) converters */
extern void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb32to16) (const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb32to15) (const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb15to16) (const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb15to32) (const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb16to15) (const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb16to32) (const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb24to16) (const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb24to15) (const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
void rgb24to32 (const uint8_t *src, uint8_t *dst, long src_size);
void rgb32to24 (const uint8_t *src, uint8_t *dst, long src_size);
void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
void rgb16to24 (const uint8_t *src, uint8_t *dst, long src_size);
void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
void rgb15to24 (const uint8_t *src, uint8_t *dst, long src_size);
void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
void bgr8torgb8 (const uint8_t *src, uint8_t *dst, long src_size);
void palette8topacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
/**
* Height should be a multiple of 2 and width should be a multiple of 16.
* (If this is a problem for anyone then tell me, and I will fix it.)
* Chrominance data is only taken from every second line, others are ignored.
* FIXME: Write high quality version.
*/
//void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
/**
* Height should be a multiple of 2 and width should be a multiple of 16.
* (If this is a problem for anyone then tell me, and I will fix it.)
*/
extern void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
long width, long height,
long lumStride, long chromStride, long dstStride);
/**
* Width should be a multiple of 16.
*/
extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
long width, long height,
long lumStride, long chromStride, long dstStride);
/**
* Height should be a multiple of 2 and width should be a multiple of 16.
* (If this is a problem for anyone then tell me, and I will fix it.)
*/
extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
long width, long height,
long lumStride, long chromStride, long srcStride);
/**
* Height should be a multiple of 2 and width should be a multiple of 16.
* (If this is a problem for anyone then tell me, and I will fix it.)
*/
extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
long width, long height,
long lumStride, long chromStride, long dstStride);
/**
* Width should be a multiple of 16.
*/
extern void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
long width, long height,
long lumStride, long chromStride, long dstStride);
/**
* Height should be a multiple of 2 and width should be a multiple of 2.
* (If this is a problem for anyone then tell me, and I will fix it.)
* Chrominance data is only taken from every second line, others are ignored.
* FIXME: Write high quality version.
*/
extern void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
long width, long height,
long lumStride, long chromStride, long srcStride);
extern void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height,
long srcStride, long dstStride);
extern void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst,
long width, long height, long src1Stride,
long src2Stride, long dstStride);
extern void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
uint8_t *dst1, uint8_t *dst2,
long width, long height,
long srcStride1, long srcStride2,
long dstStride1, long dstStride2);
extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
uint8_t *dst,
long width, long height,
long srcStride1, long srcStride2,
long srcStride3, long dstStride);
void sws_rgb2rgb_init(int flags);
#endif /* SWSCALE_RGB2RGB_H */
/*
* RTP definitions
* Copyright (c) 2002 Fabrice Bellard
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFORMAT_RTP_H
#define AVFORMAT_RTP_H
#include "avcodec.h"
/**
* Return the payload type for a given codec.
*
* @param codec The context of the codec
* @return In case of unknown payload type or dynamic payload type, a
* negative value is returned; otherwise, the payload type (the 'PT' field
* in the RTP header) is returned.
*/
int ff_rtp_get_payload_type(AVCodecContext *codec);
/**
* Initialize a codec context based on the payload type.
*
* Fill the codec_type and codec_id fields of a codec context with
* information depending on the payload type; for audio codecs, the
* channels and sample_rate fields are also filled.
*
* @param codec The context of the codec
* @param payload_type The payload type (the 'PT' field in the RTP header)
* @return In case of unknown payload type or dynamic payload type, a
* negative value is returned; otherwise, 0 is returned
*/
int ff_rtp_get_codec_info(AVCodecContext *codec, int payload_type);
/**
* Return the encoding name (as defined in
* http://www.iana.org/assignments/rtp-parameters) for a given payload type.
*
* @param payload_type The payload type (the 'PT' field in the RTP header)
* @return In case of unknown payload type or dynamic payload type, a pointer
* to an empty string is returned; otherwise, a pointer to a string containing
* the encoding name is returned
*/
const char *ff_rtp_enc_name(int payload_type);
/**
* Return the codec id for the given encoding name and codec type.
*
* @param buf A pointer to the string containing the encoding name
* @param codec_type The codec type
* @return In case of unknown encoding name, CODEC_ID_NONE is returned;
* otherwise, the codec id is returned
*/
enum CodecID ff_rtp_codec_id(const char *buf, enum CodecType codec_type);
#define RTP_PT_PRIVATE 96
#define RTP_VERSION 2
#define RTP_MAX_SDES 256 /**< maximum text length for SDES */
/* RTCP paquets use 0.5 % of the bandwidth */
#define RTCP_TX_RATIO_NUM 5
#define RTCP_TX_RATIO_DEN 1000
#endif /* AVFORMAT_RTP_H */
This diff is collapsed.
/*
* RTSP definitions
* copyright (c) 2002 Fabrice Bellard
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFORMAT_RTSPCODES_H
#define AVFORMAT_RTSPCODES_H
/** RTSP handling */
enum RTSPStatusCode {
RTSP_STATUS_OK =200, /**< OK */
RTSP_STATUS_METHOD =405, /**< Method Not Allowed */
RTSP_STATUS_BANDWIDTH =453, /**< Not Enough Bandwidth */
RTSP_STATUS_SESSION =454, /**< Session Not Found */
RTSP_STATUS_STATE =455, /**< Method Not Valid in This State */
RTSP_STATUS_AGGREGATE =459, /**< Aggregate operation not allowed */
RTSP_STATUS_ONLY_AGGREGATE =460, /**< Only aggregate operation allowed */
RTSP_STATUS_TRANSPORT =461, /**< Unsupported transport */
RTSP_STATUS_INTERNAL =500, /**< Internal Server Error */
RTSP_STATUS_SERVICE =503, /**< Service Unavailable */
RTSP_STATUS_VERSION =505, /**< RTSP Version not supported */
};
#endif /* AVFORMAT_RTSPCODES_H */
......@@ -53,6 +53,10 @@
}
#endif
#if _MSC_VER >= 1600
#include "stdint.h"
#else
// 7.18.1 Integer types
// 7.18.1.1 Exact-width integer types
......@@ -218,5 +222,6 @@ typedef uint64_t uintmax_t;
#endif // __STDC_CONSTANT_MACROS ]
#endif
#endif // _MSC_STDINT_H_ ]
No preview for this file type
......@@ -89,7 +89,7 @@ openexr-1.4.0 - OpenEXR is a high dynamic-range (HDR) image file format develope
------------------------------------------------------------------------------------
ffmpeg-0.5.1 - FFmpeg is a complete, cross-platform solution to record,
ffmpeg-0.6.0 - FFmpeg is a complete, cross-platform solution to record,
convert and stream audio and video. It includes libavcodec -
the leading audio/video codec library, and also libavformat, libavutils and
other helper libraries that are used by OpenCV (in highgui module) to
......
This diff is collapsed.
This diff is collapsed.
......@@ -541,6 +541,7 @@ extern "C" { __declspec(dllexport) unsigned int __lc_codepage = 0; }
#pragma comment(lib, "libavformat.a")
#pragma comment(lib, "libavcodec.a")
#pragma comment(lib, "libavutil.a")
#pragma comment(lib, "libswscale.a")
#endif
#pragma comment(lib, "libwsock32_.a")
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment