mirror of https://github.com/opencv/opencv.git
parent
d8ad4e2267
commit
26c6b955a8
54 changed files with 2576 additions and 1335 deletions
@ -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 */ |
File diff suppressed because it is too large
Load Diff
@ -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 */ |
@ -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 */ |
@ -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 */ |
@ -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 */ |
@ -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 */ |
@ -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 */ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue