updated ffmpeg to 0.6.0

pull/13383/head
Vadim Pisarevsky 15 years ago
parent d8ad4e2267
commit 26c6b955a8
  1. 41
      3rdparty/include/ffmpeg_/imgconvert.h
  2. 86
      3rdparty/include/ffmpeg_/integer.h
  3. 848
      3rdparty/include/ffmpeg_/libavcodec/avcodec.h
  4. 99
      3rdparty/include/ffmpeg_/libavcodec/avfft.h
  5. 68
      3rdparty/include/ffmpeg_/libavcodec/dxva2.h
  6. 67
      3rdparty/include/ffmpeg_/libavcodec/opt.h
  7. 167
      3rdparty/include/ffmpeg_/libavcodec/vaapi.h
  8. 11
      3rdparty/include/ffmpeg_/libavcodec/vdpau.h
  9. 6
      3rdparty/include/ffmpeg_/libavcodec/xvmc.h
  10. 14
      3rdparty/include/ffmpeg_/libavdevice/avdevice.h
  11. 415
      3rdparty/include/ffmpeg_/libavformat/avformat.h
  12. 169
      3rdparty/include/ffmpeg_/libavformat/avio.h
  13. 2
      3rdparty/include/ffmpeg_/libavutil/adler32.h
  14. 113
      3rdparty/include/ffmpeg_/libavutil/attributes.h
  15. 5
      3rdparty/include/ffmpeg_/libavutil/avconfig.h
  16. 29
      3rdparty/include/ffmpeg_/libavutil/avstring.h
  17. 32
      3rdparty/include/ffmpeg_/libavutil/avutil.h
  18. 18
      3rdparty/include/ffmpeg_/libavutil/base64.h
  19. 200
      3rdparty/include/ffmpeg_/libavutil/common.h
  20. 2
      3rdparty/include/ffmpeg_/libavutil/crc.h
  21. 72
      3rdparty/include/ffmpeg_/libavutil/error.h
  22. 51
      3rdparty/include/ffmpeg_/libavutil/fifo.h
  23. 4
      3rdparty/include/ffmpeg_/libavutil/intfloat_readwrite.h
  24. 29
      3rdparty/include/ffmpeg_/libavutil/log.h
  25. 0
      3rdparty/include/ffmpeg_/libavutil/lzo.h
  26. 30
      3rdparty/include/ffmpeg_/libavutil/mathematics.h
  27. 0
      3rdparty/include/ffmpeg_/libavutil/md5.h
  28. 39
      3rdparty/include/ffmpeg_/libavutil/mem.h
  29. 154
      3rdparty/include/ffmpeg_/libavutil/pixdesc.h
  30. 100
      3rdparty/include/ffmpeg_/libavutil/pixfmt.h
  31. 12
      3rdparty/include/ffmpeg_/libavutil/rational.h
  32. 23
      3rdparty/include/ffmpeg_/libavutil/sha1.h
  33. 330
      3rdparty/include/ffmpeg_/libswscale/swscale.h
  34. 79
      3rdparty/include/ffmpeg_/random.h
  35. 147
      3rdparty/include/ffmpeg_/rgb2rgb.h
  36. 79
      3rdparty/include/ffmpeg_/rtp.h
  37. 282
      3rdparty/include/ffmpeg_/rtsp.h
  38. 40
      3rdparty/include/ffmpeg_/rtspcodes.h
  39. 5
      3rdparty/include/msc_stdint.h
  40. BIN
      3rdparty/lib/libavcodec.a
  41. BIN
      3rdparty/lib/libavcodec64.a
  42. BIN
      3rdparty/lib/libavdevice.a
  43. BIN
      3rdparty/lib/libavdevice64.a
  44. BIN
      3rdparty/lib/libavformat.a
  45. BIN
      3rdparty/lib/libavformat64.a
  46. BIN
      3rdparty/lib/libavutil.a
  47. BIN
      3rdparty/lib/libavutil64.a
  48. BIN
      3rdparty/lib/libswscale.a
  49. BIN
      3rdparty/lib/libswscale64.a
  50. 2
      3rdparty/readme.txt
  51. 20
      CMakeLists.txt
  52. 13
      modules/ffmpeg/CMakeLists.txt
  53. 1
      modules/ffmpeg/ffopencv.cpp
  54. 7
      modules/highgui/src/cap_ffmpeg.cpp

@ -1,41 +0,0 @@
/*
* 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 */

@ -1,86 +0,0 @@
/*
* 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 */

@ -0,0 +1,99 @@
/*
* 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 */

@ -0,0 +1,68 @@
/*
* 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);

@ -0,0 +1,167 @@
/*
* 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.

@ -22,8 +22,8 @@
#define AVFORMAT_AVFORMAT_H
#define LIBAVFORMAT_VERSION_MAJOR 52
#define LIBAVFORMAT_VERSION_MINOR 31
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_MINOR 64
#define LIBAVFORMAT_VERSION_MICRO 2
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
@ -36,13 +36,24 @@
#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION)
/**
* Returns the LIBAVFORMAT_VERSION_INT constant.
* I return the LIBAVFORMAT_VERSION_INT constant. You got
* a fucking problem with that, douchebag?
*/
unsigned avformat_version(void);
/**
* Returns the libavformat build-time configuration.
*/
const char *avformat_configuration(void);
/**
* Returns the libavformat license.
*/
const char *avformat_license(void);
#include <time.h>
#include <stdio.h> /* FILE */
#include "avcodec.h"
#include "libavcodec/avcodec.h"
#include "avio.h"
@ -52,7 +63,9 @@ struct AVFormatContext;
/*
* Public Metadata API.
* The metadata API allows libavformat to export metadata tags to a client
* application using a sequence of key/value pairs.
* application using a sequence of key/value pairs. Like all strings in FFmpeg,
* metadata must be stored as UTF-8 encoded Unicode. Note that metadata
* exported by demuxers isn't checked to be valid UTF-8 in most cases.
* Important concepts to keep in mind:
* 1. Keys are unique; there can never be 2 tags with the same key. This is
* also meant semantically, i.e., a demuxer should not knowingly produce
@ -62,15 +75,51 @@ struct AVFormatContext;
* 2. Metadata is flat, not hierarchical; there are no subtags. If you
* want to store, e.g., the email address of the child of producer Alice
* and actor Bob, that could have key=alice_and_bobs_childs_email_address.
* 3. A tag whose value is localized for a particular language is appended
* with a dash character ('-') and the ISO 639 3-letter language code.
* For example: Author-ger=Michael, Author-eng=Mike
* The original/default language is in the unqualified "Author" tag.
* A demuxer should set a default if it sets any translated tag.
* 3. Several modifiers can be applied to the tag name. This is done by
* appending a dash character ('-') and the modifier name in the order
* they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng.
* a) language -- a tag whose value is localized for a particular language
* is appended with the ISO 639-2/B 3-letter language code.
* For example: Author-ger=Michael, Author-eng=Mike
* The original/default language is in the unqualified "Author" tag.
* A demuxer should set a default if it sets any translated tag.
* b) sorting -- a modified version of a tag that should be used for
* sorting will have '-sort' appended. E.g. artist="The Beatles",
* artist-sort="Beatles, The".
*
* 4. Tag names are normally exported exactly as stored in the container to
* allow lossless remuxing to the same format. For container-independent
* handling of metadata, av_metadata_conv() can convert it to ffmpeg generic
* format. Follows a list of generic tag names:
*
* album -- name of the set this work belongs to
* album_artist -- main creator of the set/album, if different from artist.
* e.g. "Various Artists" for compilation albums.
* artist -- main creator of the work
* comment -- any additional description of the file.
* composer -- who composed the work, if different from artist.
* copyright -- name of copyright holder.
* date -- date when the work was created, preferably in ISO 8601.
* disc -- number of a subset, e.g. disc in a multi-disc collection.
* encoder -- name/settings of the software/hardware that produced the file.
* encoded_by -- person/group who created the file.
* filename -- original name of the file.
* genre -- <self-evident>.
* language -- main language in which the work is performed, preferably
* in ISO 639-2 format.
* performer -- artist who performed the work, if different from artist.
* E.g for "Also sprach Zarathustra", artist would be "Richard
* Strauss" and performer "London Philharmonic Orchestra".
* publisher -- name of the label/publisher.
* title -- name of the work.
* track -- number of this work in the set, can be in form current/total.
*/
#define AV_METADATA_MATCH_CASE 1
#define AV_METADATA_IGNORE_SUFFIX 2
#define AV_METADATA_DONT_STRDUP_KEY 4
#define AV_METADATA_DONT_STRDUP_VAL 8
#define AV_METADATA_DONT_OVERWRITE 16 ///< Don't overwrite existing tags.
typedef struct {
char *key;
@ -83,23 +132,36 @@ typedef struct AVMetadataConv AVMetadataConv;
/**
* Gets a metadata element 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 tag or NULL, changing key or value leads to undefined behavior.
*/
AVMetadataTag *
av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags);
#if LIBAVFORMAT_VERSION_MAJOR == 52
/**
* Sets the given tag in m, overwriting an existing tag.
* @param key tag key to add to m (will be av_strduped)
* @param value tag value to add to m (will be av_strduped)
* @return >= 0 on success otherwise an error code <0
* @deprecated Use av_metadata_set2() instead.
*/
attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const char *value);
#endif
/**
* Sets the given tag in m, overwriting an existing tag.
* @param key tag key to add to m (will be av_strduped depending on flags)
* @param value tag value to add to m (will be av_strduped depending on flags)
* @return >= 0 on success otherwise an error code <0
*/
int av_metadata_set(AVMetadata **pm, const char *key, const char *value);
int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags);
/**
* Convert all the metadata sets from ctx according to the source and
* destination conversion tables.
* Converts all the metadata sets from ctx according to the source and
* destination conversion tables. If one of the tables is NULL, then
* tags are converted to/from ffmpeg generic tag names.
* @param d_conv destination tags format conversion table
* @param s_conv source tags format conversion table
*/
@ -114,82 +176,10 @@ void av_metadata_free(AVMetadata **m);
/* packet functions */
typedef struct AVPacket {
/**
* Presentation timestamp in time_base units; the time at which the
* decompressed packet will be presented to the user.
* Can be AV_NOPTS_VALUE if it is not stored in the file.
* pts MUST be larger or equal to dts as presentation cannot happen before
* decompression, unless one wants to view hex dumps. Some formats misuse
* the terms dts and pts/cts to mean something different. Such timestamps
* must be converted to true pts/dts before they are stored in AVPacket.
*/
int64_t pts;
/**
* Decompression timestamp in time_base units; the time at which the
* packet is decompressed.
* Can be AV_NOPTS_VALUE if it is not stored in the file.
*/
int64_t dts;
uint8_t *data;
int size;
int stream_index;
int flags;
/**
* Duration of this packet in time_base units, 0 if unknown.
* Equals next_pts - this_pts in presentation order.
*/
int duration;
void (*destruct)(struct AVPacket *);
void *priv;
int64_t pos; ///< byte position in stream, -1 if unknown
/**
* Time difference in stream time base units from the pts of this
* packet to the point at which the output from the decoder has converged
* independent from the availability of previous frames. That is, the
* frames are virtually identical no matter if decoding started from
* the very first frame or from this keyframe.
* Is AV_NOPTS_VALUE if unknown.
* This field is not the display duration of the current packet.
*
* The purpose of this field is to allow seeking in streams that have no
* keyframes in the conventional sense. It corresponds to the
* recovery point SEI in H.264 and match_time_delta in NUT. It is also
* essential for some types of subtitle streams to ensure that all
* subtitles are correctly displayed after seeking.
*/
int64_t convergence_duration;
} AVPacket;
#define PKT_FLAG_KEY 0x0001
void av_destruct_packet_nofree(AVPacket *pkt);
/**
* Default packet destructor.
*/
void av_destruct_packet(AVPacket *pkt);
/**
* Initialize optional fields of a packet with default values.
*
* @param pkt packet
*/
void av_init_packet(AVPacket *pkt);
/**
* Allocate the payload of a packet and initialize its fields with
* default values.
*
* @param pkt packet
* @param size wanted payload size
* @return 0 if OK, AVERROR_xxx otherwise
*/
int av_new_packet(AVPacket *pkt, int size);
/**
* Allocate and read the payload of a packet and initialize its fields with
* default values.
* Allocates and reads the payload of a packet and initializes its
* fields with default values.
*
* @param pkt packet
* @param size desired payload size
@ -197,23 +187,6 @@ int av_new_packet(AVPacket *pkt, int size);
*/
int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size);
/**
* @warning This is a hack - the packet memory allocation stuff is broken. The
* packet is allocated if it was not really allocated.
*/
int av_dup_packet(AVPacket *pkt);
/**
* Free a packet.
*
* @param pkt packet to free
*/
static inline void av_free_packet(AVPacket *pkt)
{
if (pkt && pkt->destruct) {
pkt->destruct(pkt);
}
}
/*************************************************/
/* fractional numbers for exact pts handling */
@ -234,8 +207,8 @@ struct AVCodecTag;
/** This structure contains the data a format has to probe a file. */
typedef struct AVProbeData {
const char *filename;
unsigned char *buf;
int buf_size;
unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */
int buf_size; /**< Size of buf except extra allocated bytes */
} AVProbeData;
#define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection
@ -274,12 +247,13 @@ typedef struct AVFormatParameters {
#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */
#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. */
#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */
#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */
typedef struct AVOutputFormat {
const char *name;
/**
* Descriptive name for the format, meant to be more human-readable
* than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro
* than name. You should use the NULL_IF_CONFIG_SMALL() macro
* to define it.
*/
const char *long_name;
@ -318,7 +292,7 @@ typedef struct AVInputFormat {
const char *name;
/**
* Descriptive name for the format, meant to be more human-readable
* than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro
* than name. You should use the NULL_IF_CONFIG_SMALL() macro
* to define it.
*/
const char *long_name;
@ -338,7 +312,10 @@ typedef struct AVInputFormat {
AVFormatParameters *ap);
/** Read one packet and put it in 'pkt'. pts and flags are also
set. 'av_new_stream' can be called only if the flag
AVFMTCTX_NOHEADER is used. */
AVFMTCTX_NOHEADER is used.
@return 0 on success, < 0 on error.
When returning an error, pkt must not have been allocated
or must be freed before returning */
int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
/** Close the stream. The AVFormatContext and AVStreams are not
freed by this function */
@ -371,18 +348,18 @@ typedef struct AVInputFormat {
/** General purpose read-only value that the format can use. */
int value;
/** Start/resume playing - only meaningful if using a network-based format
/** Starts/resumes playing - only meaningful if using a network-based format
(RTSP). */
int (*read_play)(struct AVFormatContext *);
/** Pause playing - only meaningful if using a network-based format
/** Pauses playing - only meaningful if using a network-based format
(RTSP). */
int (*read_pause)(struct AVFormatContext *);
const struct AVCodecTag * const *codec_tag;
/**
* Seek to timestamp ts.
* Seeks to timestamp ts.
* Seeking will be done so that the point from which all active streams
* can be presented successfully will be closest to ts and within min/max_ts.
* Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
@ -476,7 +453,7 @@ typedef struct AVStream {
int64_t duration;
#if LIBAVFORMAT_VERSION_INT < (53<<16)
char language[4]; /** ISO 639 3-letter language code (empty string if undefined) */
char language[4]; /** ISO 639-2/B 3-letter language code (empty string if undefined) */
#endif
/* av_read_frame() support */
@ -529,6 +506,29 @@ typedef struct AVStream {
* AV_NOPTS_VALUE by default.
*/
int64_t reference_dts;
/**
* Number of packets to buffer for codec probing
* NOT PART OF PUBLIC API
*/
#define MAX_PROBE_PACKETS 2500
int probe_packets;
/**
* last packet in packet_buffer for this stream when muxing.
* used internally, NOT PART OF PUBLIC API, dont read or write from outside of libav*
*/
struct AVPacketList *last_in_packet_buffer;
/**
* Average framerate
*/
AVRational avg_frame_rate;
/**
* Number of frames that have been demuxed during av_find_stream_info()
*/
int codec_info_nb_frames;
} AVStream;
#define AV_PROGRAM_RUNNING 1
@ -565,7 +565,11 @@ typedef struct AVChapter {
AVMetadata *metadata;
} AVChapter;
#if LIBAVFORMAT_VERSION_MAJOR < 53
#define MAX_STREAMS 20
#else
#define MAX_STREAMS 100
#endif
/**
* Format I/O context.
@ -609,8 +613,9 @@ typedef struct AVFormatContext {
It is deduced from the AVStream values. */
int64_t start_time;
/** Decoding: duration of the stream, in AV_TIME_BASE fractional
seconds. NEVER set this value directly: it is deduced from the
AVStream values. */
seconds. Only set this value if you know none of the individual stream
durations and also dont set any of them. This is deduced from the
AVStream values if not set. */
int64_t duration;
/** decoding: total file size, 0 if unknown */
int64_t file_size;
@ -632,7 +637,7 @@ typedef struct AVFormatContext {
int index_built;
int mux_rate;
int packet_size;
unsigned int packet_size;
int preload;
int max_delay;
@ -645,6 +650,10 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames.
#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index.
#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input.
#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS
#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container
#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
#define AVFMT_FLAG_RTP_HINT 0x0040 ///< Add RTP hinting to the output file
int loop_input;
/** decoding: size of data to probe; encoding: unused. */
@ -717,6 +726,22 @@ typedef struct AVFormatContext {
struct AVPacketList *packet_buffer_end;
AVMetadata *metadata;
/**
* Remaining size available for raw_packet_buffer, in bytes.
* NOT PART OF PUBLIC API
*/
#define RAW_PACKET_BUFFER_SIZE 2500000
int raw_packet_buffer_remaining_size;
/**
* Start time of the stream in real world time, in microseconds
* since the unix epoch (00:00 1st January 1970). That is, pts=0
* in the stream was captured at this real world time.
* - encoding: Set by user.
* - decoding: Unused.
*/
int64_t start_time_realtime;
} AVFormatContext;
typedef struct AVPacketList {
@ -751,22 +776,44 @@ enum CodecID av_guess_image2_codec(const char *filename);
/* utils.c */
void av_register_input_format(AVInputFormat *format);
void av_register_output_format(AVOutputFormat *format);
AVOutputFormat *guess_stream_format(const char *short_name,
#if LIBAVFORMAT_VERSION_MAJOR < 53
attribute_deprecated AVOutputFormat *guess_stream_format(const char *short_name,
const char *filename,
const char *mime_type);
AVOutputFormat *guess_format(const char *short_name,
const char *filename,
const char *mime_type);
/**
* @deprecated Use av_guess_format() instead.
*/
attribute_deprecated AVOutputFormat *guess_format(const char *short_name,
const char *filename,
const char *mime_type);
#endif
/**
* Returns the output format in the list of registered output formats
* which best matches the provided parameters, or returns NULL if
* there is no match.
*
* @param short_name if non-NULL checks if short_name matches with the
* names of the registered formats
* @param filename if non-NULL checks if filename terminates with the
* extensions of the registered formats
* @param mime_type if non-NULL checks if mime_type matches with the
* MIME type of the registered formats
*/
AVOutputFormat *av_guess_format(const char *short_name,
const char *filename,
const char *mime_type);
/**
* Guesses the codec ID based upon muxer and filename.
*/
enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
const char *filename, const char *mime_type,
enum CodecType type);
enum AVMediaType type);
/**
* Send a nice hexadecimal dump of a buffer to the specified file stream.
* Sends a nice hexadecimal dump of a buffer to the specified file stream.
*
* @param f The file stream pointer where the dump should be sent to.
* @param buf buffer
@ -777,7 +824,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
void av_hex_dump(FILE *f, uint8_t *buf, int size);
/**
* Send a nice hexadecimal dump of a buffer to the log.
* Sends a nice hexadecimal dump of a buffer to the log.
*
* @param avcl A pointer to an arbitrary struct of which the first field is a
* pointer to an AVClass struct.
@ -791,7 +838,7 @@ void av_hex_dump(FILE *f, uint8_t *buf, int size);
void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size);
/**
* Send a nice dump of a packet to the specified file stream.
* Sends a nice dump of a packet to the specified file stream.
*
* @param f The file stream pointer where the dump should be sent to.
* @param pkt packet to dump
@ -800,7 +847,7 @@ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size);
void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
/**
* Send a nice dump of a packet to the log.
* Sends a nice dump of a packet to the log.
*
* @param avcl A pointer to an arbitrary struct of which the first field is a
* pointer to an AVClass struct.
@ -812,7 +859,7 @@ void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload);
void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload);
/**
* Initialize libavformat and register all the muxers, demuxers and
* Initializes libavformat and registers all the muxers, demuxers and
* protocols. If you do not call this function, then you can select
* exactly which formats you want to support.
*
@ -834,13 +881,26 @@ unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecI
AVInputFormat *av_find_input_format(const char *short_name);
/**
* Guess file format.
* Guesses the file format.
*
* @param is_opened Whether the file is already opened; determines whether
* demuxers with or without AVFMT_NOFILE are probed.
*/
AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened);
/**
* Guesses the file format.
*
* @param is_opened Whether the file is already opened; determines whether
* demuxers with or without AVFMT_NOFILE are probed.
* @param score_max A probe score larger that this is required to accept a
* detection, the variable is set to the actual detection
* score afterwards.
* If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended
* to retry with a larger probe buffer.
*/
AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max);
/**
* Allocates all the structures needed to read an input stream.
* This does not open the needed codecs for decoding the stream[s].
@ -850,7 +910,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
AVInputFormat *fmt, AVFormatParameters *ap);
/**
* Open a media file as input. The codecs are not opened. Only the file
* Opens a media file as input. The codecs are not opened. Only the file
* header (if present) is read.
*
* @param ic_ptr The opened media file handle is put here.
@ -874,14 +934,14 @@ attribute_deprecated AVFormatContext *av_alloc_format_context(void);
#endif
/**
* Allocate an AVFormatContext.
* Allocates an AVFormatContext.
* Can be freed with av_free() but do not forget to free everything you
* explicitly allocated as well!
*/
AVFormatContext *avformat_alloc_context(void);
/**
* Read packets of a media file to get stream information. This
* Reads packets of a media file to get stream information. This
* is useful for file formats with no headers such as MPEG. This
* function also computes the real framerate in case of MPEG-2 repeat
* frame mode.
@ -896,7 +956,7 @@ AVFormatContext *avformat_alloc_context(void);
int av_find_stream_info(AVFormatContext *ic);
/**
* Read a transport packet from a media file.
* Reads a transport packet from a media file.
*
* This function is obsolete and should never be used.
* Use av_read_frame() instead.
@ -908,7 +968,7 @@ int av_find_stream_info(AVFormatContext *ic);
int av_read_packet(AVFormatContext *s, AVPacket *pkt);
/**
* Return the next frame of a stream.
* Returns the next frame of a stream.
*
* The returned packet is valid
* until the next av_read_frame() or until av_close_input_file() and
@ -929,7 +989,7 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt);
int av_read_frame(AVFormatContext *s, AVPacket *pkt);
/**
* Seek to the keyframe at timestamp.
* Seeks to the keyframe at timestamp.
* 'timestamp' in 'stream_index'.
* @param stream_index If stream_index is (-1), a default
* stream is selected, and timestamp is automatically converted
@ -943,7 +1003,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
int flags);
/**
* Seek to timestamp ts.
* Seeks to timestamp ts.
* Seeking will be done so that the point from which all active streams
* can be presented successfully will be closest to ts and within min/max_ts.
* Active streams are all streams that have AVStream.discard < AVDISCARD_ALL.
@ -962,7 +1022,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
* @param ts target timestamp
* @param max_ts largest acceptable timestamp
* @param flags flags
* @returns >=0 on success, error code otherwise
* @return >=0 on success, error code otherwise
*
* @NOTE This is part of the new seek API which is still under construction.
* Thus do not use this yet. It may change at any time, do not expect
@ -971,33 +1031,33 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp,
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
/**
* Start playing a network-based stream (e.g. RTSP stream) at the
* Starts playing a network-based stream (e.g. RTSP stream) at the
* current position.
*/
int av_read_play(AVFormatContext *s);
/**
* Pause a network-based stream (e.g. RTSP stream).
* Pauses a network-based stream (e.g. RTSP stream).
*
* Use av_read_play() to resume it.
*/
int av_read_pause(AVFormatContext *s);
/**
* Free a AVFormatContext allocated by av_open_input_stream.
* Frees a AVFormatContext allocated by av_open_input_stream.
* @param s context to free
*/
void av_close_input_stream(AVFormatContext *s);
/**
* Close a media file (but not its codecs).
* Closes a media file (but not its codecs).
*
* @param s media file handle
*/
void av_close_input_file(AVFormatContext *s);
/**
* Add a new stream to a media file.
* Adds a new stream to a media file.
*
* Can only be called in the read_header() function. If the flag
* AVFMTCTX_NOHEADER is in the format context, then new streams
@ -1010,7 +1070,7 @@ AVStream *av_new_stream(AVFormatContext *s, int id);
AVProgram *av_new_program(AVFormatContext *s, int id);
/**
* Add a new chapter.
* Adds a new chapter.
* This function is NOT part of the public API
* and should ONLY be used by demuxers.
*
@ -1026,7 +1086,7 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base,
int64_t start, int64_t end, const char *title);
/**
* Set the pts for a given stream.
* Sets the pts for a given stream.
*
* @param s stream
* @param pts_wrap_bits number of bits effectively used by the pts
@ -1040,6 +1100,7 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits,
#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward
#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes
#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes
#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number
int av_find_default_stream_index(AVFormatContext *s);
@ -1063,7 +1124,7 @@ int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags);
void ff_reduce_index(AVFormatContext *s, int stream_index);
/**
* Add an index entry into a sorted list. Update the entry if the list
* Adds an index entry into a sorted list. Updates the entry if the list
* already contains it.
*
* @param timestamp timestamp in the time base of the given stream
@ -1110,7 +1171,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index,
int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
/**
* Allocate the stream private data and write the stream header to an
* Allocates the stream private data and writes the stream header to an
* output media file.
*
* @param s media file handle
@ -1119,7 +1180,7 @@ int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
int av_write_header(AVFormatContext *s);
/**
* Write a packet to an output media file.
* Writes a packet to an output media file.
*
* The packet shall contain one audio or video frame.
* The packet must be correctly interleaved according to the container
@ -1150,7 +1211,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt);
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
/**
* Interleave a packet per dts in an output media file.
* Interleaves a packet per dts in an output media file.
*
* Packets with pkt->destruct == av_destruct_packet will be freed inside this
* function, so they cannot be used after it. Note that calling av_free_packet()
@ -1168,8 +1229,8 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
AVPacket *pkt, int flush);
/**
* @brief Write the stream trailer to an output media file and
* free the file private data.
* Writes the stream trailer to an output media file and frees the
* file private data.
*
* May only be called after a successful call to av_write_header.
*
@ -1200,7 +1261,7 @@ attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
#endif
/**
* Parses \p datestr and returns a corresponding number of microseconds.
* Parses datestr and returns a corresponding number of microseconds.
* @param datestr String representing a date or a duration.
* - If a date the syntax is:
* @code
@ -1211,7 +1272,7 @@ attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
* If the year-month-day part is not specified it takes the current
* year-month-day.
* Returns the number of microseconds since 1st of January, 1970 up to
* the time of the parsed date or INT64_MIN if \p datestr cannot be
* the time of the parsed date or INT64_MIN if datestr cannot be
* successfully parsed.
* - If a duration the syntax is:
* @code
@ -1219,10 +1280,10 @@ attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base,
* [-]S+[.m...]
* @endcode
* Returns the number of microseconds contained in a time interval
* with the specified duration or INT64_MIN if \p datestr cannot be
* with the specified duration or INT64_MIN if datestr cannot be
* successfully parsed.
* @param duration Flag which tells how to interpret \p datestr, if
* not zero \p datestr is interpreted as a duration, otherwise as a
* @param duration Flag which tells how to interpret datestr, if
* not zero datestr is interpreted as a duration, otherwise as a
* date.
*/
int64_t parse_date(const char *datestr, int duration);
@ -1260,7 +1321,7 @@ int av_get_frame_filename(char *buf, int buf_size,
const char *path, int number);
/**
* Check whether filename actually is a numbered sequence generator.
* Checks whether filename actually is a numbered sequence generator.
*
* @param filename possible numbered sequence string
* @return 1 if a valid numbered sequence string, 0 otherwise
@ -1268,7 +1329,7 @@ int av_get_frame_filename(char *buf, int buf_size,
int av_filename_number_test(const char *filename);
/**
* Generate an SDP for an RTP session.
* Generates an SDP for an RTP session.
*
* @param ac array of AVFormatContexts describing the RTP streams. If the
* array is composed by only one context, such context can contain
@ -1283,42 +1344,12 @@ int av_filename_number_test(const char *filename);
*/
int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size);
#ifdef HAVE_AV_CONFIG_H
void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem);
#ifdef __GNUC__
#define dynarray_add(tab, nb_ptr, elem)\
do {\
__typeof__(tab) _tab = (tab);\
__typeof__(elem) _elem = (elem);\
(void)sizeof(**_tab == _elem); /* check that types are compatible */\
ff_dynarray_add((intptr_t **)_tab, nb_ptr, (intptr_t)_elem);\
} while(0)
#else
#define dynarray_add(tab, nb_ptr, elem)\
do {\
ff_dynarray_add((intptr_t **)(tab), nb_ptr, (intptr_t)(elem));\
} while(0)
#endif
time_t mktimegm(struct tm *tm);
struct tm *brktimegm(time_t secs, struct tm *tm);
const char *small_strptime(const char *p, const char *fmt,
struct tm *dt);
struct in_addr;
int resolve_host(struct in_addr *sin_addr, const char *hostname);
void url_split(char *proto, int proto_size,
char *authorization, int authorization_size,
char *hostname, int hostname_size,
int *port_ptr,
char *path, int path_size,
const char *url);
int match_ext(const char *filename, const char *extensions);
#endif /* HAVE_AV_CONFIG_H */
/**
* Returns a positive value if the given filename has one of the given
* extensions, 0 otherwise.
*
* @param extensions a comma-separated list of filename extensions
*/
int av_match_ext(const char *filename, const char *extensions);
#endif /* AVFORMAT_AVFORMAT_H */

@ -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;

@ -0,0 +1,113 @@
/*
* 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 */

@ -0,0 +1,5 @@
/* 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;

@ -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
*/
/**
* @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;

@ -0,0 +1,154 @@
/*
* 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 */

@ -22,13 +22,15 @@
#define AVUTIL_PIXFMT_H
/**
* @file libavutil/pixfmt.h
* @file
* pixel format definitions
*
* @warning This file has to be considered an internal but installed
* header, so it should not be directly included in your projects.
*/
#include "libavutil/avconfig.h"
/**
* Pixel format. Notes:
*
@ -63,14 +65,11 @@ enum PixelFormat {
PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
PIX_FMT_RGB32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness
PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
PIX_FMT_RGB565, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in CPU endianness
PIX_FMT_RGB555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in CPU endianness, most significant bit to 0
PIX_FMT_GRAY8, ///< Y , 8bpp
PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black
PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white
PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette
PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG)
PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG)
@ -79,20 +78,19 @@ enum PixelFormat {
PIX_FMT_XVMC_MPEG2_IDCT,
PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
PIX_FMT_BGR32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness
PIX_FMT_BGR565, ///< packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in CPU endianness
PIX_FMT_BGR555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in CPU endianness, most significant bit to 1
PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
PIX_FMT_BGR4, ///< packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb)
PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
PIX_FMT_RGB4, ///< packed RGB 1:2:1, 4bpp, (msb)1R 2G 1B(lsb)
PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits
PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV
PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V)
PIX_FMT_NV21, ///< as above, but U and V bytes are swapped
PIX_FMT_RGB32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness
PIX_FMT_BGR32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness
PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian
PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian
@ -104,34 +102,62 @@ enum PixelFormat {
PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, big-endian
PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, little-endian
PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[0] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[0] contains a vaapi_render_state struct which contains fields extracted from headers
PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[0] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0
PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1
PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1
PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha
PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
};
#ifdef WORDS_BIGENDIAN
#define PIX_FMT_RGBA PIX_FMT_RGB32_1
#define PIX_FMT_BGRA PIX_FMT_BGR32_1
#define PIX_FMT_ARGB PIX_FMT_RGB32
#define PIX_FMT_ABGR PIX_FMT_BGR32
#define PIX_FMT_GRAY16 PIX_FMT_GRAY16BE
#define PIX_FMT_RGB48 PIX_FMT_RGB48BE
#if AV_HAVE_BIGENDIAN
# define PIX_FMT_NE(be, le) PIX_FMT_##be
#else
#define PIX_FMT_RGBA PIX_FMT_BGR32
#define PIX_FMT_BGRA PIX_FMT_RGB32
#define PIX_FMT_ARGB PIX_FMT_BGR32_1
#define PIX_FMT_ABGR PIX_FMT_RGB32_1
#define PIX_FMT_GRAY16 PIX_FMT_GRAY16LE
#define PIX_FMT_RGB48 PIX_FMT_RGB48LE
# define PIX_FMT_NE(be, le) PIX_FMT_##le
#endif
#if LIBAVUTIL_VERSION_INT < (50<<16)
#define PIX_FMT_UYVY411 PIX_FMT_UYYVYY411
#define PIX_FMT_RGBA32 PIX_FMT_RGB32
#define PIX_FMT_YUV422 PIX_FMT_YUYV422
#endif
#define PIX_FMT_RGB32 PIX_FMT_NE(ARGB, BGRA)
#define PIX_FMT_RGB32_1 PIX_FMT_NE(RGBA, ABGR)
#define PIX_FMT_BGR32 PIX_FMT_NE(ABGR, RGBA)
#define PIX_FMT_BGR32_1 PIX_FMT_NE(BGRA, ARGB)
#define PIX_FMT_GRAY16 PIX_FMT_NE(GRAY16BE, GRAY16LE)
#define PIX_FMT_RGB48 PIX_FMT_NE(RGB48BE, RGB48LE)
#define PIX_FMT_RGB565 PIX_FMT_NE(RGB565BE, RGB565LE)
#define PIX_FMT_RGB555 PIX_FMT_NE(RGB555BE, RGB555LE)
#define PIX_FMT_RGB444 PIX_FMT_NE(RGB444BE, RGB444LE)
#define PIX_FMT_BGR565 PIX_FMT_NE(BGR565BE, BGR565LE)
#define PIX_FMT_BGR555 PIX_FMT_NE(BGR555BE, BGR555LE)
#define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE)
#define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE)
#define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE)
#define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE)
#endif /* AVUTIL_PIXFMT_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 */

@ -0,0 +1,330 @@
/*
* Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SWSCALE_SWSCALE_H
#define SWSCALE_SWSCALE_H
/**
* @file
* @brief
* external api for the swscale stuff
*/
#include "libavutil/avutil.h"
#define LIBSWSCALE_VERSION_MAJOR 0
#define LIBSWSCALE_VERSION_MINOR 11
#define LIBSWSCALE_VERSION_MICRO 0
#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \
LIBSWSCALE_VERSION_MICRO)
#define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \
LIBSWSCALE_VERSION_MICRO)
#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
/**
* Returns the LIBSWSCALE_VERSION_INT constant.
*/
unsigned swscale_version(void);
/**
* Returns the libswscale build-time configuration.
*/
const char *swscale_configuration(void);
/**
* Returns the libswscale license.
*/
const char *swscale_license(void);
/* values for the flags, the stuff on the command line is different */
#define SWS_FAST_BILINEAR 1
#define SWS_BILINEAR 2
#define SWS_BICUBIC 4
#define SWS_X 8
#define SWS_POINT 0x10
#define SWS_AREA 0x20
#define SWS_BICUBLIN 0x40
#define SWS_GAUSS 0x80
#define SWS_SINC 0x100
#define SWS_LANCZOS 0x200
#define SWS_SPLINE 0x400
#define SWS_SRC_V_CHR_DROP_MASK 0x30000
#define SWS_SRC_V_CHR_DROP_SHIFT 16
#define SWS_PARAM_DEFAULT 123456
#define SWS_PRINT_INFO 0x1000
//the following 3 flags are not completely implemented
//internal chrominace subsampling info
#define SWS_FULL_CHR_H_INT 0x2000
//input subsampling info
#define SWS_FULL_CHR_H_INP 0x4000
#define SWS_DIRECT_BGR 0x8000
#define SWS_ACCURATE_RND 0x40000
#define SWS_BITEXACT 0x80000
#define SWS_CPU_CAPS_MMX 0x80000000
#define SWS_CPU_CAPS_MMX2 0x20000000
#define SWS_CPU_CAPS_3DNOW 0x40000000
#define SWS_CPU_CAPS_ALTIVEC 0x10000000
#define SWS_CPU_CAPS_BFIN 0x01000000
#define SWS_MAX_REDUCE_CUTOFF 0.002
#define SWS_CS_ITU709 1
#define SWS_CS_FCC 4
#define SWS_CS_ITU601 5
#define SWS_CS_ITU624 5
#define SWS_CS_SMPTE170M 5
#define SWS_CS_SMPTE240M 7
#define SWS_CS_DEFAULT 5
/**
* Returns a pointer to yuv<->rgb coefficients for the given colorspace
* suitable for sws_setColorspaceDetails().
*
* @param colorspace One of the SWS_CS_* macros. If invalid,
* SWS_CS_DEFAULT is used.
*/
const int *sws_getCoefficients(int colorspace);
// when used for filters they must have an odd number of elements
// coeffs cannot be shared between vectors
typedef struct {
double *coeff; ///< pointer to the list of coefficients
int length; ///< number of coefficients in the vector
} SwsVector;
// vectors can be shared
typedef struct {
SwsVector *lumH;
SwsVector *lumV;
SwsVector *chrH;
SwsVector *chrV;
} SwsFilter;
struct SwsContext;
/**
* Returns a positive value if pix_fmt is a supported input format, 0
* otherwise.
*/
int sws_isSupportedInput(enum PixelFormat pix_fmt);
/**
* Returns a positive value if pix_fmt is a supported output format, 0
* otherwise.
*/
int sws_isSupportedOutput(enum PixelFormat pix_fmt);
/**
* Frees the swscaler context swsContext.
* If swsContext is NULL, then does nothing.
*/
void sws_freeContext(struct SwsContext *swsContext);
/**
* Allocates and returns a SwsContext. You need it to perform
* scaling/conversion operations using sws_scale().
*
* @param srcW the width of the source image
* @param srcH the height of the source image
* @param srcFormat the source image format
* @param dstW the width of the destination image
* @param dstH the height of the destination image
* @param dstFormat the destination image format
* @param flags specify which algorithm and options to use for rescaling
* @return a pointer to an allocated context, or NULL in case of error
*/
struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
int dstW, int dstH, enum PixelFormat dstFormat,
int flags, SwsFilter *srcFilter,
SwsFilter *dstFilter, const double *param);
/**
* Scales the image slice in srcSlice and puts the resulting scaled
* slice in the image in dst. A slice is a sequence of consecutive
* rows in an image.
*
* Slices have to be provided in sequential order, either in
* top-bottom or bottom-top order. If slices are provided in
* non-sequential order the behavior of the function is undefined.
*
* @param context the scaling context previously created with
* sws_getContext()
* @param srcSlice the array containing the pointers to the planes of
* the source slice
* @param srcStride the array containing the strides for each plane of
* the source image
* @param srcSliceY the position in the source image of the slice to
* process, that is the number (counted starting from
* zero) in the image of the first row of the slice
* @param srcSliceH the height of the source slice, that is the number
* of rows in the slice
* @param dst the array containing the pointers to the planes of
* the destination image
* @param dstStride the array containing the strides for each plane of
* the destination image
* @return the height of the output slice
*/
int sws_scale(struct SwsContext *context, const uint8_t* const srcSlice[], const int srcStride[],
int srcSliceY, int srcSliceH, uint8_t* const dst[], const int dstStride[]);
#if LIBSWSCALE_VERSION_MAJOR < 1
/**
* @deprecated Use sws_scale() instead.
*/
int sws_scale_ordered(struct SwsContext *context, const uint8_t* const src[],
int srcStride[], int srcSliceY, int srcSliceH,
uint8_t* dst[], int dstStride[]) attribute_deprecated;
#endif
/**
* @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x]
* @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235
* @return -1 if not supported
*/
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
int srcRange, const int table[4], int dstRange,
int brightness, int contrast, int saturation);
/**
* @return -1 if not supported
*/
int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
int *srcRange, int **table, int *dstRange,
int *brightness, int *contrast, int *saturation);
/**
* Allocates and returns an uninitialized vector with length coefficients.
*/
SwsVector *sws_allocVec(int length);
/**
* Returns a normalized Gaussian curve used to filter stuff
* quality=3 is high quality, lower is lower quality.
*/
SwsVector *sws_getGaussianVec(double variance, double quality);
/**
* Allocates and returns a vector with length coefficients, all
* with the same value c.
*/
SwsVector *sws_getConstVec(double c, int length);
/**
* Allocates and returns a vector with just one coefficient, with
* value 1.0.
*/
SwsVector *sws_getIdentityVec(void);
/**
* Scales all the coefficients of a by the scalar value.
*/
void sws_scaleVec(SwsVector *a, double scalar);
/**
* Scales all the coefficients of a so that their sum equals height.
*/
void sws_normalizeVec(SwsVector *a, double height);
void sws_convVec(SwsVector *a, SwsVector *b);
void sws_addVec(SwsVector *a, SwsVector *b);
void sws_subVec(SwsVector *a, SwsVector *b);
void sws_shiftVec(SwsVector *a, int shift);
/**
* Allocates and returns a clone of the vector a, that is a vector
* with the same coefficients as a.
*/
SwsVector *sws_cloneVec(SwsVector *a);
#if LIBSWSCALE_VERSION_MAJOR < 1
/**
* @deprecated Use sws_printVec2() instead.
*/
attribute_deprecated void sws_printVec(SwsVector *a);
#endif
/**
* Prints with av_log() a textual representation of the vector a
* if log_level <= av_log_level.
*/
void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
void sws_freeVec(SwsVector *a);
SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
float lumaSharpen, float chromaSharpen,
float chromaHShift, float chromaVShift,
int verbose);
void sws_freeFilter(SwsFilter *filter);
/**
* Checks if context can be reused, otherwise reallocates a new
* one.
*
* If context is NULL, just calls sws_getContext() to get a new
* context. Otherwise, checks if the parameters are the ones already
* saved in context. If that is the case, returns the current
* context. Otherwise, frees context and gets a new context with
* the new parameters.
*
* Be warned that srcFilter and dstFilter are not checked, they
* are assumed to remain the same.
*/
struct SwsContext *sws_getCachedContext(struct SwsContext *context,
int srcW, int srcH, enum PixelFormat srcFormat,
int dstW, int dstH, enum PixelFormat dstFormat,
int flags, SwsFilter *srcFilter,
SwsFilter *dstFilter, const double *param);
/**
* Converts an 8bit paletted frame into a frame with a color depth of 32-bits.
*
* The output frame will have the same packed format as the palette.
*
* @param src source frame buffer
* @param dst destination frame buffer
* @param num_pixels number of pixels to convert
* @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
*/
void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
/**
* Converts an 8bit paletted frame into a frame with a color depth of 24 bits.
*
* With the palette format "ABCD", the destination frame ends up with the format "ABC".
*
* @param src source frame buffer
* @param dst destination frame buffer
* @param num_pixels number of pixels to convert
* @param palette array with [256] entries, which must match color arrangement (RGB or BGR) of src
*/
void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
#endif /* SWSCALE_SWSCALE_H */

@ -1,79 +0,0 @@
/*
* 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 */

@ -1,147 +0,0 @@
/*
* 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 */

@ -1,79 +0,0 @@
/*
* 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 */

@ -1,282 +0,0 @@
/*
* RTSP definitions
* Copyright (c) 2002 Fabrice Bellard
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FFMPEG_RTSP_H
#define FFMPEG_RTSP_H
#include <stdint.h>
#include "avformat.h"
#include "rtspcodes.h"
#include "rtpdec.h"
#include "network.h"
/**
* Network layer over which RTP/etc packet data will be transported.
*/
enum RTSPLowerTransport {
RTSP_LOWER_TRANSPORT_UDP = 0, /**< UDP/unicast */
RTSP_LOWER_TRANSPORT_TCP = 1, /**< TCP; interleaved in RTSP */
RTSP_LOWER_TRANSPORT_UDP_MULTICAST = 2, /**< UDP/multicast */
RTSP_LOWER_TRANSPORT_NB
};
/**
* Packet profile of the data that we will be receiving. Real servers
* commonly send RDT (although they can sometimes send RTP as well),
* whereas most others will send RTP.
*/
enum RTSPTransport {
RTSP_TRANSPORT_RTP, /**< Standards-compliant RTP */
RTSP_TRANSPORT_RDT, /**< Realmedia Data Transport */
RTSP_TRANSPORT_NB
};
#define RTSP_DEFAULT_PORT 554
#define RTSP_MAX_TRANSPORTS 8
#define RTSP_TCP_MAX_PACKET_SIZE 1472
#define RTSP_DEFAULT_NB_AUDIO_CHANNELS 2
#define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100
#define RTSP_RTP_PORT_MIN 5000
#define RTSP_RTP_PORT_MAX 10000
/**
* This describes a single item in the "Transport:" line of one stream as
* negotiated by the SETUP RTSP command. Multiple transports are comma-
* separated ("Transport: x-read-rdt/tcp;interleaved=0-1,rtp/avp/udp;
* client_port=1000-1001;server_port=1800-1801") and described in separate
* RTSPTransportFields.
*/
typedef struct RTSPTransportField {
/** interleave ids, if TCP transport; each TCP/RTSP data packet starts
* with a '$', stream length and stream ID. If the stream ID is within
* the range of this interleaved_min-max, then the packet belongs to
* this stream. */
int interleaved_min, interleaved_max;
/** UDP multicast port range; the ports to which we should connect to
* receive multicast UDP data. */
int port_min, port_max;
/** UDP client ports; these should be the local ports of the UDP RTP
* (and RTCP) sockets over which we receive RTP/RTCP data. */
int client_port_min, client_port_max;
/** UDP unicast server port range; the ports to which we should connect
* to receive unicast UDP RTP/RTCP data. */
int server_port_min, server_port_max;
/** time-to-live value (required for multicast); the amount of HOPs that
* packets will be allowed to make before being discarded. */
int ttl;
uint32_t destination; /**< destination IP address */
/** data/packet transport protocol; e.g. RTP or RDT */
enum RTSPTransport transport;
/** network layer transport protocol; e.g. TCP or UDP uni-/multicast */
enum RTSPLowerTransport lower_transport;
} RTSPTransportField;
/**
* This describes the server response to each RTSP command.
*/
typedef struct RTSPMessageHeader {
/** length of the data following this header */
int content_length;
enum RTSPStatusCode status_code; /**< response code from server */
/** number of items in the 'transports' variable below */
int nb_transports;
/** Time range of the streams that the server will stream. In
* AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */
int64_t range_start, range_end;
/** describes the complete "Transport:" line of the server in response
* to a SETUP RTSP command by the client */
RTSPTransportField transports[RTSP_MAX_TRANSPORTS];
int seq; /**< sequence number */
/** the "Session:" field. This value is initially set by the server and
* should be re-transmitted by the client in every RTSP command. */
char session_id[512];
/** the "RealChallenge1:" field from the server */
char real_challenge[64];
/** the "Server: field, which can be used to identify some special-case
* servers that are not 100% standards-compliant. We use this to identify
* Windows Media Server, which has a value "WMServer/v.e.r.sion", where
* version is a sequence of digits (e.g. 9.0.0.3372). Helix/Real servers
* use something like "Helix [..] Server Version v.e.r.sion (platform)
* (RealServer compatible)" or "RealServer Version v.e.r.sion (platform)",
* where platform is the output of $uname -msr | sed 's/ /-/g'. */
char server[64];
} RTSPMessageHeader;
/**
* Client state, i.e. whether we are currently receiving data (PLAYING) or
* setup-but-not-receiving (PAUSED). State can be changed in applications
* by calling av_read_play/pause().
*/
enum RTSPClientState {
RTSP_STATE_IDLE, /**< not initialized */
RTSP_STATE_PLAYING, /**< initialized and receiving data */
RTSP_STATE_PAUSED, /**< initialized, but not receiving data */
};
/**
* Identifies particular servers that require special handling, such as
* standards-incompliant "Transport:" lines in the SETUP request.
*/
enum RTSPServerType {
RTSP_SERVER_RTP, /**< Standards-compliant RTP-server */
RTSP_SERVER_REAL, /**< Realmedia-style server */
RTSP_SERVER_WMS, /**< Windows Media server */
RTSP_SERVER_NB
};
/**
* Private data for the RTSP demuxer.
*/
typedef struct RTSPState {
URLContext *rtsp_hd; /* RTSP TCP connexion handle */
/** number of items in the 'rtsp_streams' variable */
int nb_rtsp_streams;
struct RTSPStream **rtsp_streams; /**< streams in this session */
/** indicator of whether we are currently receiving data from the
* server. Basically this isn't more than a simple cache of the
* last PLAY/PAUSE command sent to the server, to make sure we don't
* send 2x the same unexpectedly or commands in the wrong state. */
enum RTSPClientState state;
/** the seek value requested when calling av_seek_frame(). This value
* is subsequently used as part of the "Range" parameter when emitting
* the RTSP PLAY command. If we are currently playing, this command is
* called instantly. If we are currently paused, this command is called
* whenever we resume playback. Either way, the value is only used once,
* see rtsp_read_play() and rtsp_read_seek(). */
int64_t seek_timestamp;
/* XXX: currently we use unbuffered input */
// ByteIOContext rtsp_gb;
int seq; /**< RTSP command sequence number */
/** copy of RTSPMessageHeader->session_id, i.e. the server-provided session
* identifier that the client should re-transmit in each RTSP command */
char session_id[512];
/** the negotiated data/packet transport protocol; e.g. RTP or RDT */
enum RTSPTransport transport;
/** the negotiated network layer transport protocol; e.g. TCP or UDP
* uni-/multicast */
enum RTSPLowerTransport lower_transport;
/** brand of server that we're talking to; e.g. WMS, REAL or other.
* Detected based on the value of RTSPMessageHeader->server or the presence
* of RTSPMessageHeader->real_challenge */
enum RTSPServerType server_type;
/** The last reply of the server to a RTSP command */
char last_reply[2048]; /* XXX: allocate ? */
/** RTSPStream->transport_priv of the last stream that we read a
* packet from */
void *cur_transport_priv;
/** The following are used for Real stream selection */
//@{
/** whether we need to send a "SET_PARAMETER Subscribe:" command */
int need_subscription;
/** stream setup during the last frame read. This is used to detect if
* we need to subscribe or unsubscribe to any new streams. */
enum AVDiscard real_setup_cache[MAX_STREAMS];
/** the last value of the "SET_PARAMETER Subscribe:" RTSP command.
* this is used to send the same "Unsubscribe:" if stream setup changed,
* before sending a new "Subscribe:" command. */
char last_subscription[1024];
//@}
} RTSPState;
/**
* Describes a single stream, as identified by a single m= line block in the
* SDP content. In the case of RDT, one RTSPStream can represent multiple
* AVStreams. In this case, each AVStream in this set has similar content
* (but different codec/bitrate).
*/
typedef struct RTSPStream {
URLContext *rtp_handle; /**< RTP stream handle (if UDP) */
void *transport_priv; /**< RTP/RDT parse context */
/** corresponding stream index, if any. -1 if none (MPEG2TS case) */
int stream_index;
/** interleave IDs; copies of RTSPTransportField->interleaved_min/max
* for the selected transport. Only used for TCP. */
int interleaved_min, interleaved_max;
char control_url[1024]; /**< url for this stream (from SDP) */
/** The following are used only in SDP, not RTSP */
//@{
int sdp_port; /**< port (from SDP content) */
struct in_addr sdp_ip; /**< IP address (from SDP content) */
int sdp_ttl; /**< IP Time-To-Live (from SDP content) */
int sdp_payload_type; /**< payload type */
//@}
/** rtp payload parsing infos from SDP (i.e. mapping between private
* payload IDs and media-types (string), so that we can derive what
* type of payload we're dealing with (and how to parse it). */
RTPPayloadData rtp_payload_data;
/** The following are used for dynamic protocols (rtp_*.c/rdt.c) */
//@{
/** handler structure */
RTPDynamicProtocolHandler *dynamic_handler;
/** private data associated with the dynamic protocol */
PayloadContext *dynamic_protocol_context;
//@}
} RTSPStream;
int rtsp_init(void);
void rtsp_parse_line(RTSPMessageHeader *reply, const char *buf);
#if LIBAVFORMAT_VERSION_INT < (53 << 16)
extern int rtsp_default_protocols;
#endif
extern int rtsp_rtp_port_min;
extern int rtsp_rtp_port_max;
int rtsp_pause(AVFormatContext *s);
int rtsp_resume(AVFormatContext *s);
#endif /* FFMPEG_RTSP_H */

@ -1,40 +0,0 @@
/*
* 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_ ]

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.

@ -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

@ -146,6 +146,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_OPENCV_GCC_VERSION ${CMAKE_OPENCV_GCC_VERSION_MAJOR}${CMAKE_OPENCV_GCC_VERSION_MINOR})
math(EXPR CMAKE_OPENCV_GCC_VERSION_NUM "${CMAKE_OPENCV_GCC_VERSION_MAJOR}*100 + ${CMAKE_OPENCV_GCC_VERSION_MINOR}")
message(STATUS "Detected version of GNU GCC: ${CMAKE_OPENCV_GCC_VERSION} (${CMAKE_OPENCV_GCC_VERSION_NUM})")
if(WIN32)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
set(MINGW64 1)
endif()
endif()
endif()
# ----------------------------------------------------------------------------
@ -638,7 +648,9 @@ endif()
if (WIN32 AND WITH_VIDEOINPUT)
if(CMAKE_CXX_COMPILER MATCHES "dw2")
else()
set(HAVE_VIDEOINPUT 1)
if(NOT MINGW64)
set(HAVE_VIDEOINPUT 1)
endif()
endif()
endif()
@ -805,12 +817,6 @@ endif()
if(CMAKE_COMPILER_IS_GNUCXX)
if(WIN32)
if(CMAKE_CXX_COMPILER MATCHES "64")
set(MINGW64 1)
endif()
endif()
# High level of warnings.
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wall")

@ -1,7 +1,10 @@
project(opencv_ffmpeg)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
include_directories("${CMAKE_SOURCE_DIR}/3rdparty/include")
include_directories(
"${CMAKE_SOURCE_DIR}/3rdparty/include"
"${CMAKE_SOURCE_DIR}/3rdparty/include/ffmpeg_"
)
include_directories(
"${CMAKE_SOURCE_DIR}/modules/highgui/src"
"${CMAKE_SOURCE_DIR}/modules/core/include"
@ -17,18 +20,20 @@ add_dependencies(${the_target} opencv_core)
target_link_libraries(${the_target} opencv_core)
if (NOT MSVC)
target_link_libraries(${the_target}
${CMAKE_SOURCE_DIR}/3rdparty/lib/libgcc_.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libmingwex_.a)
#target_link_libraries(${the_target}
# ${CMAKE_SOURCE_DIR}/3rdparty/lib/libgcc_.a
# ${CMAKE_SOURCE_DIR}/3rdparty/lib/libmingwex_.a)
if(WIN32 AND MINGW64)
target_link_libraries(${the_target} ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavformat64.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libavcodec64.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libavutil64.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libswscale64.a
libws2_32.a)
else()
target_link_libraries(${the_target} ${CMAKE_SOURCE_DIR}/3rdparty/lib/libavformat.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libavcodec.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libavutil.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libswscale.a
${CMAKE_SOURCE_DIR}/3rdparty/lib/libwsock32_.a)
endif()
endif ()

@ -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")

@ -60,9 +60,10 @@ extern "C" {
#endif
#ifdef WIN32
#include <ffmpeg_/avformat.h>
#include <ffmpeg_/avcodec.h>
#include <ffmpeg_/imgconvert.h>
#define HAVE_FFMPEG_SWSCALE 1
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
#else
// if the header path is not specified explicitly, let's deduce it

Loading…
Cancel
Save