diff --git a/3rdparty/ffmpeg/make.bat b/3rdparty/ffmpeg/make.bat index f4f959268..fdc39b379 100644 --- a/3rdparty/ffmpeg/make.bat +++ b/3rdparty/ffmpeg/make.bat @@ -1,3 +1,3 @@ rem gcc -Wall -shared -o opencv_ffmpeg.dll -O3 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat -lavcodec -lavdevice -lswscale -lavutil -lwsock32 -lpthreadGÑE2 -gcc -Wall -shared -o opencv_ffmpeg.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat -lavcodec -lavdevice -lswscale -lavutil -lwsock32 -set path=c:\apps\mingw64\bin;%path% & gcc -Wall -shared -o opencv_ffmpeg_64.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat64 -lavcodec64 -lavdevice64 -lswscale64 -lavutil64 -lavcore64 -lwsock32 \ No newline at end of file +rem set path=c:\dev\msys32\bin;%path% & gcc -Wall -shared -o opencv_ffmpeg.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat -lavcodec -lavdevice -lswscale -lavutil -lwsock32 +set path=c:\dev\msys64\bin;%path% & gcc -m64 -Wall -shared -o opencv_ffmpeg_64.dll -O2 -x c++ -I../include -I../include/ffmpeg_ -I../../modules/highgui/src ffopencv.c -L../lib -lavformat64 -lavcodec64 -lavdevice64 -lswscale64 -lavutil64 -lavcore64 -lwsock32 -lws2_32 \ No newline at end of file diff --git a/3rdparty/ffmpeg/opencv_ffmpeg.dll b/3rdparty/ffmpeg/opencv_ffmpeg.dll index 8da9a659c..d47b0df37 100644 Binary files a/3rdparty/ffmpeg/opencv_ffmpeg.dll and b/3rdparty/ffmpeg/opencv_ffmpeg.dll differ diff --git a/3rdparty/ffmpeg/opencv_ffmpeg_64.dll b/3rdparty/ffmpeg/opencv_ffmpeg_64.dll index 2ca3af548..86a075813 100644 Binary files a/3rdparty/ffmpeg/opencv_ffmpeg_64.dll and b/3rdparty/ffmpeg/opencv_ffmpeg_64.dll differ diff --git a/3rdparty/include/ffmpeg_/libavcodec/avcodec.h b/3rdparty/include/ffmpeg_/libavcodec/avcodec.h index 974e87cc5..7c8228fb0 100644 --- a/3rdparty/include/ffmpeg_/libavcodec/avcodec.h +++ b/3rdparty/include/ffmpeg_/libavcodec/avcodec.h @@ -27,28 +27,14 @@ */ #include +#include "libavutil/samplefmt.h" #include "libavutil/avutil.h" +#include "libavutil/cpu.h" -#define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 72 -#define LIBAVCODEC_VERSION_MICRO 2 - -#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ - LIBAVCODEC_VERSION_MINOR, \ - LIBAVCODEC_VERSION_MICRO) -#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ - LIBAVCODEC_VERSION_MINOR, \ - LIBAVCODEC_VERSION_MICRO) -#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT - -#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) - -#define AV_NOPTS_VALUE INT64_C(0x8000000000000000) -#define AV_TIME_BASE 1000000 -#define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} +#include "libavcodec/version.h" /** - * Identifies the syntax and semantics of the bitstream. + * Identify the syntax and semantics of the bitstream. * The principle is roughly: * Two decoders with the same ID can decode the same streams. * Two encoders with the same ID can encode compatible streams. @@ -125,9 +111,6 @@ enum CodecID { CODEC_ID_QDRAW, CODEC_ID_VIXL, CODEC_ID_QPEG, -#if LIBAVCODEC_VERSION_MAJOR < 53 - CODEC_ID_XVID, -#endif CODEC_ID_PNG, CODEC_ID_PPM, CODEC_ID_PBM, @@ -211,6 +194,17 @@ enum CodecID { CODEC_ID_KGV1, CODEC_ID_YOP, CODEC_ID_VP8, + CODEC_ID_PICTOR, + CODEC_ID_ANSI, + CODEC_ID_A64_MULTI, + CODEC_ID_A64_MULTI5, + CODEC_ID_R10K, + CODEC_ID_MXPEG, + CODEC_ID_LAGARITH, + CODEC_ID_PRORES, + CODEC_ID_JV, + CODEC_ID_DFA, + CODEC_ID_8SVX_RAW, /* various PCM "codecs" */ CODEC_ID_PCM_S16LE= 0x10000, @@ -238,6 +232,8 @@ enum CodecID { CODEC_ID_PCM_F64BE, CODEC_ID_PCM_F64LE, CODEC_ID_PCM_BLURAY, + CODEC_ID_PCM_LXF, + CODEC_ID_S302M, /* various ADPCM codecs */ CODEC_ID_ADPCM_IMA_QT= 0x11000, @@ -268,6 +264,7 @@ enum CodecID { CODEC_ID_ADPCM_EA_XAS, CODEC_ID_ADPCM_EA_MAXIS_XA, CODEC_ID_ADPCM_IMA_ISS, + CODEC_ID_ADPCM_G722, /* AMR */ CODEC_ID_AMR_NB= 0x12000, @@ -336,6 +333,9 @@ enum CodecID { CODEC_ID_ATRAC1, CODEC_ID_BINKAUDIO_RDFT, CODEC_ID_BINKAUDIO_DCT, + CODEC_ID_AAC_LATM, + CODEC_ID_QDMC, + CODEC_ID_CELT, /* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= 0x17000, @@ -346,6 +346,8 @@ enum CodecID { CODEC_ID_MOV_TEXT, CODEC_ID_HDMV_PGS_SUBTITLE, CODEC_ID_DVB_TELETEXT, + CODEC_ID_SRT, + CODEC_ID_MICRODVD, /* other specific kind of codecs (generally used for attachments) */ CODEC_ID_TTF= 0x18000, @@ -354,77 +356,68 @@ enum CodecID { CODEC_ID_MPEG2TS= 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS * stream (only used by libavformat) */ + CODEC_ID_FFMETADATA=0x21000, ///< Dummy codec for streams containing only metadata information. }; -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define CodecType AVMediaType +#if FF_API_OLD_SAMPLE_FMT +#define SampleFormat AVSampleFormat -#define CODEC_TYPE_UNKNOWN AVMEDIA_TYPE_UNKNOWN -#define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO -#define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO -#define CODEC_TYPE_DATA AVMEDIA_TYPE_DATA -#define CODEC_TYPE_SUBTITLE AVMEDIA_TYPE_SUBTITLE -#define CODEC_TYPE_ATTACHMENT AVMEDIA_TYPE_ATTACHMENT -#define CODEC_TYPE_NB AVMEDIA_TYPE_NB +#define SAMPLE_FMT_NONE AV_SAMPLE_FMT_NONE +#define SAMPLE_FMT_U8 AV_SAMPLE_FMT_U8 +#define SAMPLE_FMT_S16 AV_SAMPLE_FMT_S16 +#define SAMPLE_FMT_S32 AV_SAMPLE_FMT_S32 +#define SAMPLE_FMT_FLT AV_SAMPLE_FMT_FLT +#define SAMPLE_FMT_DBL AV_SAMPLE_FMT_DBL +#define SAMPLE_FMT_NB AV_SAMPLE_FMT_NB #endif -/** - * all in native-endian format - */ -enum SampleFormat { - SAMPLE_FMT_NONE = -1, - SAMPLE_FMT_U8, ///< unsigned 8 bits - SAMPLE_FMT_S16, ///< signed 16 bits - SAMPLE_FMT_S32, ///< signed 32 bits - SAMPLE_FMT_FLT, ///< float - SAMPLE_FMT_DBL, ///< double - SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec -}; +#if FF_API_OLD_AUDIOCONVERT +#include "libavutil/audioconvert.h" /* Audio channel masks */ -#define CH_FRONT_LEFT 0x00000001 -#define CH_FRONT_RIGHT 0x00000002 -#define CH_FRONT_CENTER 0x00000004 -#define CH_LOW_FREQUENCY 0x00000008 -#define CH_BACK_LEFT 0x00000010 -#define CH_BACK_RIGHT 0x00000020 -#define CH_FRONT_LEFT_OF_CENTER 0x00000040 -#define CH_FRONT_RIGHT_OF_CENTER 0x00000080 -#define CH_BACK_CENTER 0x00000100 -#define CH_SIDE_LEFT 0x00000200 -#define CH_SIDE_RIGHT 0x00000400 -#define CH_TOP_CENTER 0x00000800 -#define CH_TOP_FRONT_LEFT 0x00001000 -#define CH_TOP_FRONT_CENTER 0x00002000 -#define CH_TOP_FRONT_RIGHT 0x00004000 -#define CH_TOP_BACK_LEFT 0x00008000 -#define CH_TOP_BACK_CENTER 0x00010000 -#define CH_TOP_BACK_RIGHT 0x00020000 -#define CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. -#define CH_STEREO_RIGHT 0x40000000 ///< See CH_STEREO_LEFT. +#define CH_FRONT_LEFT AV_CH_FRONT_LEFT +#define CH_FRONT_RIGHT AV_CH_FRONT_RIGHT +#define CH_FRONT_CENTER AV_CH_FRONT_CENTER +#define CH_LOW_FREQUENCY AV_CH_LOW_FREQUENCY +#define CH_BACK_LEFT AV_CH_BACK_LEFT +#define CH_BACK_RIGHT AV_CH_BACK_RIGHT +#define CH_FRONT_LEFT_OF_CENTER AV_CH_FRONT_LEFT_OF_CENTER +#define CH_FRONT_RIGHT_OF_CENTER AV_CH_FRONT_RIGHT_OF_CENTER +#define CH_BACK_CENTER AV_CH_BACK_CENTER +#define CH_SIDE_LEFT AV_CH_SIDE_LEFT +#define CH_SIDE_RIGHT AV_CH_SIDE_RIGHT +#define CH_TOP_CENTER AV_CH_TOP_CENTER +#define CH_TOP_FRONT_LEFT AV_CH_TOP_FRONT_LEFT +#define CH_TOP_FRONT_CENTER AV_CH_TOP_FRONT_CENTER +#define CH_TOP_FRONT_RIGHT AV_CH_TOP_FRONT_RIGHT +#define CH_TOP_BACK_LEFT AV_CH_TOP_BACK_LEFT +#define CH_TOP_BACK_CENTER AV_CH_TOP_BACK_CENTER +#define CH_TOP_BACK_RIGHT AV_CH_TOP_BACK_RIGHT +#define CH_STEREO_LEFT AV_CH_STEREO_LEFT +#define CH_STEREO_RIGHT AV_CH_STEREO_RIGHT /** Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests the channel order of the decoder output to be the native codec channel order. */ -#define CH_LAYOUT_NATIVE 0x8000000000000000LL +#define CH_LAYOUT_NATIVE AV_CH_LAYOUT_NATIVE /* Audio channel convenience macros */ -#define CH_LAYOUT_MONO (CH_FRONT_CENTER) -#define CH_LAYOUT_STEREO (CH_FRONT_LEFT|CH_FRONT_RIGHT) -#define CH_LAYOUT_2_1 (CH_LAYOUT_STEREO|CH_BACK_CENTER) -#define CH_LAYOUT_SURROUND (CH_LAYOUT_STEREO|CH_FRONT_CENTER) -#define CH_LAYOUT_4POINT0 (CH_LAYOUT_SURROUND|CH_BACK_CENTER) -#define CH_LAYOUT_2_2 (CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT) -#define CH_LAYOUT_QUAD (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_5POINT0 (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIGHT) -#define CH_LAYOUT_5POINT1 (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY) -#define CH_LAYOUT_5POINT0_BACK (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_5POINT1_BACK (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY) -#define CH_LAYOUT_7POINT0 (CH_LAYOUT_5POINT0|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_7POINT1 (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT) -#define CH_LAYOUT_7POINT1_WIDE (CH_LAYOUT_5POINT1_BACK|\ - CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER) -#define CH_LAYOUT_STEREO_DOWNMIX (CH_STEREO_LEFT|CH_STEREO_RIGHT) +#define CH_LAYOUT_MONO AV_CH_LAYOUT_MONO +#define CH_LAYOUT_STEREO AV_CH_LAYOUT_STEREO +#define CH_LAYOUT_2_1 AV_CH_LAYOUT_2_1 +#define CH_LAYOUT_SURROUND AV_CH_LAYOUT_SURROUND +#define CH_LAYOUT_4POINT0 AV_CH_LAYOUT_4POINT0 +#define CH_LAYOUT_2_2 AV_CH_LAYOUT_2_2 +#define CH_LAYOUT_QUAD AV_CH_LAYOUT_QUAD +#define CH_LAYOUT_5POINT0 AV_CH_LAYOUT_5POINT0 +#define CH_LAYOUT_5POINT1 AV_CH_LAYOUT_5POINT1 +#define CH_LAYOUT_5POINT0_BACK AV_CH_LAYOUT_5POINT0_BACK +#define CH_LAYOUT_5POINT1_BACK AV_CH_LAYOUT_5POINT1_BACK +#define CH_LAYOUT_7POINT0 AV_CH_LAYOUT_7POINT0 +#define CH_LAYOUT_7POINT1 AV_CH_LAYOUT_7POINT1 +#define CH_LAYOUT_7POINT1_WIDE AV_CH_LAYOUT_7POINT1_WIDE +#define CH_LAYOUT_STEREO_DOWNMIX AV_CH_LAYOUT_STEREO_DOWNMIX +#endif /* in bytes */ #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio @@ -525,6 +518,33 @@ enum AVChromaLocation{ AVCHROMA_LOC_NB , ///< Not part of ABI }; +#if FF_API_FLAC_GLOBAL_OPTS +/** + * LPC analysis type + */ +attribute_deprecated enum AVLPCType { + AV_LPC_TYPE_DEFAULT = -1, ///< use the codec default LPC type + AV_LPC_TYPE_NONE = 0, ///< do not use LPC prediction or use all zero coefficients + AV_LPC_TYPE_FIXED = 1, ///< fixed LPC coefficients + AV_LPC_TYPE_LEVINSON = 2, ///< Levinson-Durbin recursion + AV_LPC_TYPE_CHOLESKY = 3, ///< Cholesky factorization + AV_LPC_TYPE_NB , ///< Not part of ABI +}; +#endif + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + typedef struct RcOverride{ int start_frame; int end_frame; @@ -598,6 +618,7 @@ typedef struct RcOverride{ #define CODEC_FLAG2_MBTREE 0x00040000 ///< Use macroblock tree ratecontrol (x264 only) #define CODEC_FLAG2_PSY 0x00080000 ///< Use psycho visual optimizations. #define CODEC_FLAG2_SSIM 0x00100000 ///< Compute SSIM during encoding, error[] values are undefined. +#define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of intra blocks instead of keyframes. /* Unsupported options : * Syntax Arithmetic coding (SAC) @@ -649,6 +670,28 @@ typedef struct RcOverride{ * encoders */ #define CODEC_CAP_EXPERIMENTAL 0x0200 +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define CODEC_CAP_CHANNEL_CONF 0x0400 + +/** + * Codec is able to deal with negative linesizes + */ +#define CODEC_CAP_NEG_LINESIZES 0x0800 + +/** + * Codec supports frame-level multithreading. + */ +#define CODEC_CAP_FRAME_THREADS 0x1000 +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define CODEC_CAP_SLICE_THREADS 0x2000 +/** + * Codec is lossless. + */ +#define CODEC_CAP_LOSSLESS 0x80000000 //The following defines may change, don't expect compatibility if you use them. #define MB_TYPE_INTRA4x4 0x0001 @@ -731,7 +774,7 @@ typedef struct AVPanScan{ * - encoding: Set by libavcodec. for coded_picture (and set by user for input).\ * - decoding: Set by libavcodec.\ */\ - int pict_type;\ + enum AVPictureType pict_type;\ \ /**\ * presentation timestamp in time_base units (time when frame should be shown to user)\ @@ -916,8 +959,13 @@ typedef struct AVPanScan{ int8_t *ref_index[2];\ \ /**\ - * reordered opaque 64bit number (generally a PTS) from AVCodecContext.reordered_opaque\ - * output in AVFrame.reordered_opaque\ + * reordered opaque 64bit (generally an integer or a double precision float\ + * PTS but can be anything). \ + * The user sets AVCodecContext.reordered_opaque to represent the input at\ + * that time,\ + * the decoder reorders values as needed and sets AVFrame.reordered_opaque\ + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque \ + * @deprecated in favor of pkt_pts\ * - encoding: unused\ * - decoding: Read by user.\ */\ @@ -929,6 +977,71 @@ typedef struct AVPanScan{ * - decoding: Set by libavcodec\ */\ void *hwaccel_picture_private;\ +\ + /**\ + * reordered pts from the last AVPacket that has been input into the decoder\ + * - encoding: unused\ + * - decoding: Read by user.\ + */\ + int64_t pkt_pts;\ +\ + /**\ + * dts from the last AVPacket that has been input into the decoder\ + * - encoding: unused\ + * - decoding: Read by user.\ + */\ + int64_t pkt_dts;\ +\ + /**\ + * the AVCodecContext which ff_thread_get_buffer() was last called on\ + * - encoding: Set by libavcodec.\ + * - decoding: Set by libavcodec.\ + */\ + struct AVCodecContext *owner;\ +\ + /**\ + * used by multithreading to store frame-specific info\ + * - encoding: Set by libavcodec.\ + * - decoding: Set by libavcodec.\ + */\ + void *thread_opaque;\ +\ + /**\ + * frame timestamp estimated using various heuristics, in stream time base\ + * - encoding: unused\ + * - decoding: set by libavcodec, read by user.\ + */\ + int64_t best_effort_timestamp;\ +\ + /**\ + * reordered pos from the last AVPacket that has been input into the decoder\ + * - encoding: unused\ + * - decoding: Read by user.\ + */\ + int64_t pkt_pos;\ +\ + /**\ + * reordered sample aspect ratio for the video frame, 0/1 if unknown\unspecified + * - encoding: unused\ + * - decoding: Read by user.\ + */\ + AVRational sample_aspect_ratio;\ +\ + /**\ + * width and height of the video frame\ + * - encoding: unused\ + * - decoding: Read by user.\ + */\ + int width, height;\ +\ + /**\ + * format of the frame, -1 if unknown or unset\ + * It should be cast to the corresponding enum (enum PixelFormat\ + * for video, enum AVSampleFormat for audio)\ + * - encoding: unused\ + * - decoding: Read by user.\ + */\ + int format;\ #define FF_QSCALE_TYPE_MPEG1 0 @@ -941,20 +1054,26 @@ typedef struct AVPanScan{ #define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared. #define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything. - -#define FF_I_TYPE 1 ///< Intra -#define FF_P_TYPE 2 ///< Predicted -#define FF_B_TYPE 3 ///< Bi-dir predicted -#define FF_S_TYPE 4 ///< S(GMC)-VOP MPEG4 -#define FF_SI_TYPE 5 ///< Switching Intra -#define FF_SP_TYPE 6 ///< Switching Predicted -#define FF_BI_TYPE 7 +#if FF_API_OLD_FF_PICT_TYPES +/* DEPRECATED, directly use the AV_PICTURE_TYPE_* enum values */ +#define FF_I_TYPE AV_PICTURE_TYPE_I ///< Intra +#define FF_P_TYPE AV_PICTURE_TYPE_P ///< Predicted +#define FF_B_TYPE AV_PICTURE_TYPE_B ///< Bi-dir predicted +#define FF_S_TYPE AV_PICTURE_TYPE_S ///< S(GMC)-VOP MPEG4 +#define FF_SI_TYPE AV_PICTURE_TYPE_SI ///< Switching Intra +#define FF_SP_TYPE AV_PICTURE_TYPE_SP ///< Switching Predicted +#define FF_BI_TYPE AV_PICTURE_TYPE_BI +#endif #define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore). #define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). +enum AVPacketSideDataType { + AV_PKT_DATA_PALETTE, +}; + typedef struct AVPacket { /** * Presentation timestamp in AVStream->time_base units; the time at which @@ -976,6 +1095,17 @@ typedef struct AVPacket { int size; int stream_index; int flags; + /** + * Additional packet data that can be provided by the container. + * Packet can contain several types of side information. + */ + struct { + uint8_t *data; + int size; + enum AVPacketSideDataType type; + } *side_data; + int side_data_elems; + /** * Duration of this packet in AVStream->time_base units, 0 if unknown. * Equals next_pts - this_pts in presentation order. @@ -993,6 +1123,8 @@ typedef struct AVPacket { * 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. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. * * The purpose of this field is to allow seeking in streams that have no * keyframes in the conventional sense. It corresponds to the @@ -1003,9 +1135,6 @@ typedef struct AVPacket { int64_t convergence_duration; } AVPacket; #define AV_PKT_FLAG_KEY 0x0001 -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define PKT_FLAG_KEY AV_PKT_FLAG_KEY -#endif /** * Audio Video Frame. @@ -1119,24 +1248,22 @@ typedef struct AVCodecContext { /** * Pixel format, see PIX_FMT_xxx. + * May be set by the demuxer if known from headers. + * May be overriden by the decoder if it knows better. * - encoding: Set by user. - * - decoding: Set by libavcodec. + * - decoding: Set by user if known, overridden by libavcodec if known */ enum PixelFormat pix_fmt; - /** - * Frame rate emulation. If not zero, the lower layer (i.e. format handler) - * has to read frames at native frame rate. - * - encoding: Set by user. - * - decoding: unused - */ - int rate_emu; - /** * If non NULL, 'draw_horiz_band' is called by the libavcodec * decoder to draw a horizontal band. It improves cache usage. Not * all codecs can do that. You must check the codec capabilities * beforehand. + * When multithreading is used, it may be called from multiple threads + * at the same time; threads might draw different parts of the same AVFrame, + * or multiple AVFrames, and there is no guarantee that slices will be drawn + * in order. * The function is also used by hardware acceleration APIs. * It is called at least once during frame decoding to pass * the data needed for hardware render. @@ -1164,7 +1291,7 @@ typedef struct AVCodecContext { * - encoding: Set by user. * - decoding: Set by libavcodec. */ - enum SampleFormat sample_fmt; ///< sample format + enum AVSampleFormat sample_fmt; ///< sample format /* The following data should not be initialized. */ /** @@ -1172,9 +1299,6 @@ typedef struct AVCodecContext { */ int frame_size; int frame_number; ///< audio or video frame number -#if LIBAVCODEC_VERSION_MAJOR < 53 - int real_pict_num; ///< Returns the real picture number of previous encoded frame. -#endif /** * Number of frames the decoded output will be delayed relative to @@ -1232,14 +1356,6 @@ typedef struct AVCodecContext { int b_frame_strategy; - /** - * hurry up amount - * - encoding: unused - * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header - * @deprecated Deprecated in favor of skip_idct and skip_frame. - */ - int hurry_up; - struct AVCodec *codec; void *priv_data; @@ -1346,18 +1462,18 @@ typedef struct AVCodecContext { * - encoding: Set by user. * - decoding: Set by user. * Setting this to STRICT or higher means the encoder and decoder will - * generally do stupid things. While setting it to inofficial or lower - * will mean the encoder might use things that are not supported by all - * spec compliant decoders. Decoders make no difference between normal, - * inofficial and experimental, that is they always try to decode things - * when they can unless they are explicitly asked to behave stupid + * generally do stupid things, whereas setting it to unofficial or lower + * will mean the encoder might produce output that is not supported by all + * spec-compliant decoders. Decoders don't differentiate between normal, + * unofficial and experimental (that is, they always try to decode things + * when they can) unless they are explicitly asked to behave stupidly * (=strictly conform to the specs) */ int strict_std_compliance; -#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to a older more strict version of the spec or reference software. +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. #define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. #define FF_COMPLIANCE_NORMAL 0 -#define FF_COMPLIANCE_INOFFICIAL -1 ///< Allow inofficial extensions. +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions #define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. /** @@ -1387,8 +1503,11 @@ typedef struct AVCodecContext { * if CODEC_CAP_DR1 is not set then get_buffer() must call * avcodec_default_get_buffer() instead of providing buffers allocated by * some other means. + * If frame multithreading is used and thread_safe_callbacks is set, + * it may be called from a different thread, but not from more than one at once. + * Does not need to be reentrant. * - encoding: unused - * - decoding: Set by libavcodec., user can override. + * - decoding: Set by libavcodec, user can override. */ int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); @@ -1396,8 +1515,10 @@ typedef struct AVCodecContext { * Called to release buffers which were allocated with get_buffer. * A released buffer can be reused in get_buffer(). * pic.data[*] must be set to NULL. + * May be called from a different thread if frame multithreading is used, + * but not by more than one thread at once, so does not need to be reentrant. * - encoding: unused - * - decoding: Set by libavcodec., user can override. + * - decoding: Set by libavcodec, user can override. */ void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); @@ -1624,23 +1745,6 @@ typedef struct AVCodecContext { * result into program crash.) */ unsigned dsp_mask; -#define FF_MM_FORCE 0x80000000 /* Force usage of selected flags (OR) */ - /* lower 16 bits - CPU features */ -#define FF_MM_MMX 0x0001 ///< standard MMX -#define FF_MM_3DNOW 0x0004 ///< AMD 3DNOW -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define FF_MM_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext -#endif -#define FF_MM_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext -#define FF_MM_SSE 0x0008 ///< SSE functions -#define FF_MM_SSE2 0x0010 ///< PIV SSE2 functions -#define FF_MM_3DNOWEXT 0x0020 ///< AMD 3DNowExt -#define FF_MM_SSE3 0x0040 ///< Prescott SSE3 functions -#define FF_MM_SSSE3 0x0080 ///< Conroe SSSE3 functions -#define FF_MM_SSE4 0x0100 ///< Penryn SSE4.1 functions -#define FF_MM_SSE42 0x0200 ///< Nehalem SSE4.2 functions -#define FF_MM_IWMMXT 0x0100 ///< XScale IWMMXT -#define FF_MM_ALTIVEC 0x0001 ///< standard AltiVec /** * bits per sample/pixel from the demuxer (needed for huffyuv). @@ -1697,6 +1801,7 @@ typedef struct AVCodecContext { #define FF_DEBUG_VIS_QP 0x00002000 #define FF_DEBUG_VIS_MB_TYPE 0x00004000 #define FF_DEBUG_BUFFERS 0x00008000 +#define FF_DEBUG_THREADS 0x00010000 /** * debug @@ -1715,20 +1820,6 @@ typedef struct AVCodecContext { */ uint64_t error[4]; - /** - * minimum MB quantizer - * - encoding: unused - * - decoding: unused - */ - int mb_qmin; - - /** - * maximum MB quantizer - * - encoding: unused - * - decoding: unused - */ - int mb_qmax; - /** * motion estimation comparison function * - encoding: Set by user. @@ -1884,12 +1975,6 @@ typedef struct AVCodecContext { */ void *internal_buffer; -#define FF_LAMBDA_SHIFT 7 -#define FF_LAMBDA_SCALE (1<thread_count before calling avcodec_open() instead of calling this. + */ +attribute_deprecated int avcodec_thread_init(AVCodecContext *s, int thread_count); -void avcodec_thread_free(AVCodecContext *s); +#endif + int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef /** - * Initializes the AVCodecContext to use the given AVCodec. Prior to using this + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this * function the context has to be allocated. * * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), @@ -3369,31 +3709,12 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, * @param avctx The context which will be set up to use the given codec. * @param codec The codec to use within the context. * @return zero on success, a negative value on error - * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder + * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder, avcodec_close */ int avcodec_open(AVCodecContext *avctx, AVCodec *codec); -#if LIBAVCODEC_VERSION_MAJOR < 53 /** - * Decodes an audio frame from buf into samples. - * Wrapper function which calls avcodec_decode_audio3. - * - * @deprecated Use avcodec_decode_audio3 instead. - * @param avctx the codec context - * @param[out] samples the output buffer - * @param[in,out] frame_size_ptr the output buffer size in bytes - * @param[in] buf the input buffer - * @param[in] buf_size the input buffer size in bytes - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -attribute_deprecated int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - const uint8_t *buf, int buf_size); -#endif - -/** - * Decodes the audio frame of size avpkt->size from avpkt->data into samples. + * Decode the audio frame of size avpkt->size from avpkt->data into samples. * Some decoders may support multiple frames in a single AVPacket, such * decoders would then just decode the first frame. In this case, * avcodec_decode_audio3 has to be called again with an AVPacket that contains @@ -3435,27 +3756,8 @@ int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt); -#if LIBAVCODEC_VERSION_MAJOR < 53 /** - * Decodes a video frame from buf into picture. - * Wrapper function which calls avcodec_decode_video2. - * - * @deprecated Use avcodec_decode_video2 instead. - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * @param[in] buf the input buffer - * @param[in] buf_size the size of the input buffer in bytes - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - */ -attribute_deprecated int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - const uint8_t *buf, int buf_size); -#endif - -/** - * Decodes the video frame of size avpkt->size from avpkt->data into picture. + * Decode the video frame of size avpkt->size from avpkt->data into picture. * Some decoders may support multiple frames in a single AVPacket, such * decoders would then just decode the first frame. * @@ -3480,6 +3782,11 @@ attribute_deprecated int avcodec_decode_video(AVCodecContext *avctx, AVFrame *pi * @param[out] picture The AVFrame in which the decoded video frame will be stored. * Use avcodec_alloc_frame to get an AVFrame, the codec will * allocate memory for the actual bitmap. + * with default get/release_buffer(), the decoder frees/reuses the bitmap as it sees fit. + * with overridden get/release_buffer() (needs CODEC_CAP_DR1) the user decides into what buffer the decoder + * decodes and the decoder tells the user once it does not need the data anymore, + * the user app can at this point free/reuse/keep the memory as it sees fit. + * * @param[in] avpkt The input AVpacket containing the input buffer. * You can create such packet with av_init_packet() and by then setting * data and size, some decoders might in addition need other fields like @@ -3493,35 +3800,39 @@ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt); -#if LIBAVCODEC_VERSION_MAJOR < 53 -/* Decode a subtitle message. Return -1 if error, otherwise return the - * number of bytes used. If no subtitle could be decompressed, - * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. */ -attribute_deprecated int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, - const uint8_t *buf, int buf_size); -#endif - /** - * Decodes a subtitle message. - * Returns a negative value on error, otherwise returns the number of bytes used. + * Decode a subtitle message. + * Return a negative value on error, otherwise return the number of bytes used. * If no subtitle could be decompressed, got_sub_ptr is zero. * Otherwise, the subtitle is stored in *sub. + * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for + * simplicity, because the performance difference is expect to be negligible + * and reusing a get_buffer written for video codecs would probably perform badly + * due to a potentially very different allocation pattern. * * @param avctx the codec context - * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored. + * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be + freed with avsubtitle_free if *got_sub_ptr is set. * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. * @param[in] avpkt The input AVPacket containing the input buffer. */ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt); + +/** + * Frees all allocated data in the given subtitle struct. + * + * @param sub AVSubtitle to free. + */ +void avsubtitle_free(AVSubtitle *sub); + int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata, int *data_size_ptr, uint8_t *buf, int buf_size); /** - * Encodes an audio frame from samples into buf. + * Encode an audio frame from samples into buf. * * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. * However, for PCM audio the user will know how much space is needed @@ -3543,7 +3854,7 @@ int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples); /** - * Encodes a video frame from pict into buf. + * Encode a video frame from pict into buf. * The input picture should be * stored using a specific format, namely avctx.pix_fmt. * @@ -3582,29 +3893,33 @@ void avcodec_default_free_buffers(AVCodecContext *s); /* misc useful functions */ +#if FF_API_OLD_FF_PICT_TYPES /** - * Returns a single letter to describe the given picture type pict_type. + * Return a single letter to describe the given picture type pict_type. * * @param[in] pict_type the picture type * @return A single character representing the picture type. + * @deprecated Use av_get_picture_type_char() instead. */ +attribute_deprecated char av_get_pict_type_char(int pict_type); +#endif /** - * Returns codec bits per sample. + * Return codec bits per sample. * * @param[in] codec_id the codec * @return Number of bits per sample or zero if unknown for the given codec. */ int av_get_bits_per_sample(enum CodecID codec_id); +#if FF_API_OLD_SAMPLE_FMT /** - * Returns sample format bits per sample. - * - * @param[in] sample_fmt the sample format - * @return Number of bits per sample or zero if unknown for the given sample format. + * @deprecated Use av_get_bytes_per_sample() instead. */ -int av_get_bits_per_sample_format(enum SampleFormat sample_fmt); +attribute_deprecated +int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt); +#endif /* frame parsing */ typedef struct AVCodecParserContext { @@ -3642,6 +3957,9 @@ typedef struct AVCodecParserContext { int flags; #define PARSER_FLAG_COMPLETE_FRAMES 0x0001 +#define PARSER_FLAG_ONCE 0x0002 +/// Set if the parser has a valid file offset +#define PARSER_FLAG_FETCHED_OFFSET 0x0004 int64_t offset; ///< byte offset from starting packet start int64_t cur_frame_end[AV_PARSER_PTS_NB]; @@ -3649,7 +3967,7 @@ typedef struct AVCodecParserContext { /*! * Set by parser to 1 for key frames and 0 for non-key frames. * It is initialized to -1, so if the parser doesn't set this flag, - * old-style fallback using FF_I_TYPE picture type as key frames + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames * will be used. */ int key_frame; @@ -3662,6 +3980,8 @@ typedef struct AVCodecParserContext { * the very first frame or from this keyframe. * Is AV_NOPTS_VALUE if unknown. * This field is not the display duration of the current frame. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. * * The purpose of this field is to allow seeking in streams that have no * keyframes in the conventional sense. It corresponds to the @@ -3748,15 +4068,6 @@ AVCodecParser *av_parser_next(AVCodecParser *c); void av_register_codec_parser(AVCodecParser *parser); AVCodecParserContext *av_parser_init(int codec_id); -#if LIBAVCODEC_VERSION_MAJOR < 53 -attribute_deprecated -int av_parser_parse(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, - int64_t pts, int64_t dts); -#endif - /** * Parse a packet. * @@ -3831,15 +4142,14 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f); /* memory */ /** - * Reallocates the given block if it is not large enough, otherwise it - * does nothing. + * Reallocate the given block if it is not large enough, otherwise do nothing. * * @see av_realloc */ -void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); /** - * Allocates a buffer, reusing the given one if large enough. + * Allocate a buffer, reusing the given one if large enough. * * Contrary to av_fast_realloc the current buffer contents might not be * preserved and on error the old buffer is freed, thus no special @@ -3850,10 +4160,10 @@ void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and * *size 0 if an error occurred. */ -void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size); +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); /** - * Copy image 'src' to 'dst'. + * Copy image src to dst. Wraps av_picture_data_copy() above. */ void av_picture_copy(AVPicture *dst, const AVPicture *src, enum PixelFormat pix_fmt, int width, int height); @@ -3871,7 +4181,7 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, int padtop, int padbottom, int padleft, int padright, int *color); /** - * Encodes extradata length to a buffer. Used by xiph codecs. + * Encode extradata length to a buffer. Used by xiph codecs. * * @param s buffer to write to; must be at least (v/255+1) bytes long * @param v size of extradata in bytes @@ -3879,30 +4189,6 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, */ unsigned int av_xiphlacing(unsigned char *s, unsigned int v); -/** - * Parses str and put in width_ptr and height_ptr the detected values. - * - * @return 0 in case of a successful parsing, a negative value otherwise - * @param[in] str the string to parse: it has to be a string in the format - * x or a valid video frame size abbreviation. - * @param[in,out] width_ptr pointer to the variable which will contain the detected - * frame width value - * @param[in,out] height_ptr pointer to the variable which will contain the detected - * frame height value - */ -int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str); - -/** - * Parses str and put in frame_rate the detected values. - * - * @return 0 in case of a successful parsing, a negative value otherwise - * @param[in] str the string to parse: it has to be a string in the format - * /, a float number or a valid video rate abbreviation - * @param[in,out] frame_rate pointer to the AVRational which will contain the detected - * frame rate - */ -int av_parse_video_frame_rate(AVRational *frame_rate, const char *str); - /** * Logs a generic warning message about a missing feature. This function is * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) @@ -3918,17 +4204,17 @@ int av_parse_video_frame_rate(AVRational *frame_rate, const char *str); void av_log_missing_feature(void *avc, const char *feature, int want_sample); /** - * Logs a generic warning message asking for a sample. This function is + * Log a generic warning message asking for a sample. This function is * intended to be used internally by FFmpeg (libavcodec, libavformat, etc.) * only, and would normally not be used by applications. * @param[in] avc a pointer to an arbitrary struct of which the first field is * a pointer to an AVClass struct * @param[in] msg string containing an optional message, or NULL if no message */ -void av_log_ask_for_sample(void *avc, const char *msg); +void av_log_ask_for_sample(void *avc, const char *msg, ...); /** - * Registers the hardware accelerator hwaccel. + * Register the hardware accelerator hwaccel. */ void av_register_hwaccel(AVHWAccel *hwaccel); diff --git a/3rdparty/include/ffmpeg_/libavcodec/avfft.h b/3rdparty/include/ffmpeg_/libavcodec/avfft.h index 623f0a33b..be2d9c7e1 100644 --- a/3rdparty/include/ffmpeg_/libavcodec/avfft.h +++ b/3rdparty/include/ffmpeg_/libavcodec/avfft.h @@ -85,7 +85,7 @@ enum DCTTransformType { }; /** - * Sets up DCT. + * Set 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 diff --git a/3rdparty/include/ffmpeg_/libavcodec/dxva2.h b/3rdparty/include/ffmpeg_/libavcodec/dxva2.h index b3021fac9..5c5fe21e2 100644 --- a/3rdparty/include/ffmpeg_/libavcodec/dxva2.h +++ b/3rdparty/include/ffmpeg_/libavcodec/dxva2.h @@ -23,7 +23,7 @@ #ifndef AVCODEC_DXVA_H #define AVCODEC_DXVA_H -#include +#include #include diff --git a/3rdparty/include/ffmpeg_/libavcodec/opt.h b/3rdparty/include/ffmpeg_/libavcodec/opt.h index 55ca4ea63..2380e7433 100644 --- a/3rdparty/include/ffmpeg_/libavcodec/opt.h +++ b/3rdparty/include/ffmpeg_/libavcodec/opt.h @@ -1,211 +1,34 @@ /* - * AVOptions - * copyright (c) 2005 Michael Niedermayer + * This file is part of Libav. * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or + * Libav is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * FFmpeg is distributed in the hope that it will be useful, + * Libav is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/** + * @file + * This header is provided for compatibility only and will be removed + * on next major bump + */ + #ifndef AVCODEC_OPT_H #define AVCODEC_OPT_H -/** - * @file - * AVOptions - */ +#include "libavcodec/version.h" -#include "libavutil/rational.h" -#include "avcodec.h" - -enum AVOptionType{ - FF_OPT_TYPE_FLAGS, - FF_OPT_TYPE_INT, - FF_OPT_TYPE_INT64, - FF_OPT_TYPE_DOUBLE, - FF_OPT_TYPE_FLOAT, - FF_OPT_TYPE_STRING, - FF_OPT_TYPE_RATIONAL, - FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length - FF_OPT_TYPE_CONST=128, -}; - -/** - * AVOption - */ -typedef struct AVOption { - const char *name; - - /** - * short English help text - * @todo What about other languages? - */ - const char *help; - - /** - * The offset relative to the context structure where the option - * value is stored. It should be 0 for named constants. - */ - int offset; - enum AVOptionType type; - - /** - * the default value for scalar options - */ - double default_val; - double min; ///< minimum valid value for the option - double max; ///< maximum valid value for the option - - int flags; -#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding -#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding -#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... -#define AV_OPT_FLAG_AUDIO_PARAM 8 -#define AV_OPT_FLAG_VIDEO_PARAM 16 -#define AV_OPT_FLAG_SUBTITLE_PARAM 32 -//FIXME think about enc-audio, ... style flags - - /** - * The logical unit to which the option belongs. Non-constant - * options and corresponding named constants share the same - * unit. May be NULL. - */ - const char *unit; -} AVOption; - -/** - * AVOption2. - * THIS IS NOT PART OF THE API/ABI YET! - * This is identical to AVOption except that default_val was replaced by - * an union, it should be compatible with AVOption on normal platforms. - */ -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 obj. Looks only for the options which - * have the flags set as specified in mask and flags (that is, - * for which it is the case that opt->flags & mask == flags). - * - * @param[in] obj a pointer to a struct whose first element is a - * pointer to an AVClass - * @param[in] name the name of the option to look for - * @param[in] unit the unit of the option to look for, or any if NULL - * @return a pointer to the option found, or NULL if no option - * has been found - */ -const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); - -#if LIBAVCODEC_VERSION_MAJOR < 53 -/** - * @see av_set_string2() - */ -attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val); - -/** - * @return a pointer to the AVOption corresponding to the field set or - * NULL if no matching AVOption exists, or if the value val is not - * valid - * @see av_set_string3() - */ -attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc); +#if FF_API_OPT_H +#include "libavutil/opt.h" #endif -/** - * Sets the field of obj with the given name to value. - * - * @param[in] obj A struct whose first element is a pointer to an - * AVClass. - * @param[in] name the name of the field to set - * @param[in] val The value to set. If the field is not of a string - * type, then the given string is parsed. - * SI postfixes and some named scalars are supported. - * If the field is of a numeric type, it has to be a numeric or named - * scalar. Behavior with more than one scalar and +- infix operators - * is undefined. - * If the field is of a flags type, it has to be a sequence of numeric - * scalars or named flags separated by '+' or '-'. Prefixing a flag - * with '+' causes it to be set without affecting the other flags; - * similarly, '-' unsets a flag. - * @param[out] o_out if non-NULL put here a pointer to the AVOption - * found - * @param alloc when 1 then the old value will be av_freed() and the - * new av_strduped() - * when 0 then no av_free() nor av_strdup() will be used - * @return 0 if the value has been set, or an AVERROR code in case of - * error: - * AVERROR(ENOENT) if no matching option exists - * AVERROR(ERANGE) if the value is out of range - * AVERROR(EINVAL) if the value is not valid - */ -int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); - -const AVOption *av_set_double(void *obj, const char *name, double n); -const AVOption *av_set_q(void *obj, const char *name, AVRational n); -const AVOption *av_set_int(void *obj, const char *name, int64_t n); -double av_get_double(void *obj, const char *name, const AVOption **o_out); -AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); -int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); -const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); -const AVOption *av_next_option(void *obj, const AVOption *last); -int av_opt_show(void *obj, void *av_log_obj); -void av_opt_set_defaults(void *s); -void av_opt_set_defaults2(void *s, int mask, int flags); - #endif /* AVCODEC_OPT_H */ diff --git a/3rdparty/include/ffmpeg_/libavcodec/vaapi.h b/3rdparty/include/ffmpeg_/libavcodec/vaapi.h index 7dbdbcb3a..07568a47f 100644 --- a/3rdparty/include/ffmpeg_/libavcodec/vaapi.h +++ b/3rdparty/include/ffmpeg_/libavcodec/vaapi.h @@ -24,7 +24,7 @@ #ifndef AVCODEC_VAAPI_H #define AVCODEC_VAAPI_H -#include +#include /** * \defgroup VAAPI_Decoding VA API Decoding diff --git a/3rdparty/include/ffmpeg_/libavcodec/vdpau.h b/3rdparty/include/ffmpeg_/libavcodec/vdpau.h index a8fa4d387..0dc6fb850 100644 --- a/3rdparty/include/ffmpeg_/libavcodec/vdpau.h +++ b/3rdparty/include/ffmpeg_/libavcodec/vdpau.h @@ -38,7 +38,6 @@ * and rendering (API calls) are done as part of the VDPAU * presentation (vo_vdpau.c) module. * - * @{ * \defgroup VDPAU_Decoding VDPAU Decoding * \ingroup Decoder * @{ @@ -68,6 +67,13 @@ struct vdpau_render_state { int state; ///< Holds FF_VDPAU_STATE_* values. + /** 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; + /** picture parameter information for all supported codecs */ union VdpPictureInfo { VdpPictureInfoH264 h264; @@ -75,13 +81,6 @@ struct vdpau_render_state { VdpPictureInfoVC1 vc1; VdpPictureInfoMPEG4Part2 mpeg4; } info; - - /** 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; }; /* @}*/ diff --git a/3rdparty/include/ffmpeg_/libavcodec/version.h b/3rdparty/include/ffmpeg_/libavcodec/version.h new file mode 100644 index 000000000..100c06dfe --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavcodec/version.h @@ -0,0 +1,72 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VERSION_H +#define AVCODEC_VERSION_H + +#define LIBAVCODEC_VERSION_MAJOR 53 +#define LIBAVCODEC_VERSION_MINOR 7 +#define LIBAVCODEC_VERSION_MICRO 0 + +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) + +/** + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_PALETTE_CONTROL +#define FF_API_PALETTE_CONTROL (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_SAMPLE_FMT +#define FF_API_OLD_SAMPLE_FMT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_AUDIOCONVERT +#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_ANTIALIAS_ALGO +#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_REQUEST_CHANNELS +#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OPT_H +#define FF_API_OPT_H (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_THREAD_INIT +#define FF_API_THREAD_INIT (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_FF_PICT_TYPES +#define FF_API_OLD_FF_PICT_TYPES (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_FLAC_GLOBAL_OPTS +#define FF_API_FLAC_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_GET_PIX_FMT_NAME +#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54) +#endif + +#endif /* AVCODEC_VERSION_H */ diff --git a/3rdparty/include/ffmpeg_/libavcodec/xvmc.h b/3rdparty/include/ffmpeg_/libavcodec/xvmc.h index 01f84b28c..93ad8bb9a 100644 --- a/3rdparty/include/ffmpeg_/libavcodec/xvmc.h +++ b/3rdparty/include/ffmpeg_/libavcodec/xvmc.h @@ -25,11 +25,6 @@ #include "avcodec.h" -#if LIBAVCODEC_VERSION_MAJOR < 53 -#define AV_XVMC_STATE_DISPLAY_PENDING 1 /** the surface should be shown, the video driver manipulates this */ -#define AV_XVMC_STATE_PREDICTION 2 /** the surface is needed for prediction, the codec manipulates this */ -#define AV_XVMC_STATE_OSD_SOURCE 4 /** the surface is needed for subpicture rendering */ -#endif #define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct the number is 1337 speak for the letters IDCT MCo (motion compensation) */ @@ -71,7 +66,7 @@ struct xvmc_pix_fmt { */ int allocated_data_blocks; - /** Indicates that the hardware would interpret data_blocks as IDCT + /** Indicate that the hardware would interpret data_blocks as IDCT coefficients and perform IDCT on them. - application - set during initialization - libavcodec - unchanged @@ -151,22 +146,6 @@ struct xvmc_pix_fmt { of coded blocks it contains. */ int next_free_data_block_num; - -/** extensions may be placed here */ -#if LIBAVCODEC_VERSION_MAJOR < 53 -//@{ - /** State flags used to work around limitations in the MPlayer video system. - 0 - Surface is not used. - 1 - Surface is still held in application to be displayed or is - still visible. - 2 - Surface is still held in libavcodec buffer for prediction. - */ - int state; - - /** pointer to the surface where the subpicture is rendered */ - void* p_osd_target_surface_render; -//}@ -#endif }; #endif /* AVCODEC_XVMC_H */ diff --git a/3rdparty/include/ffmpeg_/libavdevice/avdevice.h b/3rdparty/include/ffmpeg_/libavdevice/avdevice.h index dcd835cb1..e49e5b71f 100644 --- a/3rdparty/include/ffmpeg_/libavdevice/avdevice.h +++ b/3rdparty/include/ffmpeg_/libavdevice/avdevice.h @@ -20,10 +20,11 @@ #define AVDEVICE_AVDEVICE_H #include "libavutil/avutil.h" +#include "libavformat/avformat.h" -#define LIBAVDEVICE_VERSION_MAJOR 52 -#define LIBAVDEVICE_VERSION_MINOR 2 -#define LIBAVDEVICE_VERSION_MICRO 0 +#define LIBAVDEVICE_VERSION_MAJOR 53 +#define LIBAVDEVICE_VERSION_MINOR 1 +#define LIBAVDEVICE_VERSION_MICRO 1 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ LIBAVDEVICE_VERSION_MINOR, \ @@ -33,18 +34,22 @@ LIBAVDEVICE_VERSION_MICRO) #define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT +#ifndef FF_API_V4L +#define FF_API_V4L (LIBAVDEVICE_VERSION_MAJOR < 54) +#endif + /** - * Returns the LIBAVDEVICE_VERSION_INT constant. + * Return the LIBAVDEVICE_VERSION_INT constant. */ unsigned avdevice_version(void); /** - * Returns the libavdevice build-time configuration. + * Return the libavdevice build-time configuration. */ const char *avdevice_configuration(void); /** - * Returns the libavdevice license. + * Return the libavdevice license. */ const char *avdevice_license(void); diff --git a/3rdparty/include/ffmpeg_/libavformat/avformat.h b/3rdparty/include/ffmpeg_/libavformat/avformat.h index 0e93376bd..3d4e1329b 100644 --- a/3rdparty/include/ffmpeg_/libavformat/avformat.h +++ b/3rdparty/include/ffmpeg_/libavformat/avformat.h @@ -21,173 +21,196 @@ #ifndef AVFORMAT_AVFORMAT_H #define AVFORMAT_AVFORMAT_H -#define LIBAVFORMAT_VERSION_MAJOR 52 -#define LIBAVFORMAT_VERSION_MINOR 64 -#define LIBAVFORMAT_VERSION_MICRO 2 - -#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ - LIBAVFORMAT_VERSION_MINOR, \ - LIBAVFORMAT_VERSION_MICRO) -#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ - LIBAVFORMAT_VERSION_MINOR, \ - LIBAVFORMAT_VERSION_MICRO) -#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT - -#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) /** - * I return the LIBAVFORMAT_VERSION_INT constant. You got - * a fucking problem with that, douchebag? + * Return the LIBAVFORMAT_VERSION_INT constant. */ unsigned avformat_version(void); /** - * Returns the libavformat build-time configuration. + * Return the libavformat build-time configuration. */ const char *avformat_configuration(void); /** - * Returns the libavformat license. + * Return the libavformat license. */ const char *avformat_license(void); #include #include /* FILE */ #include "libavcodec/avcodec.h" +#include "libavutil/dict.h" #include "avio.h" +#include "libavformat/version.h" struct AVFormatContext; -/* - * Public Metadata API. +/** + * @defgroup metadata_api Public Metadata API + * @{ * The metadata API allows libavformat to export metadata tags to a client * 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 + * - 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 * several keys that are literally different but semantically identical. * E.g., key=Author5, key=Author6. In this example, all authors must be * placed in the same tag. - * 2. Metadata is flat, not hierarchical; there are no subtags. If you + * - 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. Several modifiers can be applied to the tag name. This is done by + * - 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 + * - 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 -- 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: + * - Demuxers attempt to export metadata in a generic format, however tags + * with no generic equivalents are left as they are stored in the container. + * 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 -- . - * 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. + @verbatim + 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. + creation_time-- date when the file was created, preferably in ISO 8601. + 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 -- . + language -- main language in which the work is performed, preferably + in ISO 639-2 format. Multiple languages can be specified by + separating them with commas. + 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. + service_name -- name of the service in broadcasting (channel name). + service_provider -- name of the service provider in broadcasting. + title -- name of the work. + track -- number of this work in the set, can be in form current/total. + variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of + @endverbatim + * + * Look in the examples section for an application example how to use the Metadata API. + * + * @} */ -#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. +#if FF_API_OLD_METADATA2 +/** + * @defgroup old_metadata Old metadata API + * The following functions are deprecated, use + * their equivalents from libavutil/dict.h instead. + * @{ + */ -typedef struct { - char *key; - char *value; -}AVMetadataTag; +#define AV_METADATA_MATCH_CASE AV_DICT_MATCH_CASE +#define AV_METADATA_IGNORE_SUFFIX AV_DICT_IGNORE_SUFFIX +#define AV_METADATA_DONT_STRDUP_KEY AV_DICT_DONT_STRDUP_KEY +#define AV_METADATA_DONT_STRDUP_VAL AV_DICT_DONT_STRDUP_VAL +#define AV_METADATA_DONT_OVERWRITE AV_DICT_DONT_OVERWRITE + +typedef attribute_deprecated AVDictionary AVMetadata; +typedef attribute_deprecated AVDictionaryEntry AVMetadataTag; -typedef struct AVMetadata AVMetadata; typedef struct AVMetadataConv AVMetadataConv; /** - * Gets a metadata element with matching key. + * Get 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); +attribute_deprecated AVDictionaryEntry * +av_metadata_get(AVDictionary *m, const char *key, const AVDictionaryEntry *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) + * Set the given tag in *pm, overwriting an existing tag. + * + * @param pm pointer to a pointer to a metadata struct. If *pm is NULL + * a metadata struct is allocated and put in *pm. + * @param key tag key to add to *pm (will be av_strduped depending on flags) + * @param value tag value to add to *pm (will be av_strduped depending on flags). + * Passing a NULL value will cause an existing tag to be deleted. * @return >= 0 on success otherwise an error code <0 - * @deprecated Use av_metadata_set2() instead. */ -attribute_deprecated int av_metadata_set(AVMetadata **pm, const char *key, const char *value); +attribute_deprecated int av_metadata_set2(AVDictionary **pm, const char *key, const char *value, int flags); + +/** + * This function is provided for compatibility reason and currently does nothing. + */ +attribute_deprecated void av_metadata_conv(struct AVFormatContext *ctx, const AVMetadataConv *d_conv, + const AVMetadataConv *s_conv); + +/** + * Copy metadata from one AVDictionary struct into another. + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, + * this function will allocate a struct for you and put it in *dst + * @param src pointer to source AVDictionary struct + * @param flags flags to use when setting metadata in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + */ +attribute_deprecated void av_metadata_copy(AVDictionary **dst, AVDictionary *src, int flags); + +/** + * Free all the memory allocated for an AVDictionary struct. + */ +attribute_deprecated void av_metadata_free(AVDictionary **m); +/** + * @} + */ #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_set2(AVMetadata **pm, const char *key, const char *value, int flags); - -/** - * 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 - */ -void av_metadata_conv(struct AVFormatContext *ctx,const AVMetadataConv *d_conv, - const AVMetadataConv *s_conv); - -/** - * Frees all the memory allocated for an AVMetadata struct. - */ -void av_metadata_free(AVMetadata **m); - /* packet functions */ /** - * Allocates and reads the payload of a packet and initializes its + * Allocate and read the payload of a packet and initialize its * fields with default values. * * @param pkt packet * @param size desired payload size * @return >0 (read size) if OK, AVERROR_xxx otherwise */ -int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size); +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); +/** + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. + * + * @param pkt packet + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. + */ +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); + /*************************************************/ /* fractional numbers for exact pts handling */ @@ -204,7 +227,9 @@ typedef struct AVFrac { struct AVCodecTag; -/** This structure contains the data a format has to probe a file. */ +/** + * This structure contains the data a format has to probe a file. + */ typedef struct AVProbeData { const char *filename; unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ @@ -215,28 +240,25 @@ typedef struct AVProbeData { #define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer typedef struct AVFormatParameters { - AVRational time_base; - int sample_rate; - int channels; - int width; - int height; - enum PixelFormat pix_fmt; - int channel; /**< Used to select DV channel. */ - const char *standard; /**< TV standard, NTSC, PAL, SECAM */ - unsigned int mpeg2ts_raw:1; /**< Force raw MPEG-2 transport stream output, if possible. */ - unsigned int mpeg2ts_compute_pcr:1; /**< Compute exact PCR for each transport - stream packet (only meaningful if - mpeg2ts_raw is TRUE). */ - unsigned int initial_pause:1; /**< Do not begin to play the stream - immediately (RTSP only). */ - unsigned int prealloced_context:1; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - enum CodecID video_codec_id; - enum CodecID audio_codec_id; +#if FF_API_FORMAT_PARAMETERS + attribute_deprecated AVRational time_base; + attribute_deprecated int sample_rate; + attribute_deprecated int channels; + attribute_deprecated int width; + attribute_deprecated int height; + attribute_deprecated enum PixelFormat pix_fmt; + attribute_deprecated int channel; /**< Used to select DV channel. */ + attribute_deprecated const char *standard; /**< deprecated, use demuxer-specific options instead. */ + attribute_deprecated unsigned int mpeg2ts_raw:1; /**< deprecated, use mpegtsraw demuxer */ + /**< deprecated, use mpegtsraw demuxer-specific options instead */ + attribute_deprecated unsigned int mpeg2ts_compute_pcr:1; + attribute_deprecated unsigned int initial_pause:1; /**< Do not begin to play the stream + immediately (RTSP only). */ + attribute_deprecated unsigned int prealloced_context:1; #endif } AVFormatParameters; -//! Demuxer will use url_fopen, no opened file should be provided by the caller. +//! Demuxer will use avio_open, no opened file should be provided by the caller. #define AVFMT_NOFILE 0x0001 #define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ #define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ @@ -245,9 +267,15 @@ typedef struct AVFormatParameters { #define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ #define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ #define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ -#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. */ +#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */ #define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ #define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ +#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ +#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fallback to binary search via read_timestamp */ +#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */ +#define AVFMT_TS_NONSTRICT 0x8000 /**< Format does not require strictly + increasing timestamps, but they must + still be monotonic */ typedef struct AVOutputFormat { const char *name; @@ -259,7 +287,9 @@ typedef struct AVOutputFormat { const char *long_name; const char *mime_type; const char *extensions; /**< comma-separated filename extensions */ - /** size of private data so that it can be allocated in the wrapper */ + /** + * size of private data so that it can be allocated in the wrapper + */ int priv_data_size; /* output support */ enum CodecID audio_codec; /**< default audio codec */ @@ -267,10 +297,15 @@ typedef struct AVOutputFormat { int (*write_header)(struct AVFormatContext *); int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); int (*write_trailer)(struct AVFormatContext *); - /** can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_GLOBALHEADER */ + /** + * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, + * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, + * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS + */ int flags; - /** Currently only used to set pixel format if not YUV420P. */ - int (*set_parameters)(struct AVFormatContext *, AVFormatParameters *); + + void *dummy; + int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, AVPacket *in, int flush); @@ -282,46 +317,69 @@ typedef struct AVOutputFormat { enum CodecID subtitle_codec; /**< default subtitle codec */ +#if FF_API_OLD_METADATA2 const AVMetadataConv *metadata_conv; +#endif + + const AVClass *priv_class; ///< AVClass for the private context /* private fields */ struct AVOutputFormat *next; } AVOutputFormat; typedef struct AVInputFormat { + /** + * A comma separated list of short names for the format. New names + * may be appended with a minor bump. + */ const char *name; + /** * Descriptive name for the format, meant to be more human-readable * than name. You should use the NULL_IF_CONFIG_SMALL() macro * to define it. */ const char *long_name; - /** Size of private data so that it can be allocated in the wrapper. */ + + /** + * Size of private data so that it can be allocated in the wrapper. + */ int priv_data_size; + /** * Tell if a given file has a chance of being parsed as this format. * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes * big so you do not have to check for that unless you need more. */ int (*read_probe)(AVProbeData *); - /** Read the format header and initialize the AVFormatContext - structure. Return 0 if OK. 'ap' if non-NULL contains - additional parameters. Only used in raw format right - now. 'av_new_stream' should be called to create new streams. */ + + /** + * Read the format header and initialize the AVFormatContext + * structure. Return 0 if OK. 'ap' if non-NULL contains + * additional parameters. Only used in raw format right + * now. 'av_new_stream' should be called to create new streams. + */ int (*read_header)(struct AVFormatContext *, 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. - @return 0 on success, < 0 on error. - When returning an error, pkt must not have been allocated - or must be freed before returning */ + + /** + * 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 and only in the calling thread (not in a + * background thread). + * @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 */ + + /** + * Close the stream. The AVFormatContext and AVStreams are not + * freed by this function + */ int (*read_close)(struct AVFormatContext *); -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_READ_SEEK /** * Seek to a given timestamp relative to the frames in * stream component stream_index. @@ -330,8 +388,8 @@ typedef struct AVInputFormat { * match is available. * @return >= 0 on success (but not necessarily the new offset) */ - int (*read_seek)(struct AVFormatContext *, - int stream_index, int64_t timestamp, int flags); + attribute_deprecated int (*read_seek)(struct AVFormatContext *, + int stream_index, int64_t timestamp, int flags); #endif /** * Gets the next timestamp in stream[stream_index].time_base units. @@ -339,34 +397,51 @@ typedef struct AVInputFormat { */ int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit); - /** Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER. */ + + /** + * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER. + */ int flags; - /** If extensions are defined, then no probe is done. You should - usually not use extension format guessing because it is not - reliable enough */ + + /** + * If extensions are defined, then no probe is done. You should + * usually not use extension format guessing because it is not + * reliable enough + */ const char *extensions; - /** General purpose read-only value that the format can use. */ + + /** + * General purpose read-only value that the format can use. + */ int value; - /** Starts/resumes playing - only meaningful if using a network-based format - (RTSP). */ + /** + * Start/resume playing - only meaningful if using a network-based format + * (RTSP). + */ int (*read_play)(struct AVFormatContext *); - /** Pauses playing - only meaningful if using a network-based format - (RTSP). */ + /** + * Pause playing - only meaningful if using a network-based format + * (RTSP). + */ int (*read_pause)(struct AVFormatContext *); const struct AVCodecTag * const *codec_tag; /** - * Seeks to timestamp ts. + * Seek 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. */ int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); +#if FF_API_OLD_METADATA2 const AVMetadataConv *metadata_conv; +#endif + + const AVClass *priv_class; ///< AVClass for the private context /* private fields */ struct AVInputFormat *next; @@ -377,6 +452,7 @@ enum AVStreamParseType { AVSTREAM_PARSE_FULL, /**< full parsing and repack */ AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */ + AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */ }; typedef struct AVIndexEntry { @@ -395,6 +471,16 @@ typedef struct AVIndexEntry { #define AV_DISPOSITION_LYRICS 0x0010 #define AV_DISPOSITION_KARAOKE 0x0020 +/** + * Track should be used during playback by default. + * Useful for subtitle track that should be displayed + * even when user did not explicitly ask for subtitles. + */ +#define AV_DISPOSITION_FORCED 0x0040 +#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ +#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ +#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ + /** * Stream structure. * New fields can be added to the end with minor version bumps. @@ -419,23 +505,32 @@ typedef struct AVStream { /* internal data used in av_find_stream_info() */ int64_t first_dts; - /** encoding: pts generation when outputting stream */ + + /** + * encoding: pts generation when outputting stream + */ struct AVFrac pts; /** * This is the fundamental unit of time (in seconds) in terms * of which frame timestamps are represented. For fixed-fps content, * time base should be 1/framerate and timestamp increments should be 1. + * decoding: set by libavformat + * encoding: set by libavformat in av_write_header */ AVRational time_base; int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ /* ffmpeg.c private use */ int stream_copy; /**< If set, just copy stream. */ enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. + //FIXME move stuff to a flags field? - /** Quality, as it has been removed from AVCodecContext and put in AVVideoFrame. - * MN: dunno if that is the right place for it */ + /** + * Quality, as it has been removed from AVCodecContext and put in AVVideoFrame. + * MN: dunno if that is the right place for it + */ float quality; + /** * Decoding: pts of the first frame of the stream, in stream time base. * Only set this if you are absolutely 100% sure that the value you set @@ -445,6 +540,7 @@ typedef struct AVStream { * demuxer must NOT set this. */ int64_t start_time; + /** * Decoding: duration of the stream, in stream time base. * If a source file does not specify a duration, but does specify @@ -452,10 +548,6 @@ typedef struct AVStream { */ int64_t duration; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char language[4]; /** ISO 639-2/B 3-letter language code (empty string if undefined) */ -#endif - /* av_read_frame() support */ enum AVStreamParseType need_parsing; struct AVCodecParserContext *parser; @@ -471,12 +563,6 @@ typedef struct AVStream { int64_t nb_frames; ///< number of frames in this stream if known or 0 -#if LIBAVFORMAT_VERSION_INT < (53<<16) - int64_t unused[4+1]; - - char *filename; /**< source filename of the stream */ -#endif - int disposition; /**< AV_DISPOSITION_* bit field */ AVProbeData probe_data; @@ -490,9 +576,10 @@ typedef struct AVStream { */ AVRational sample_aspect_ratio; - AVMetadata *metadata; + AVDictionary *metadata; - /* av_read_frame() support */ + /* Intended mostly for av_read_frame() support. Not supposed to be used by */ + /* external applications; try to use something else if at all possible. */ const uint8_t *cur_ptr; int cur_len; AVPacket cur_pkt; @@ -529,6 +616,31 @@ typedef struct AVStream { * Number of frames that have been demuxed during av_find_stream_info() */ int codec_info_nb_frames; + + /** + * Stream Identifier + * This is the MPEG-TS stream identifier +1 + * 0 means unknown + */ + int stream_identifier; + + /** + * Stream informations used internally by av_find_stream_info() + */ +#define MAX_STD_TIMEBASES (60*12+5) + struct { + int64_t last_dts; + int64_t duration_gcd; + int duration_count; + double duration_error[MAX_STD_TIMEBASES]; + int64_t codec_info_duration; + } *info; + + /** + * flag to indicate that probing is requested + * NOT PART OF PUBLIC API + */ + int request_probe; } AVStream; #define AV_PROGRAM_RUNNING 1 @@ -541,15 +653,15 @@ typedef struct AVStream { */ typedef struct AVProgram { int id; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char *provider_name; ///< network name for DVB streams - char *name; ///< service name for DVB streams -#endif int flags; enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller unsigned int *stream_index; unsigned int nb_stream_indexes; - AVMetadata *metadata; + AVDictionary *metadata; + + int program_num; + int pmt_pid; + int pcr_pid; } AVProgram; #define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present @@ -559,18 +671,9 @@ typedef struct AVChapter { int id; ///< unique ID to identify the chapter AVRational time_base; ///< time base in which the start/end timestamps are specified int64_t start, end; ///< chapter start/end time in time_base units -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char *title; ///< chapter title -#endif - AVMetadata *metadata; + AVDictionary *metadata; } AVChapter; -#if LIBAVFORMAT_VERSION_MAJOR < 53 -#define MAX_STREAMS 20 -#else -#define MAX_STREAMS 100 -#endif - /** * Format I/O context. * New fields can be added to the end with minor version bumps. @@ -584,57 +687,54 @@ typedef struct AVFormatContext { struct AVInputFormat *iformat; struct AVOutputFormat *oformat; void *priv_data; - ByteIOContext *pb; + AVIOContext *pb; unsigned int nb_streams; - AVStream *streams[MAX_STREAMS]; + AVStream **streams; char filename[1024]; /**< input or output filename */ /* stream info */ int64_t timestamp; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - char title[512]; - char author[512]; - char copyright[512]; - char comment[512]; - char album[512]; - int year; /**< ID3 year, 0 if none */ - int track; /**< track number, 0 if none */ - char genre[32]; /**< ID3 genre */ -#endif int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ /* private data for pts handling (do not modify directly). */ - /** This buffer is only needed when packets were already buffered but - not decoded, for example to get the codec parameters in MPEG - streams. */ + /** + * This buffer is only needed when packets were already buffered but + * not decoded, for example to get the codec parameters in MPEG + * streams. + */ struct AVPacketList *packet_buffer; - /** Decoding: position of the first frame of the component, in - AV_TIME_BASE fractional seconds. NEVER set this value directly: - It is deduced from the AVStream values. */ + /** + * Decoding: position of the first frame of the component, in + * AV_TIME_BASE fractional seconds. NEVER set this value directly: + * It is deduced from the AVStream values. + */ int64_t start_time; - /** Decoding: duration of the stream, in AV_TIME_BASE fractional - 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. */ + + /** + * Decoding: duration of the stream, in AV_TIME_BASE fractional + * 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 */ + + /** + * decoding: total file size, 0 if unknown + */ int64_t file_size; - /** Decoding: total stream bitrate in bit/s, 0 if not - available. Never set it directly if the file_size and the - duration are known as FFmpeg can compute it automatically. */ + + /** + * Decoding: total stream bitrate in bit/s, 0 if not + * available. Never set it directly if the file_size and the + * duration are known as FFmpeg can compute it automatically. + */ int bit_rate; /* av_read_frame() support */ AVStream *cur_st; -#if LIBAVFORMAT_VERSION_INT < (53<<16) - const uint8_t *cur_ptr_deprecated; - int cur_len_deprecated; - AVPacket cur_pkt_deprecated; -#endif /* av_seek_frame() support */ - int64_t data_offset; /** offset of the first packet */ - int index_built; + int64_t data_offset; /**< offset of the first packet */ int mux_rate; unsigned int packet_size; @@ -643,7 +743,9 @@ typedef struct AVFormatContext { #define AVFMT_NOOUTPUTLOOP -1 #define AVFMT_INFINITEOUTPUTLOOP 0 - /** number of times to loop output in formats that support it */ + /** + * number of times to loop output in formats that support it + */ int loop_output; int flags; @@ -653,10 +755,20 @@ typedef struct AVFormatContext { #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 +#if FF_API_FLAG_RTP_HINT +#define AVFMT_FLAG_RTP_HINT 0x0040 ///< Deprecated, use the -movflags rtphint muxer specific AVOption instead +#endif +#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. +#define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Enable RTP MP4A-LATM payload +#define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down) +#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted) +#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Dont merge side data but keep it seperate. int loop_input; - /** decoding: size of data to probe; encoding: unused. */ + + /** + * decoding: size of data to probe; encoding: unused. + */ unsigned int probesize; /** @@ -676,11 +788,13 @@ typedef struct AVFormatContext { * Demuxing: Set by user. */ enum CodecID video_codec_id; + /** * Forced audio codec_id. * Demuxing: Set by user. */ enum CodecID audio_codec_id; + /** * Forced subtitle codec_id. * Demuxing: Set by user. @@ -725,7 +839,7 @@ typedef struct AVFormatContext { struct AVPacketList *packet_buffer_end; - AVMetadata *metadata; + AVDictionary *metadata; /** * Remaining size available for raw_packet_buffer, in bytes. @@ -742,6 +856,17 @@ typedef struct AVFormatContext { * - decoding: Unused. */ int64_t start_time_realtime; + + /** + * decoding: number of frames used to probe fps + */ + int fps_probe_size; + + /** + * Transport stream id. + * This will be moved into demuxer private options. Thus no API/ABI compatibility + */ + int ts_id; } AVFormatContext; typedef struct AVPacketList { @@ -749,11 +874,6 @@ typedef struct AVPacketList { struct AVPacketList *next; } AVPacketList; -#if LIBAVFORMAT_VERSION_INT < (53<<16) -extern AVInputFormat *first_iformat; -extern AVOutputFormat *first_oformat; -#endif - /** * If f is NULL, returns the first registered input format, * if f is non-NULL, returns the next registered input format after f @@ -768,7 +888,9 @@ AVInputFormat *av_iformat_next(AVInputFormat *f); */ AVOutputFormat *av_oformat_next(AVOutputFormat *f); -enum CodecID av_guess_image2_codec(const char *filename); +#if FF_API_GUESS_IMG2_CODEC +attribute_deprecated enum CodecID av_guess_image2_codec(const char *filename); +#endif /* XXX: Use automatic init with either ELF sections or C file parser */ /* modules. */ @@ -776,22 +898,10 @@ 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); -#if LIBAVFORMAT_VERSION_MAJOR < 53 -attribute_deprecated AVOutputFormat *guess_stream_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 + * Return the output format in the list of registered output formats + * which best matches the provided parameters, or return NULL if * there is no match. * * @param short_name if non-NULL checks if short_name matches with the @@ -806,25 +916,25 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *mime_type); /** - * Guesses the codec ID based upon muxer and filename. + * Guess 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 AVMediaType type); /** - * Sends a nice hexadecimal dump of a buffer to the specified file stream. + * Send 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 * @param size buffer size * - * @see av_hex_dump_log, av_pkt_dump, av_pkt_dump_log + * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 */ void av_hex_dump(FILE *f, uint8_t *buf, int size); /** - * Sends a nice hexadecimal dump of a buffer to the log. + * Send 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. @@ -833,21 +943,23 @@ void av_hex_dump(FILE *f, uint8_t *buf, int size); * @param buf buffer * @param size buffer size * - * @see av_hex_dump, av_pkt_dump, av_pkt_dump_log + * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 */ void av_hex_dump_log(void *avcl, int level, uint8_t *buf, int size); /** - * Sends a nice dump of a packet to the specified file stream. + * Send 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 * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to */ -void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); + /** - * Sends a nice dump of a packet to the log. + * Send 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. @@ -855,11 +967,19 @@ void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); * higher importance. * @param pkt packet to dump * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to */ -void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st); + +#if FF_API_PKT_DUMP +attribute_deprecated void av_pkt_dump(FILE *f, AVPacket *pkt, int dump_payload); +attribute_deprecated void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, + int dump_payload); +#endif /** - * Initializes libavformat and registers all the muxers, demuxers and + * Initialize libavformat and register all the muxers, demuxers and * protocols. If you do not call this function, then you can select * exactly which formats you want to support. * @@ -869,19 +989,33 @@ void av_pkt_dump_log(void *avcl, int level, AVPacket *pkt, int dump_payload); */ void av_register_all(void); -/** codec tag <-> codec id */ +/** + * Get the CodecID for the given codec tag tag. + * If no codec id is found returns CODEC_ID_NONE. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + */ enum CodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); + +/** + * Get the codec tag for the given codec id id. + * If no codec tag is found returns 0. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + */ unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum CodecID id); /* media file input */ /** - * Finds AVInputFormat based on the short name of the input format. + * Find AVInputFormat based on the short name of the input format. */ AVInputFormat *av_find_input_format(const char *short_name); /** - * Guesses the file format. + * Guess the file format. * * @param is_opened Whether the file is already opened; determines whether * demuxers with or without AVFMT_NOFILE are probed. @@ -889,7 +1023,7 @@ AVInputFormat *av_find_input_format(const char *short_name); AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); /** - * Guesses the file format. + * Guess the file format. * * @param is_opened Whether the file is already opened; determines whether * demuxers with or without AVFMT_NOFILE are probed. @@ -902,15 +1036,45 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); 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]. + * Guess the file format. + * + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + * @param score_ret The score of the best detection. */ -int av_open_input_stream(AVFormatContext **ic_ptr, - ByteIOContext *pb, const char *filename, +AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret); + +/** + * Probe a bytestream to determine the input format. Each time a probe returns + * with a score that is too low, the probe buffer size is increased and another + * attempt is made. When the maximum probe size is reached, the input format + * with the highest score is returned. + * + * @param pb the bytestream to probe + * @param fmt the input format is put here + * @param filename the filename of the stream + * @param logctx the log context + * @param offset the offset within the bytestream to probe from + * @param max_probe_size the maximum probe buffer size (zero for default) + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, + const char *filename, void *logctx, + unsigned int offset, unsigned int max_probe_size); + +#if FF_API_FORMAT_PARAMETERS +/** + * Allocate all the structures needed to read an input stream. + * This does not open the needed codecs for decoding the stream[s]. + * @deprecated use avformat_open_input instead. + */ +attribute_deprecated int av_open_input_stream(AVFormatContext **ic_ptr, + AVIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap); /** - * Opens a media file as input. The codecs are not opened. Only the file + * Open 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. @@ -920,28 +1084,76 @@ int av_open_input_stream(AVFormatContext **ic_ptr, * @param ap Additional parameters needed when opening the file * (NULL if default). * @return 0 if OK, AVERROR_xxx otherwise + * + * @deprecated use avformat_open_input instead. */ -int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, +attribute_deprecated int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, AVInputFormat *fmt, int buf_size, AVFormatParameters *ap); - -#if LIBAVFORMAT_VERSION_MAJOR < 53 -/** - * @deprecated Use avformat_alloc_context() instead. - */ -attribute_deprecated AVFormatContext *av_alloc_format_context(void); #endif /** - * Allocates an AVFormatContext. - * Can be freed with av_free() but do not forget to free everything you - * explicitly allocated as well! + * Open an input stream and read the header. The codecs are not opened. + * The stream must be closed with av_close_input_file(). + * + * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). + * May be a pointer to NULL, in which case an AVFormatContext is allocated by this + * function and written into ps. + * Note that a user-supplied AVFormatContext will be freed on failure. + * @param filename Name of the stream to open. + * @param fmt If non-NULL, this parameter forces a specific input format. + * Otherwise the format is autodetected. + * @param options A dictionary filled with AVFormatContext and demuxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @note If you want to use custom IO, preallocate the format context and set its pb field. + */ +int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options); + +int av_demuxer_open(AVFormatContext *ic, AVFormatParameters *ap); + +/** + * Allocate an AVFormatContext. + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. */ AVFormatContext *avformat_alloc_context(void); +#if FF_API_ALLOC_OUTPUT_CONTEXT /** - * Reads packets of a media file to get stream information. This + * @deprecated deprecated in favor of avformat_alloc_output_context2() + */ +attribute_deprecated +AVFormatContext *avformat_alloc_output_context(const char *format, + AVOutputFormat *oformat, + const char *filename); +#endif + +/** + * Allocate an AVFormatContext for an output format. + * avformat_free_context() can be used to free the context and + * everything allocated by the framework within it. + * + * @param *ctx is set to the created format context, or to NULL in + * case of failure + * @param oformat format to use for allocating the context, if NULL + * format_name and filename are used instead + * @param format_name the name of output format to use for allocating the + * context, if NULL filename is used instead + * @param filename the name of the filename to use for allocating the + * context, may be NULL + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure + */ +int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat, + const char *format_name, const char *filename); + +/** + * Read 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. @@ -956,7 +1168,38 @@ AVFormatContext *avformat_alloc_context(void); int av_find_stream_info(AVFormatContext *ic); /** - * Reads a transport packet from a media file. + * Find the "best" stream in the file. + * The best stream is determined according to various heuristics as the most + * likely to be what the user expects. + * If the decoder parameter is non-NULL, av_find_best_stream will find the + * default decoder for the stream's codec; streams for which no decoder can + * be found are ignored. + * + * @param ic media file handle + * @param type stream type: video, audio, subtitles, etc. + * @param wanted_stream_nb user-requested stream number, + * or -1 for automatic selection + * @param related_stream try to find a stream related (eg. in the same + * program) to this one, or -1 if none + * @param decoder_ret if non-NULL, returns the decoder for the + * selected stream + * @param flags flags; none are currently defined + * @return the non-negative stream number in case of success, + * AVERROR_STREAM_NOT_FOUND if no stream with the requested type + * could be found, + * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder + * @note If av_find_best_stream returns successfully and decoder_ret is not + * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec. + */ +int av_find_best_stream(AVFormatContext *ic, + enum AVMediaType type, + int wanted_stream_nb, + int related_stream, + AVCodec **decoder_ret, + int flags); + +/** + * Read a transport packet from a media file. * * This function is obsolete and should never be used. * Use av_read_frame() instead. @@ -968,7 +1211,12 @@ int av_find_stream_info(AVFormatContext *ic); int av_read_packet(AVFormatContext *s, AVPacket *pkt); /** - * Returns the next frame of a stream. + * Return the next frame of a stream. + * This function returns what is stored in the file, and does not validate + * that what is there are valid frames for the decoder. It will split what is + * stored in the file into frames and return one for each call. It will not + * omit invalid data between valid frames so as to give the decoder the maximum + * information possible for decoding. * * The returned packet is valid * until the next av_read_frame() or until av_close_input_file() and @@ -989,7 +1237,7 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt); int av_read_frame(AVFormatContext *s, AVPacket *pkt); /** - * Seeks to the keyframe at timestamp. + * Seek 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 @@ -1003,7 +1251,7 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags); /** - * Seeks to timestamp ts. + * Seek 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. @@ -1024,40 +1272,46 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, * @param flags flags * @return >=0 on success, error code otherwise * - * @NOTE This is part of the new seek API which is still under construction. + * @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 * ABI compatibility yet! */ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); /** - * Starts playing a network-based stream (e.g. RTSP stream) at the + * Start playing a network-based stream (e.g. RTSP stream) at the * current position. */ int av_read_play(AVFormatContext *s); /** - * Pauses a network-based stream (e.g. RTSP stream). + * Pause a network-based stream (e.g. RTSP stream). * * Use av_read_play() to resume it. */ int av_read_pause(AVFormatContext *s); /** - * Frees a AVFormatContext allocated by av_open_input_stream. + * Free a AVFormatContext allocated by av_open_input_stream. * @param s context to free */ void av_close_input_stream(AVFormatContext *s); /** - * Closes a media file (but not its codecs). + * Close a media file (but not its codecs). * * @param s media file handle */ void av_close_input_file(AVFormatContext *s); /** - * Adds a new stream to a media file. + * Free an AVFormatContext and all its streams. + * @param s context to free + */ +void avformat_free_context(AVFormatContext *s); + +/** + * Add 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 @@ -1070,23 +1324,8 @@ AVStream *av_new_stream(AVFormatContext *s, int id); AVProgram *av_new_program(AVFormatContext *s, int id); /** - * Adds a new chapter. - * This function is NOT part of the public API - * and should ONLY be used by demuxers. - * - * @param s media file handle - * @param id unique ID for this chapter - * @param start chapter start time in time_base units - * @param end chapter end time in time_base units - * @param title chapter title - * - * @return AVChapter or NULL on error - */ -AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, - int64_t start, int64_t end, const char *title); - -/** - * Sets the pts for a given stream. + * Set the pts for a given stream. If the new values would be invalid + * (<= 0), it leaves the AVStream unchanged. * * @param s stream * @param pts_wrap_bits number of bits effectively used by the pts @@ -1105,7 +1344,7 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits, int av_find_default_stream_index(AVFormatContext *s); /** - * Gets the index for a specific timestamp. + * Get the index for a specific timestamp. * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond * to the timestamp which is <= the requested one, if backward * is 0, then it will be >= @@ -1115,16 +1354,7 @@ int av_find_default_stream_index(AVFormatContext *s); int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); /** - * Ensures the index uses less memory than the maximum specified in - * AVFormatContext.max_index_size by discarding entries if it grows - * too large. - * This function is not part of the public API and should only be called - * by demuxers. - */ -void ff_reduce_index(AVFormatContext *s, int stream_index); - -/** - * Adds an index entry into a sorted list. Updates the entry if the list + * Add an index entry into a sorted list. Update the entry if the list * already contains it. * * @param timestamp timestamp in the time base of the given stream @@ -1133,8 +1363,8 @@ int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags); /** - * Does a binary search using av_index_search_timestamp() and - * AVCodec.read_timestamp(). + * Perform a binary search using av_index_search_timestamp() and + * AVInputFormat.read_timestamp(). * This is not supposed to be called directly by a user application, * but by demuxers. * @param target_ts target timestamp in the time base of the given stream @@ -1144,7 +1374,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags); /** - * Updates cur_dts of all streams based on the given timestamp and AVStream. + * Update cur_dts of all streams based on the given timestamp and AVStream. * * Stream ref_st unchanged, others set cur_dts in their native time base. * Only needed for timestamp wrapping or if (dts not set and pts!=dts). @@ -1154,7 +1384,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp); /** - * Does a binary search using read_timestamp(). + * Perform a binary search using read_timestamp(). * This is not supposed to be called directly by a user application, * but by demuxers. * @param target_ts target timestamp in the time base of the given stream @@ -1167,20 +1397,76 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int flags, int64_t *ts_ret, int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); -/** media file output */ -int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap); +/** + * media file output + */ +#if FF_API_FORMAT_PARAMETERS +/** + * @deprecated pass the options to avformat_write_header directly. + */ +attribute_deprecated int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap); +#endif /** - * Allocates the stream private data and writes the stream header to an + * Split a URL string into components. + * + * The pointers to buffers for storing individual components may be null, + * in order to ignore that component. Buffers for components not found are + * set to empty strings. If the port is not found, it is set to a negative + * value. + * + * @param proto the buffer for the protocol + * @param proto_size the size of the proto buffer + * @param authorization the buffer for the authorization + * @param authorization_size the size of the authorization buffer + * @param hostname the buffer for the host name + * @param hostname_size the size of the hostname buffer + * @param port_ptr a pointer to store the port number in + * @param path the buffer for the path + * @param path_size the size of the path buffer + * @param url the URL to split + */ +void av_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); + +/** + * Allocate the stream private data and write the stream header to + * an output media file. + * + * @param s Media file handle, must be allocated with avformat_alloc_context(). + * Its oformat field must be set to the desired output format; + * Its pb field must be set to an already openened AVIOContext. + * @param options An AVDictionary filled with AVFormatContext and muxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, negative AVERROR on failure. + * + * @see av_opt_find, av_dict_set, avio_open, av_oformat_next. + */ +int avformat_write_header(AVFormatContext *s, AVDictionary **options); + +#if FF_API_FORMAT_PARAMETERS +/** + * Allocate the stream private data and write the stream header to an * output media file. + * @note: this sets stream time-bases, if possible to stream->codec->time_base + * but for some formats it might also be some other time base * * @param s media file handle * @return 0 if OK, AVERROR_xxx on error + * + * @deprecated use avformat_write_header. */ -int av_write_header(AVFormatContext *s); +attribute_deprecated int av_write_header(AVFormatContext *s); +#endif /** - * Writes a packet to an output media file. + * Write 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 @@ -1194,7 +1480,7 @@ int av_write_header(AVFormatContext *s); int av_write_frame(AVFormatContext *s, AVPacket *pkt); /** - * Writes a packet to an output media file ensuring correct interleaving. + * Write a packet to an output media file ensuring correct interleaving. * * The packet must contain one audio or video frame. * If the packets are already correctly interleaved, the application should @@ -1211,7 +1497,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt); int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); /** - * Interleaves a packet per dts in an output media file. + * Interleave 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() @@ -1219,7 +1505,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); * * @param s media file handle * @param out the interleaved packet will be output here - * @param in the input packet + * @param pkt the input packet * @param flush 1 if no further packets are available as input and all * remaining packets should be output * @return 1 if a packet was output, 0 if no packet could be output, @@ -1229,7 +1515,7 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush); /** - * Writes the stream trailer to an output media file and frees the + * Write the stream trailer to an output media file and free the * file private data. * * May only be called after a successful call to av_write_header. @@ -1239,74 +1525,47 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, */ int av_write_trailer(AVFormatContext *s); -void dump_format(AVFormatContext *ic, - int index, - const char *url, - int is_output); - -#if LIBAVFORMAT_VERSION_MAJOR < 53 +#if FF_API_DUMP_FORMAT /** - * Parses width and height out of string str. - * @deprecated Use av_parse_video_frame_size instead. + * @deprecated Deprecated in favor of av_dump_format(). */ -attribute_deprecated int parse_image_size(int *width_ptr, int *height_ptr, - const char *str); +attribute_deprecated void dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); +#endif +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); + +#if FF_API_PARSE_DATE /** - * Converts framerate from a string to a fraction. - * @deprecated Use av_parse_video_frame_rate instead. + * Parse datestr and return a corresponding number of microseconds. + * + * @param datestr String representing a date or a duration. + * See av_parse_time() for the syntax of the provided string. + * @deprecated in favor of av_parse_time() */ -attribute_deprecated int parse_frame_rate(int *frame_rate, int *frame_rate_base, - const char *arg); +attribute_deprecated +int64_t parse_date(const char *datestr, int duration); #endif /** - * 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 - * [{YYYY-MM-DD|YYYYMMDD}]{T| }{HH[:MM[:SS[.m...]]][Z]|HH[MM[SS[.m...]]][Z]} - * @endcode - * Time is local time unless Z is appended, in which case it is - * interpreted as UTC. - * If the year-month-day part is not specified it takes the current - * year-month-day. - * Returns the number of microseconds since 1st of January, 1970 up to - * the time of the parsed date or INT64_MIN if datestr cannot be - * successfully parsed. - * - If a duration the syntax is: - * @code - * [-]HH[:MM[:SS[.m...]]] - * [-]S+[.m...] - * @endcode - * Returns the number of microseconds contained in a time interval - * with the specified duration or INT64_MIN if datestr cannot be - * successfully parsed. - * @param duration Flag which tells how to interpret datestr, if - * not zero datestr is interpreted as a duration, otherwise as a - * date. + * Get the current time in microseconds. */ -int64_t parse_date(const char *datestr, int duration); - -/** Gets the current time in microseconds. */ int64_t av_gettime(void); -/* ffm-specific for ffserver */ -#define FFM_PACKET_SIZE 4096 -int64_t ffm_read_write_index(int fd); -int ffm_write_write_index(int fd, int64_t pos); -void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size); - +#if FF_API_FIND_INFO_TAG /** - * Attempts to find a specific tag in a URL. - * - * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. - * Return 1 if found. + * @deprecated use av_find_info_tag in libavutil instead. */ -int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); +attribute_deprecated int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); +#endif /** - * Returns in 'buf' the path with '%d' replaced by a number. + * Return in 'buf' the path with '%d' replaced by a number. * * Also handles the '%0nd' format where 'n' is the total number * of digits and '%%'. @@ -1321,7 +1580,7 @@ int av_get_frame_filename(char *buf, int buf_size, const char *path, int number); /** - * Checks whether filename actually is a numbered sequence generator. + * Check whether filename actually is a numbered sequence generator. * * @param filename possible numbered sequence string * @return 1 if a valid numbered sequence string, 0 otherwise @@ -1329,7 +1588,7 @@ int av_get_frame_filename(char *buf, int buf_size, int av_filename_number_test(const char *filename); /** - * Generates an SDP for an RTP session. + * Generate 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 @@ -1337,15 +1596,19 @@ int av_filename_number_test(const char *filename); * all the contexts in the array (an AVCodecContext per RTP stream) * must contain only one AVStream. * @param n_files number of AVCodecContexts contained in ac - * @param buff buffer where the SDP will be stored (must be allocated by - * the caller) + * @param buf buffer where the SDP will be stored (must be allocated by + * the caller) * @param size the size of the buffer * @return 0 if OK, AVERROR_xxx on error */ -int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); + +#if FF_API_SDP_CREATE +attribute_deprecated int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size); +#endif /** - * Returns a positive value if the given filename has one of the given + * Return a positive value if the given filename has one of the given * extensions, 0 otherwise. * * @param extensions a comma-separated list of filename extensions diff --git a/3rdparty/include/ffmpeg_/libavformat/avio.h b/3rdparty/include/ffmpeg_/libavformat/avio.h index 4c3394325..e83811877 100644 --- a/3rdparty/include/ffmpeg_/libavformat/avio.h +++ b/3rdparty/include/ffmpeg_/libavformat/avio.h @@ -22,168 +22,595 @@ /** * @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. + * Buffered I/O operations */ -#include +#include #include "libavutil/common.h" +#include "libavutil/log.h" + +#include "libavformat/version.h" + + +#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ + +/** + * Bytestream IO Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVIOContext) must not be used outside libav*. + * + * @note None of the function pointers in AVIOContext should be called + * directly, they should only be set by the client application + * when implementing custom I/O. Normally these are set to the + * function pointers specified in avio_alloc_context() + */ +typedef struct { + unsigned char *buffer; /**< Start of the buffer. */ + int buffer_size; /**< Maximum buffer size */ + unsigned char *buf_ptr; /**< Current position in the buffer */ + unsigned char *buf_end; /**< End of the data, may be less than + buffer+buffer_size if the read function returned + less data than requested, e.g. for streams where + no more data has been received yet. */ + void *opaque; /**< A private pointer, passed to the read/write/seek/... + functions. */ + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); + int64_t (*seek)(void *opaque, int64_t offset, int whence); + int64_t pos; /**< position in the file of the current buffer */ + int must_flush; /**< true if the next seek should flush */ + int eof_reached; /**< true if eof reached */ + int write_flag; /**< true if open for writing */ +#if FF_API_OLD_AVIO + attribute_deprecated int is_streamed; +#endif + int max_packet_size; + unsigned long checksum; + unsigned char *checksum_ptr; + unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); + int error; /**< contains the error code or 0 if no error happened */ + /** + * Pause or resume playback for network streaming protocols - e.g. MMS. + */ + int (*read_pause)(void *opaque, int pause); + /** + * Seek to a given timestamp in stream with the specified stream_index. + * Needed for some network streaming protocols which don't support seeking + * to byte position. + */ + int64_t (*read_seek)(void *opaque, int stream_index, + int64_t timestamp, int flags); + /** + * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. + */ + int seekable; +} AVIOContext; /* unbuffered I/O */ +#if FF_API_OLD_AVIO /** * URL Context. * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major * version bump. * sizeof(URLContext) must not be used outside libav*. + * @deprecated This struct will be made private */ typedef struct URLContext { -#if LIBAVFORMAT_VERSION_MAJOR >= 53 const AVClass *av_class; ///< information for av_log(). Set by url_open(). -#endif struct URLProtocol *prot; int flags; int is_streamed; /**< true if streamed (no seek possible), default = false */ int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */ void *priv_data; char *filename; /**< specified URL */ + int is_connected; } URLContext; +#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ + +/** + * @deprecated This struct is to be made private. Use the higher-level + * AVIOContext-based API instead. + */ +typedef struct URLProtocol { + const char *name; + 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, const unsigned char *buf, int size); + int64_t (*url_seek)(URLContext *h, int64_t pos, int whence); + int (*url_close)(URLContext *h); + struct URLProtocol *next; + int (*url_read_pause)(URLContext *h, int pause); + int64_t (*url_read_seek)(URLContext *h, int stream_index, + int64_t timestamp, int flags); + int (*url_get_file_handle)(URLContext *h); + int priv_data_size; + const AVClass *priv_data_class; + int flags; + int (*url_check)(URLContext *h, int mask); +} URLProtocol; + typedef struct URLPollEntry { URLContext *handle; int events; int revents; } URLPollEntry; -#define URL_RDONLY 0 -#define URL_WRONLY 1 -#define URL_RDWR 2 +/* not implemented */ +attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout); + +/** + * @name URL open modes + * The flags argument to url_open and cosins must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define URL_RDONLY 1 /**< read-only */ +#define URL_WRONLY 2 /**< write-only */ +#define URL_RDWR (URL_RDONLY|URL_WRONLY) /**< read-write */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define URL_FLAG_NONBLOCK 4 typedef int URLInterruptCB(void); +extern URLInterruptCB *url_interrupt_cb; /** - * Creates an URLContext for accessing to the resource indicated by - * url, and opens it using the URLProtocol up. + * @defgroup old_url_funcs Old url_* functions + * The following functions are deprecated. Use the buffered API based on #AVIOContext instead. + * @{ + */ +attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up, + const char *url, int flags); +attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags); +attribute_deprecated int url_connect(URLContext *h); +attribute_deprecated int url_open(URLContext **h, const char *url, int flags); +attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size); +attribute_deprecated int url_read_complete(URLContext *h, unsigned char *buf, int size); +attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int size); +attribute_deprecated int64_t url_seek(URLContext *h, int64_t pos, int whence); +attribute_deprecated int url_close(URLContext *h); +attribute_deprecated int64_t url_filesize(URLContext *h); +attribute_deprecated int url_get_file_handle(URLContext *h); +attribute_deprecated int url_get_max_packet_size(URLContext *h); +attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_size); +attribute_deprecated int av_url_read_pause(URLContext *h, int pause); +attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index, + int64_t timestamp, int flags); +attribute_deprecated void url_set_interrupt_cb(int (*interrupt_cb)(void)); + +/** + * returns the next registered protocol after the given protocol (the first if + * NULL is given), or NULL if protocol is the last one. + */ +URLProtocol *av_protocol_next(URLProtocol *p); + +/** + * Register the URLProtocol protocol. * - * @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 + * @param size the size of the URLProtocol struct referenced */ -int url_open_protocol (URLContext **puc, struct URLProtocol *up, - const char *url, int flags); +attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size); +/** + * @} + */ + + +typedef attribute_deprecated AVIOContext ByteIOContext; + +attribute_deprecated int init_put_byte(AVIOContext *s, + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); +attribute_deprecated AVIOContext *av_alloc_put_byte( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); /** - * 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 + * @defgroup old_avio_funcs Old put_/get_*() functions + * The following functions are deprecated. Use the "avio_"-prefixed functions instead. + * @{ */ -int url_open(URLContext **h, const char *url, int flags); +attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size); +attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size); +attribute_deprecated int get_byte(AVIOContext *s); +attribute_deprecated unsigned int get_le16(AVIOContext *s); +attribute_deprecated unsigned int get_le24(AVIOContext *s); +attribute_deprecated unsigned int get_le32(AVIOContext *s); +attribute_deprecated uint64_t get_le64(AVIOContext *s); +attribute_deprecated unsigned int get_be16(AVIOContext *s); +attribute_deprecated unsigned int get_be24(AVIOContext *s); +attribute_deprecated unsigned int get_be32(AVIOContext *s); +attribute_deprecated uint64_t get_be64(AVIOContext *s); + +attribute_deprecated void put_byte(AVIOContext *s, int b); +attribute_deprecated void put_nbyte(AVIOContext *s, int b, int count); +attribute_deprecated void put_buffer(AVIOContext *s, const unsigned char *buf, int size); +attribute_deprecated void put_le64(AVIOContext *s, uint64_t val); +attribute_deprecated void put_be64(AVIOContext *s, uint64_t val); +attribute_deprecated void put_le32(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be32(AVIOContext *s, unsigned int val); +attribute_deprecated void put_le24(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be24(AVIOContext *s, unsigned int val); +attribute_deprecated void put_le16(AVIOContext *s, unsigned int val); +attribute_deprecated void put_be16(AVIOContext *s, unsigned int val); +attribute_deprecated void put_tag(AVIOContext *s, const char *tag); +/** + * @} + */ + +attribute_deprecated int av_url_read_fpause(AVIOContext *h, int pause); +attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_index, + int64_t timestamp, 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). + * @defgroup old_url_f_funcs Old url_f* functions + * The following functions are deprecated, use the "avio_"-prefixed functions instead. + * @{ */ -int url_read(URLContext *h, unsigned char *buf, int size); +attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags); +attribute_deprecated int url_fclose(AVIOContext *s); +attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); +attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset); +attribute_deprecated int64_t url_ftell(AVIOContext *s); +attribute_deprecated int64_t url_fsize(AVIOContext *s); +#define URL_EOF (-1) +attribute_deprecated int url_fgetc(AVIOContext *s); +attribute_deprecated int url_setbufsize(AVIOContext *s, int buf_size); +#ifdef __GNUC__ +attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); +#else +attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...); +#endif +attribute_deprecated void put_flush_packet(AVIOContext *s); +attribute_deprecated int url_open_dyn_buf(AVIOContext **s); +attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); +attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); +attribute_deprecated int url_fdopen(AVIOContext **s, URLContext *h); +/** + * @} + */ + +attribute_deprecated int url_ferror(AVIOContext *s); + +attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri); +attribute_deprecated int udp_get_local_port(URLContext *h); + +attribute_deprecated void init_checksum(AVIOContext *s, + unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), + unsigned long checksum); +attribute_deprecated unsigned long get_checksum(AVIOContext *s); +attribute_deprecated void put_strz(AVIOContext *s, const char *buf); +/** @note unlike fgets, the EOL character is not returned and a whole + line is parsed. return NULL if first char read was EOF */ +attribute_deprecated char *url_fgets(AVIOContext *s, char *buf, int buf_size); +/** + * @deprecated use avio_get_str instead + */ +attribute_deprecated char *get_strz(AVIOContext *s, char *buf, int maxlen); +/** + * @deprecated Use AVIOContext.seekable field directly. + */ +attribute_deprecated static inline int url_is_streamed(AVIOContext *s) +{ + return !s->seekable; +} +attribute_deprecated URLContext *url_fileno(AVIOContext *s); /** - * 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. + * @deprecated use AVIOContext.max_packet_size directly. */ -int url_read_complete(URLContext *h, unsigned char *buf, int size); -int url_write(URLContext *h, unsigned char *buf, int size); +attribute_deprecated int url_fget_max_packet_size(AVIOContext *s); + +attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags); + +/** return the written or read size */ +attribute_deprecated int url_close_buf(AVIOContext *s); /** - * 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); - -/** - * Returns a non-zero value if the resource indicated by url + * Return a non-zero value if the resource indicated by url * exists, 0 otherwise. + * @deprecated Use avio_check instead. */ -int url_exist(const char *url); - -int64_t url_filesize(URLContext *h); +attribute_deprecated int url_exist(const char *url); +#endif // FF_API_OLD_AVIO /** - * 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 AVIO_FLAG_* access flags corresponding to the access permissions + * of the resource in url, or a negative value corresponding to an + * AVERROR code in case of failure. The returned access flags are + * masked by the value in flags. * - * @return the file descriptor associated with this URL, or <0 on error. + * @note This function is intrinsically unsafe, in the sense that the + * checked resource may change its existence or permission status from + * one call to another. Thus you should not trust the returned value, + * unless you are sure that no other processes are accessing the + * checked resource. */ -int url_get_file_handle(URLContext *h); - -/** - * Return the maximum packet size associated to packetized file - * handle. If the file is not packetized (stream like HTTP or file on - * disk), then 0 is returned. - * - * @param h file handle - * @return maximum packet size in bytes - */ -int url_get_max_packet_size(URLContext *h); -void url_get_filename(URLContext *h, char *buf, int buf_size); +int avio_check(const char *url, int flags); /** * The callback is called in blocking functions to test regulary if - * asynchronous interruption is needed. AVERROR(EINTR) is returned + * asynchronous interruption is needed. AVERROR_EXIT is returned * in this case by the interrupted function. 'NULL' means no interrupt * callback is given. */ -void url_set_interrupt_cb(URLInterruptCB *interrupt_cb); +void avio_set_interrupt_cb(int (*interrupt_cb)(void)); -/* not implemented */ -int url_poll(URLPollEntry *poll_table, int n, int timeout); +/** + * Allocate and initialize an AVIOContext for buffered I/O. It must be later + * freed with av_free(). + * + * @param buffer Memory block for input/output operations via AVIOContext. + * The buffer must be allocated with av_malloc() and friends. + * @param buffer_size The buffer size is very important for performance. + * For protocols with fixed blocksize it should be set to this blocksize. + * For others a typical size is a cache page, e.g. 4kb. + * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. + * @param opaque An opaque pointer to user-specific data. + * @param read_packet A function for refilling the buffer, may be NULL. + * @param write_packet A function for writing the buffer contents, may be NULL. + * @param seek A function for seeking to specified byte position, may be NULL. + * + * @return Allocated AVIOContext or NULL on failure. + */ +AVIOContext *avio_alloc_context( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +void avio_w8(AVIOContext *s, int b); +void avio_write(AVIOContext *s, const unsigned char *buf, int size); +void avio_wl64(AVIOContext *s, uint64_t val); +void avio_wb64(AVIOContext *s, uint64_t val); +void avio_wl32(AVIOContext *s, unsigned int val); +void avio_wb32(AVIOContext *s, unsigned int val); +void avio_wl24(AVIOContext *s, unsigned int val); +void avio_wb24(AVIOContext *s, unsigned int val); +void avio_wl16(AVIOContext *s, unsigned int val); +void avio_wb16(AVIOContext *s, unsigned int val); + +/** + * Write a NULL-terminated string. + * @return number of bytes written. + */ +int avio_put_str(AVIOContext *s, const char *str); + +/** + * Convert an UTF-8 string to UTF-16LE and write it. + * @return number of bytes written. + */ +int avio_put_str16le(AVIOContext *s, const char *str); + +/** + * Passing this as the "whence" parameter to a seek function causes it to + * return the filesize without seeking anywhere. Supporting this is optional. + * If it is not supported then the seek function will return <0. + */ +#define AVSEEK_SIZE 0x10000 + +/** + * 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 + +/** + * fseek() equivalent for AVIOContext. + * @return new position or AVERROR. + */ +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); + +/** + * Skip given number of bytes forward + * @return new position or AVERROR. + */ +int64_t avio_skip(AVIOContext *s, int64_t offset); + +/** + * ftell() equivalent for AVIOContext. + * @return position or AVERROR. + */ +static av_always_inline int64_t avio_tell(AVIOContext *s) +{ + return avio_seek(s, 0, SEEK_CUR); +} + +/** + * Get the filesize. + * @return filesize or AVERROR + */ +int64_t avio_size(AVIOContext *s); + +/** + * feof() equivalent for AVIOContext. + * @return non zero if and only if end of file + */ +int url_feof(AVIOContext *s); + +/** @warning currently size is limited */ +#ifdef __GNUC__ +int avio_printf(AVIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); +#else +int avio_printf(AVIOContext *s, const char *fmt, ...); +#endif + +void avio_flush(AVIOContext *s); + + +/** + * Read size bytes from AVIOContext into buf. + * @return number of bytes read or AVERROR + */ +int avio_read(AVIOContext *s, unsigned char *buf, int size); + +/** + * @name Functions for reading from AVIOContext + * @{ + * + * @note return 0 if EOF, so you cannot use it if EOF handling is + * necessary + */ +int avio_r8 (AVIOContext *s); +unsigned int avio_rl16(AVIOContext *s); +unsigned int avio_rl24(AVIOContext *s); +unsigned int avio_rl32(AVIOContext *s); +uint64_t avio_rl64(AVIOContext *s); +unsigned int avio_rb16(AVIOContext *s); +unsigned int avio_rb24(AVIOContext *s); +unsigned int avio_rb32(AVIOContext *s); +uint64_t avio_rb64(AVIOContext *s); +/** + * @} + */ + +/** + * Read a string from pb into buf. The reading will terminate when either + * a NULL character was encountered, maxlen bytes have been read, or nothing + * more can be read from pb. The result is guaranteed to be NULL-terminated, it + * will be truncated if buf is too small. + * Note that the string is not interpreted or validated in any way, it + * might get truncated in the middle of a sequence for multi-byte encodings. + * + * @return number of bytes read (is always <= maxlen). + * If reading ends on EOF or error, the return value will be one more than + * bytes actually read. + */ +int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); + +/** + * Read a UTF-16 string from pb and convert it to UTF-8. + * The reading will terminate when either a null or invalid character was + * encountered or maxlen bytes have been read. + * @return number of bytes read (is always <= maxlen) + */ +int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); + + +/** + * @name URL open modes + * The flags argument to avio_open must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define AVIO_FLAG_READ 1 /**< read-only */ +#define AVIO_FLAG_WRITE 2 /**< write-only */ +#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define AVIO_FLAG_NONBLOCK 8 + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * 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 avio_open(AVIOContext **s, const char *url, int flags); + +/** + * Close the resource accessed by the AVIOContext s and free it. + * This function can only be used if s was opened by avio_open(). + * + * @return 0 on success, an AVERROR < 0 on error. + */ +int avio_close(AVIOContext *s); + +/** + * Open a write only memory stream. + * + * @param s new IO context + * @return zero if no error. + */ +int avio_open_dyn_buf(AVIOContext **s); + +/** + * Return the written size and a pointer to the buffer. The buffer + * must be freed with av_free(). + * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * + * @param s IO context + * @param pbuffer pointer to a byte buffer + * @return the length of the byte buffer + */ +int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); + +/** + * Iterate through names of available protocols. + * @note it is recommanded to use av_protocol_next() instead of this + * + * @param opaque A private pointer representing current protocol. + * It must be a pointer to NULL on first iteration and will + * be updated by successive calls to avio_enum_protocols. + * @param output If set to 1, iterate over output protocols, + * otherwise over input protocols. + * + * @return A static string containing the name of current protocol or NULL + */ +const char *avio_enum_protocols(void **opaque, int output); /** * Pause and resume playing - only meaningful if using a network streaming * protocol (e.g. MMS). * @param pause 1 for pause, 0 for resume */ -int av_url_read_pause(URLContext *h, int pause); +int avio_pause(AVIOContext *h, int pause); /** * Seek to a given timestamp relative to some component stream. @@ -202,324 +629,7 @@ int av_url_read_pause(URLContext *h, int pause); * @return >= 0 on success * @see AVInputFormat::read_seek */ -int64_t av_url_read_seek(URLContext *h, int stream_index, - int64_t timestamp, int flags); - -/** - * Passing this as the "whence" parameter to a seek function causes it to - * return the filesize without seeking anywhere. Supporting this is optional. - * If it is not supported then the seek function will return <0. - */ -#define AVSEEK_SIZE 0x10000 - -/** - * 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 *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); - int (*url_close)(URLContext *h); - struct URLProtocol *next; - int (*url_read_pause)(URLContext *h, int pause); - int64_t (*url_read_seek)(URLContext *h, int stream_index, - int64_t timestamp, int flags); - int (*url_get_file_handle)(URLContext *h); -} URLProtocol; - -#if LIBAVFORMAT_VERSION_MAJOR < 53 -extern URLProtocol *first_protocol; -#endif - -extern URLInterruptCB *url_interrupt_cb; - -/** - * If protocol is NULL, returns the first registered protocol, - * if protocol is non-NULL, returns the next registered protocol after protocol, - * or NULL if protocol is the last one. - */ -URLProtocol *av_protocol_next(URLProtocol *p); - -#if LIBAVFORMAT_VERSION_MAJOR < 53 -/** - * @deprecated Use av_register_protocol() instead. - */ -attribute_deprecated int register_protocol(URLProtocol *protocol); -#endif - -/** - * Registers the URLProtocol protocol. - */ -int av_register_protocol(URLProtocol *protocol); - -/** - * Bytestream IO Context. - * New fields can be added to the end with minor version bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. - * sizeof(ByteIOContext) must not be used outside libav*. - */ -typedef struct { - unsigned char *buffer; - int buffer_size; - unsigned char *buf_ptr, *buf_end; - void *opaque; - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); - int64_t (*seek)(void *opaque, int64_t offset, int whence); - int64_t pos; /**< position in the file of the current buffer */ - int must_flush; /**< true if the next seek should flush */ - int eof_reached; /**< true if eof reached */ - int write_flag; /**< true if open for writing */ - int is_streamed; - int max_packet_size; - unsigned long checksum; - unsigned char *checksum_ptr; - unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); - int error; ///< contains the error code or 0 if no error happened - int (*read_pause)(void *opaque, int pause); - int64_t (*read_seek)(void *opaque, int stream_index, - int64_t timestamp, int flags); -} ByteIOContext; - -int init_put_byte(ByteIOContext *s, - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - int64_t (*seek)(void *opaque, int64_t offset, int whence)); -ByteIOContext *av_alloc_put_byte( - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - int64_t (*seek)(void *opaque, int64_t offset, int whence)); - -void put_byte(ByteIOContext *s, int b); -void put_buffer(ByteIOContext *s, const unsigned char *buf, int size); -void put_le64(ByteIOContext *s, uint64_t val); -void put_be64(ByteIOContext *s, uint64_t val); -void put_le32(ByteIOContext *s, unsigned int val); -void put_be32(ByteIOContext *s, unsigned int val); -void put_le24(ByteIOContext *s, unsigned int val); -void put_be24(ByteIOContext *s, unsigned int val); -void put_le16(ByteIOContext *s, unsigned int val); -void put_be16(ByteIOContext *s, unsigned int val); -void put_tag(ByteIOContext *s, const char *tag); - -void put_strz(ByteIOContext *s, const char *buf); - -/** - * fseek() equivalent for ByteIOContext. - * @return new position or AVERROR. - */ -int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence); - -/** - * Skip given number of bytes forward. - * @param offset number of bytes - */ -void url_fskip(ByteIOContext *s, int64_t offset); - -/** - * ftell() equivalent for ByteIOContext. - * @return position or AVERROR. - */ -int64_t url_ftell(ByteIOContext *s); - -/** - * Gets the filesize. - * @return filesize or AVERROR - */ -int64_t url_fsize(ByteIOContext *s); - -/** - * feof() equivalent for ByteIOContext. - * @return non zero if and only if end of file - */ -int url_feof(ByteIOContext *s); - -int url_ferror(ByteIOContext *s); - -int av_url_read_fpause(ByteIOContext *h, int pause); -int64_t av_url_read_fseek(ByteIOContext *h, int stream_index, - int64_t timestamp, int flags); - -#define URL_EOF (-1) -/** @note return URL_EOF (-1) if EOF */ -int url_fgetc(ByteIOContext *s); - -/** @warning currently size is limited */ -#ifdef __GNUC__ -int url_fprintf(ByteIOContext *s, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); -#else -int url_fprintf(ByteIOContext *s, const char *fmt, ...); -#endif - -/** @note unlike fgets, the EOL character is not returned and a whole - line is parsed. return NULL if first char read was EOF */ -char *url_fgets(ByteIOContext *s, char *buf, int buf_size); - -void put_flush_packet(ByteIOContext *s); - - -/** - * Reads size bytes from ByteIOContext into buf. - * @return number of bytes read or AVERROR - */ -int get_buffer(ByteIOContext *s, unsigned char *buf, int size); - -/** - * Reads size bytes from ByteIOContext into buf. - * This reads at most 1 packet. If that is not enough fewer bytes will be - * returned. - * @return number of bytes read or AVERROR - */ -int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size); - -/** @note return 0 if EOF, so you cannot use it if EOF handling is - necessary */ -int get_byte(ByteIOContext *s); -unsigned int get_le24(ByteIOContext *s); -unsigned int get_le32(ByteIOContext *s); -uint64_t get_le64(ByteIOContext *s); -unsigned int get_le16(ByteIOContext *s); - -char *get_strz(ByteIOContext *s, char *buf, int maxlen); -unsigned int get_be16(ByteIOContext *s); -unsigned int get_be24(ByteIOContext *s); -unsigned int get_be32(ByteIOContext *s); -uint64_t get_be64(ByteIOContext *s); - -uint64_t ff_get_v(ByteIOContext *bc); - -static inline int url_is_streamed(ByteIOContext *s) -{ - return s->is_streamed; -} - -/** - * 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); - -int url_fclose(ByteIOContext *s); -URLContext *url_fileno(ByteIOContext *s); - -/** - * Return the maximum packet size associated to packetized buffered file - * handle. If the file is not packetized (stream like http or file on - * disk), then 0 is returned. - * - * @param s buffered file handle - * @return maximum packet size in bytes - */ -int url_fget_max_packet_size(ByteIOContext *s); - -int url_open_buf(ByteIOContext **s, uint8_t *buf, int buf_size, int flags); - -/** return the written or read size */ -int url_close_buf(ByteIOContext *s); - -/** - * Open a write only memory stream. - * - * @param s new IO context - * @return zero if no error. - */ -int url_open_dyn_buf(ByteIOContext **s); - -/** - * Open a write only packetized memory stream with a maximum packet - * size of 'max_packet_size'. The stream is stored in a memory buffer - * with a big endian 4 byte header giving the packet size in bytes. - * - * @param s new IO context - * @param max_packet_size maximum packet size (must be > 0) - * @return zero if no error. - */ -int url_open_dyn_packet_buf(ByteIOContext **s, int max_packet_size); - -/** - * Return the written size and a pointer to the buffer. The buffer - * must be freed with av_free(). - * @param s IO context - * @param pbuffer pointer to a byte buffer - * @return the length of the byte buffer - */ -int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer); - -unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, - unsigned int len); -unsigned long get_checksum(ByteIOContext *s); -void init_checksum(ByteIOContext *s, - unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), - unsigned long checksum); - -/* udp.c */ -int udp_set_remote_url(URLContext *h, const char *uri); -int udp_get_local_port(URLContext *h); -#if (LIBAVFORMAT_VERSION_MAJOR <= 52) -int udp_get_file_handle(URLContext *h); -#endif +int64_t avio_seek_time(AVIOContext *h, int stream_index, + int64_t timestamp, int flags); #endif /* AVFORMAT_AVIO_H */ diff --git a/3rdparty/include/ffmpeg_/libavformat/version.h b/3rdparty/include/ffmpeg_/libavformat/version.h new file mode 100644 index 000000000..691f9c056 --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavformat/version.h @@ -0,0 +1,81 @@ +/* + * Version macros. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_VERSION_H +#define AVFORMAT_VERSION_H + +#include "libavutil/avutil.h" + +#define LIBAVFORMAT_VERSION_MAJOR 53 +#define LIBAVFORMAT_VERSION_MINOR 4 +#define LIBAVFORMAT_VERSION_MICRO 0 + +#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT + +#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) + +/** + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_OLD_METADATA2 +#define FF_API_OLD_METADATA2 (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_READ_SEEK +#define FF_API_READ_SEEK (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_OLD_AVIO +#define FF_API_OLD_AVIO (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_DUMP_FORMAT +#define FF_API_DUMP_FORMAT (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_PARSE_DATE +#define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_FIND_INFO_TAG +#define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_PKT_DUMP +#define FF_API_PKT_DUMP (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_GUESS_IMG2_CODEC +#define FF_API_GUESS_IMG2_CODEC (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_SDP_CREATE +#define FF_API_SDP_CREATE (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_ALLOC_OUTPUT_CONTEXT +#define FF_API_ALLOC_OUTPUT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_FORMAT_PARAMETERS +#define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_FLAG_RTP_HINT +#define FF_API_FLAG_RTP_HINT (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif + +#endif /* AVFORMAT_VERSION_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/adler32.h b/3rdparty/include/ffmpeg_/libavutil/adler32.h index 3773f04e9..0b890bcc1 100644 --- a/3rdparty/include/ffmpeg_/libavutil/adler32.h +++ b/3rdparty/include/ffmpeg_/libavutil/adler32.h @@ -21,9 +21,21 @@ #ifndef AVUTIL_ADLER32_H #define AVUTIL_ADLER32_H -#include +#include #include "attributes.h" +/** + * Calculate the Adler32 checksum of a buffer. + * + * Passing the return value to a subsequent av_adler32_update() call + * allows the checksum of multiple buffers to be calculated as though + * they were concatenated. + * + * @param adler initial checksum value + * @param buf pointer to input buffer + * @param len size of input buffer + * @return updated checksum + */ unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigned int len) av_pure; diff --git a/3rdparty/include/ffmpeg_/libavutil/aes.h b/3rdparty/include/ffmpeg_/libavutil/aes.h new file mode 100644 index 000000000..368f70cbb --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/aes.h @@ -0,0 +1,47 @@ +/* + * copyright (c) 2007 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_H +#define AVUTIL_AES_H + +#include + +extern const int av_aes_size; + +struct AVAES; + +/** + * Initialize an AVAES context. + * @param key_bits 128, 192 or 256 + * @param decrypt 0 for encryption, 1 for decryption + */ +int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * @param count number of 16 byte blocks + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +#endif /* AVUTIL_AES_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/attributes.h b/3rdparty/include/ffmpeg_/libavutil/attributes.h index da45234c6..517b129f3 100644 --- a/3rdparty/include/ffmpeg_/libavutil/attributes.h +++ b/3rdparty/include/ffmpeg_/libavutil/attributes.h @@ -65,7 +65,7 @@ #endif #ifndef av_cold -#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3) +#if AV_GCC_VERSION_AT_LEAST(4,3) # define av_cold __attribute__((cold)) #else # define av_cold @@ -73,7 +73,7 @@ #endif #ifndef av_flatten -#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,1) +#if AV_GCC_VERSION_AT_LEAST(4,1) # define av_flatten __attribute__((flatten)) #else # define av_flatten @@ -96,8 +96,29 @@ #endif #endif +/** + * Mark a variable as used and prevent the compiler from optimizing it + * away. This is useful for variables accessed only from inline + * assembler without the compiler being aware. + */ +#ifndef av_used +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_used __attribute__((used)) +#else +# define av_used +#endif +#endif + +#ifndef av_alias +#if AV_GCC_VERSION_AT_LEAST(3,3) +# define av_alias __attribute__((may_alias)) +#else +# define av_alias +#endif +#endif + #ifndef av_uninit -#if defined(__GNUC__) && !defined(__ICC) +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) # define av_uninit(x) x=x #else # define av_uninit(x) x diff --git a/3rdparty/include/ffmpeg_/libavutil/audioconvert.h b/3rdparty/include/ffmpeg_/libavutil/audioconvert.h new file mode 100644 index 000000000..134c6107c --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/audioconvert.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2006 Michael Niedermayer + * Copyright (c) 2008 Peter Ross + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AUDIOCONVERT_H +#define AVUTIL_AUDIOCONVERT_H + +#include + +/** + * @file + * audio conversion routines + */ + +/* Audio channel masks */ +#define AV_CH_FRONT_LEFT 0x00000001 +#define AV_CH_FRONT_RIGHT 0x00000002 +#define AV_CH_FRONT_CENTER 0x00000004 +#define AV_CH_LOW_FREQUENCY 0x00000008 +#define AV_CH_BACK_LEFT 0x00000010 +#define AV_CH_BACK_RIGHT 0x00000020 +#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 +#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 +#define AV_CH_BACK_CENTER 0x00000100 +#define AV_CH_SIDE_LEFT 0x00000200 +#define AV_CH_SIDE_RIGHT 0x00000400 +#define AV_CH_TOP_CENTER 0x00000800 +#define AV_CH_TOP_FRONT_LEFT 0x00001000 +#define AV_CH_TOP_FRONT_CENTER 0x00002000 +#define AV_CH_TOP_FRONT_RIGHT 0x00004000 +#define AV_CH_TOP_BACK_LEFT 0x00008000 +#define AV_CH_TOP_BACK_CENTER 0x00010000 +#define AV_CH_TOP_BACK_RIGHT 0x00020000 +#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. +#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT. + +/** Channel mask value used for AVCodecContext.request_channel_layout + to indicate that the user requests the channel order of the decoder output + to be the native codec channel order. */ +#define AV_CH_LAYOUT_NATIVE 0x8000000000000000LL + +/* Audio channel convenience macros */ +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) + +/** + * Return a channel layout id that matches name, 0 if no match. + */ +int64_t av_get_channel_layout(const char *name); + +/** + * Return a description of a channel layout. + * If nb_channels is <= 0, it is guessed from the channel_layout. + * + * @param buf put here the string containing the channel layout + * @param buf_size size in bytes of the buffer + */ +void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout); + +/** + * Return the number of channels in the channel layout. + */ +int av_get_channel_layout_nb_channels(int64_t channel_layout); + +#endif /* AVUTIL_AUDIOCONVERT_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/avassert.h b/3rdparty/include/ffmpeg_/libavutil/avassert.h new file mode 100644 index 000000000..e100d0bfd --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/avassert.h @@ -0,0 +1,66 @@ +/* + * copyright (c) 2010 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple assert() macros that are a bit more flexible than ISO C assert(). + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_AVASSERT_H +#define AVUTIL_AVASSERT_H + +#include +#include "avutil.h" +#include "log.h" + +/** + * assert() equivalent, that is always enabled. + */ +#define av_assert0(cond) do { \ + if (!(cond)) { \ + av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \ + AV_STRINGIFY(cond), __FILE__, __LINE__); \ + abort(); \ + } \ +} while (0) + + +/** + * assert() equivalent, that does not lie in speed critical code. + * These asserts() thus can be enabled without fearing speedloss. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 +#define av_assert1(cond) av_assert0(cond) +#else +#define av_assert1(cond) ((void)0) +#endif + + +/** + * assert() equivalent, that does lie in speed critical code. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 +#define av_assert2(cond) av_assert0(cond) +#else +#define av_assert2(cond) ((void)0) +#endif + +#endif /* AVUTIL_AVASSERT_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/avconfig.h b/3rdparty/include/ffmpeg_/libavutil/avconfig.h index b028bb4f7..f10aa6186 100644 --- a/3rdparty/include/ffmpeg_/libavutil/avconfig.h +++ b/3rdparty/include/ffmpeg_/libavutil/avconfig.h @@ -2,4 +2,5 @@ #ifndef AVUTIL_AVCONFIG_H #define AVUTIL_AVCONFIG_H #define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 1 #endif /* AVUTIL_AVCONFIG_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/avstring.h b/3rdparty/include/ffmpeg_/libavutil/avstring.h index 01c2391b5..04d119738 100644 --- a/3rdparty/include/ffmpeg_/libavutil/avstring.h +++ b/3rdparty/include/ffmpeg_/libavutil/avstring.h @@ -114,4 +114,20 @@ size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...); */ char *av_d2str(double d); +/** + * Unescape the given string until a non escaped terminating char, + * and return the token corresponding to the unescaped string. + * + * The normal \ and ' escaping is supported. Leading and trailing + * whitespaces are removed, unless they are escaped with '\' or are + * enclosed between ''. + * + * @param buf the buffer to parse, buf will be updated to point to the + * terminating char + * @param term a 0-terminated list of terminating chars + * @return the malloced unescaped string, which must be av_freed by + * the user, NULL in case of allocation failure + */ +char *av_get_token(const char **buf, const char *term); + #endif /* AVUTIL_AVSTRING_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/avutil.h b/3rdparty/include/ffmpeg_/libavutil/avutil.h index e9e07b92f..8affad671 100644 --- a/3rdparty/include/ffmpeg_/libavutil/avutil.h +++ b/3rdparty/include/ffmpeg_/libavutil/avutil.h @@ -39,8 +39,8 @@ #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) -#define LIBAVUTIL_VERSION_MAJOR 50 -#define LIBAVUTIL_VERSION_MINOR 15 +#define LIBAVUTIL_VERSION_MAJOR 51 +#define LIBAVUTIL_VERSION_MINOR 9 #define LIBAVUTIL_VERSION_MICRO 1 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ @@ -54,17 +54,31 @@ #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) /** - * Returns the LIBAVUTIL_VERSION_INT constant. + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_OLD_EVAL_NAMES +#define FF_API_OLD_EVAL_NAMES (LIBAVUTIL_VERSION_MAJOR < 52) +#endif +#ifndef FF_API_GET_BITS_PER_SAMPLE_FMT +#define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 52) +#endif +#ifndef FF_API_FIND_OPT +#define FF_API_FIND_OPT (LIBAVUTIL_VERSION_MAJOR < 52) +#endif + +/** + * Return the LIBAVUTIL_VERSION_INT constant. */ unsigned avutil_version(void); /** - * Returns the libavutil build-time configuration. + * Return the libavutil build-time configuration. */ const char *avutil_configuration(void); /** - * Returns the libavutil license. + * Return the libavutil license. */ const char *avutil_license(void); @@ -78,6 +92,37 @@ enum AVMediaType { AVMEDIA_TYPE_NB }; +#define FF_LAMBDA_SHIFT 7 +#define FF_LAMBDA_SCALE (1< +#include /** - * Decodes the base64-encoded string in in and puts the decoded - * data in out. + * Decode a base64-encoded string. * - * @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 + * @param out buffer for decoded data + * @param in null-terminated input string + * @param out_size size in bytes of the out buffer, must be at + * least 3/4 of the length of in + * @return number of bytes written, or a negative value in case of + * invalid input */ int av_base64_decode(uint8_t *out, const char *in, int out_size); /** - * Encodes in base64 the data in in and puts the resulting string - * in out. + * Encode data to base64 and null-terminate. * - * @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 + * @param out buffer for encoded data + * @param out_size size in bytes of the output buffer, must be at + * least AV_BASE64_SIZE(in_size) + * @param in_size size in bytes of the 'in' buffer + * @return 'out' or NULL in case of error */ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); +/** + * Calculate the output size needed to base64-encode x bytes. + */ +#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) + #endif /* AVUTIL_BASE64_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/bswap.h b/3rdparty/include/ffmpeg_/libavutil/bswap.h new file mode 100644 index 000000000..303bcf353 --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/bswap.h @@ -0,0 +1,124 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * byte swapping routines + */ + +#ifndef AVUTIL_BSWAP_H +#define AVUTIL_BSWAP_H + +#include +#include "libavutil/avconfig.h" +#include "attributes.h" + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_ARM +# include "arm/bswap.h" +#elif ARCH_AVR32 +# include "avr32/bswap.h" +#elif ARCH_BFIN +# include "bfin/bswap.h" +#elif ARCH_SH4 +# include "sh4/bswap.h" +#elif ARCH_X86 +# include "x86/bswap.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) +#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) +#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) + +#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) + +#ifndef av_bswap16 +static av_always_inline av_const uint16_t av_bswap16(uint16_t x) +{ + x= (x>>8) | (x<<8); + return x; +} +#endif + +#ifndef av_bswap32 +static av_always_inline av_const uint32_t av_bswap32(uint32_t x) +{ + x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); + x= (x>>16) | (x<<16); + return x; +} +#endif + +#ifndef av_bswap64 +static inline uint64_t av_const av_bswap64(uint64_t x) +{ +#if 0 + x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL); + x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL); + return (x>>32) | (x<<32); +#else + union { + uint64_t ll; + uint32_t l[2]; + } w, r; + w.ll = x; + r.l[0] = av_bswap32 (w.l[1]); + r.l[1] = av_bswap32 (w.l[0]); + return r.ll; +#endif +} +#endif + +// be2ne ... big-endian to native-endian +// le2ne ... little-endian to native-endian + +#if AV_HAVE_BIGENDIAN +#define av_be2ne16(x) (x) +#define av_be2ne32(x) (x) +#define av_be2ne64(x) (x) +#define av_le2ne16(x) av_bswap16(x) +#define av_le2ne32(x) av_bswap32(x) +#define av_le2ne64(x) av_bswap64(x) +#define AV_BE2NEC(s, x) (x) +#define AV_LE2NEC(s, x) AV_BSWAPC(s, x) +#else +#define av_be2ne16(x) av_bswap16(x) +#define av_be2ne32(x) av_bswap32(x) +#define av_be2ne64(x) av_bswap64(x) +#define av_le2ne16(x) (x) +#define av_le2ne32(x) (x) +#define av_le2ne64(x) (x) +#define AV_BE2NEC(s, x) AV_BSWAPC(s, x) +#define AV_LE2NEC(s, x) (x) +#endif + +#define AV_BE2NE16C(x) AV_BE2NEC(16, x) +#define AV_BE2NE32C(x) AV_BE2NEC(32, x) +#define AV_BE2NE64C(x) AV_BE2NEC(64, x) +#define AV_LE2NE16C(x) AV_LE2NEC(16, x) +#define AV_LE2NE32C(x) AV_LE2NEC(32, x) +#define AV_LE2NE64C(x) AV_LE2NEC(64, x) + +#endif /* AVUTIL_BSWAP_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/common.h b/3rdparty/include/ffmpeg_/libavutil/common.h index 8a3375463..1cd2de290 100644 --- a/3rdparty/include/ffmpeg_/libavutil/common.h +++ b/3rdparty/include/ffmpeg_/libavutil/common.h @@ -28,22 +28,27 @@ #include #include -#ifdef _MSC_VER -#include -#else #include -#endif #include #include #include #include #include #include "attributes.h" +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif //rounded division & shift #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) /* assume b>0 */ #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) +#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b)) +#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b)) #define FFABS(a) ((a) >= 0 ? (a) : (-(a))) #define FFSIGN(a) ((a) > 0 ? 1 : -1) @@ -61,7 +66,7 @@ extern const uint8_t ff_log2_tab[256]; extern const uint8_t av_reverse[256]; -static inline av_const int av_log2_c(unsigned int v) +static av_always_inline av_const int av_log2_c(unsigned int v) { int n = 0; if (v & 0xffff0000) { @@ -77,7 +82,7 @@ static inline av_const int av_log2_c(unsigned int v) return n; } -static inline av_const int av_log2_16bit_c(unsigned int v) +static av_always_inline av_const int av_log2_16bit_c(unsigned int v) { int n = 0; if (v & 0xff00) { @@ -94,21 +99,17 @@ static inline av_const int av_log2_16bit_c(unsigned int v) # 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 +/* Pull in unguarded fallback defines at the end of this file. */ +#include "common.h" /** - * Clips a signed integer value into the amin-amax range. + * Clip a signed integer value into the amin-amax range. * @param a value to clip * @param amin minimum value of the clip range * @param amax maximum value of the clip range * @return clipped value */ -static inline av_const int av_clip(int a, int amin, int amax) +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) { if (a < amin) return amin; else if (a > amax) return amax; @@ -116,87 +117,122 @@ static inline av_const int av_clip(int a, int amin, int amax) } /** - * Clips a signed integer value into the 0-255 range. + * Clip a signed integer value into the 0-255 range. * @param a value to clip * @return clipped value */ -static inline av_const uint8_t av_clip_uint8(int a) +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) { if (a&(~0xFF)) return (-a)>>31; else return a; } /** - * Clips a signed integer value into the 0-65535 range. + * Clip a signed integer value into the -128,127 range. * @param a value to clip * @return clipped value */ -static inline av_const uint16_t av_clip_uint16(int a) +static av_always_inline av_const int8_t av_clip_int8_c(int a) +{ + if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F; + else return a; +} + +/** + * Clip a signed integer value into the 0-65535 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) { if (a&(~0xFFFF)) return (-a)>>31; else return a; } /** - * Clips a signed integer value into the -32768,32767 range. + * Clip a signed integer value into the -32768,32767 range. * @param a value to clip * @return clipped value */ -static inline av_const int16_t av_clip_int16(int a) +static av_always_inline av_const int16_t av_clip_int16_c(int a) { if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF; else return a; } /** - * Clips a signed 64-bit integer value into the -2147483648,2147483647 range. + * Clip 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) +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) { if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF; else return a; } /** - * Clips a float value into the amin-amax range. + * Clip a signed integer to an unsigned power of two range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) +{ + if (a & ~((1<> 31 & ((1< amax) return amax; else return a; } -/** Computes ceil(log2(x)). +/** Compute 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) +static av_always_inline av_const int av_ceil_log2_c(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)) +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount_c(uint32_t x) +{ + x -= (x >> 1) & 0x55555555; + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0F0F0F0F; + x += x >> 8; + return (x + (x >> 16)) & 0x3F; +} -/*! - * \def GET_UTF8(val, GET_BYTE, ERROR) - * Converts a UTF-8 character (up to 4 bytes long) to its 32-bit UCS-4 encoded form - * \param val is the output and should be of type uint32_t. It holds the converted - * UCS-4 character and should be a left value. - * \param GET_BYTE gets UTF-8 encoded bytes from any proper source. It can be - * a function or a statement whose return value or evaluated value is of type - * uint8_t. It will be executed up to 4 times for values in the valid UTF-8 range, - * and up to 7 times in the general case. - * \param ERROR action that should be taken when an invalid UTF-8 byte is returned - * from GET_BYTE. It should be a statement that jumps out of the macro, - * like exit(), goto, return, break, or continue. +#define 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)) + +/** + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_BYTE Expression reading one byte from the input. + * Evaluated up to 7 times (4 for the currently + * assigned Unicode range). With a memory buffer + * input, this could be *ptr++. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. */ #define GET_UTF8(val, GET_BYTE, ERROR)\ val= GET_BYTE;\ @@ -213,17 +249,14 @@ static inline av_const int av_ceil_log2(int x) }\ } -/*! - * \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. +/** + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted + * to native byte order. Evaluated one or two times. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. */ #define GET_UTF16(val, GET_16BIT, ERROR)\ val = GET_16BIT;\ @@ -239,7 +272,7 @@ static inline av_const int av_ceil_log2(int x) /*! * \def PUT_UTF8(val, tmp, PUT_BYTE) - * Converts a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). * \param val is an input-only argument and should be of type uint32_t. It holds * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If * val is given as a function it is executed only once. @@ -275,7 +308,7 @@ static inline av_const int av_ceil_log2(int x) /*! * \def PUT_UTF16(val, tmp, PUT_16BIT) - * Converts a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). + * Convert 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. @@ -310,3 +343,45 @@ static inline av_const int av_ceil_log2(int x) #endif /* HAVE_AV_CONFIG_H */ #endif /* AVUTIL_COMMON_H */ + +/* + * The following definitions are outside the multiple inclusion guard + * to ensure they are immediately available in intmath.h. + */ + +#ifndef av_log2 +# define av_log2 av_log2_c +#endif +#ifndef av_log2_16bit +# define av_log2_16bit av_log2_16bit_c +#endif +#ifndef av_ceil_log2 +# define av_ceil_log2 av_ceil_log2_c +#endif +#ifndef av_clip +# define av_clip av_clip_c +#endif +#ifndef av_clip_uint8 +# define av_clip_uint8 av_clip_uint8_c +#endif +#ifndef av_clip_int8 +# define av_clip_int8 av_clip_int8_c +#endif +#ifndef av_clip_uint16 +# define av_clip_uint16 av_clip_uint16_c +#endif +#ifndef av_clip_int16 +# define av_clip_int16 av_clip_int16_c +#endif +#ifndef av_clipl_int32 +# define av_clipl_int32 av_clipl_int32_c +#endif +#ifndef av_clip_uintp2 +# define av_clip_uintp2 av_clip_uintp2_c +#endif +#ifndef av_clipf +# define av_clipf av_clipf_c +#endif +#ifndef av_popcount +# define av_popcount av_popcount_c +#endif diff --git a/3rdparty/include/ffmpeg_/libavutil/cpu.h b/3rdparty/include/ffmpeg_/libavutil/cpu.h new file mode 100644 index 000000000..da93fb5f6 --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/cpu.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CPU_H +#define AVUTIL_CPU_H + +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ + + /* lower 16 bits - CPU features */ +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_IWMMXT 0x0100 ///< XScale IWMMXT +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard + +/** + * Return the flags which specify extensions supported by the CPU. + */ +int av_get_cpu_flags(void); + + +/** + * Disables cpu detection and forces the specified flags. + */ +void av_force_cpu_flags(int flags); + + +/* The following CPU-specific functions shall not be called directly. */ +int ff_get_cpu_flags_arm(void); +int ff_get_cpu_flags_ppc(void); +int ff_get_cpu_flags_x86(void); + +#endif /* AVUTIL_CPU_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/crc.h b/3rdparty/include/ffmpeg_/libavutil/crc.h index 13fa22d85..6c0baab5a 100644 --- a/3rdparty/include/ffmpeg_/libavutil/crc.h +++ b/3rdparty/include/ffmpeg_/libavutil/crc.h @@ -21,7 +21,7 @@ #ifndef AVUTIL_CRC_H #define AVUTIL_CRC_H -#include +#include #include #include "attributes.h" diff --git a/3rdparty/include/ffmpeg_/libavutil/dict.h b/3rdparty/include/ffmpeg_/libavutil/dict.h new file mode 100644 index 000000000..0a206a0a9 --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/dict.h @@ -0,0 +1,81 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Public dictionary API. + */ + +#ifndef AVUTIL_DICT_H +#define AVUTIL_DICT_H + +#define AV_DICT_MATCH_CASE 1 +#define AV_DICT_IGNORE_SUFFIX 2 +#define AV_DICT_DONT_STRDUP_KEY 4 +#define AV_DICT_DONT_STRDUP_VAL 8 +#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. */ + +typedef struct { + char *key; + char *value; +} AVDictionaryEntry; + +typedef struct AVDictionary AVDictionary; + +/** + * Get a dictionary entry with matching key. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param flags Allows case as well as suffix-insensitive comparisons. + * @return Found entry or NULL, changing key or value leads to undefined behavior. + */ +AVDictionaryEntry * +av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); + +/** + * Set the given entry in *pm, overwriting an existing entry. + * + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL + * a dictionary struct is allocated and put in *pm. + * @param key entry key to add to *pm (will be av_strduped depending on flags) + * @param value entry value to add to *pm (will be av_strduped depending on flags). + * Passing a NULL value will cause an existing tag to be deleted. + * @return >= 0 on success otherwise an error code <0 + */ +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); + +/** + * Copy entries from one AVDictionary struct into another. + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, + * this function will allocate a struct for you and put it in *dst + * @param src pointer to source AVDictionary struct + * @param flags flags to use when setting entries in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + */ +void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); + +/** + * Free all the memory allocated for an AVDictionary struct. + */ +void av_dict_free(AVDictionary **m); + +#endif // AVUTIL_DICT_H diff --git a/3rdparty/include/ffmpeg_/libavutil/error.h b/3rdparty/include/ffmpeg_/libavutil/error.h index 13a9a3593..47d366ebb 100644 --- a/3rdparty/include/ffmpeg_/libavutil/error.h +++ b/3rdparty/include/ffmpeg_/libavutil/error.h @@ -37,32 +37,28 @@ #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 +#define AVERROR_BSF_NOT_FOUND (-MKTAG(0xF8,'B','S','F')) ///< Bitstream filter not found +#define AVERROR_DECODER_NOT_FOUND (-MKTAG(0xF8,'D','E','C')) ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND (-MKTAG(0xF8,'D','E','M')) ///< Demuxer not found +#define AVERROR_ENCODER_NOT_FOUND (-MKTAG(0xF8,'E','N','C')) ///< Encoder not found +#define AVERROR_EOF (-MKTAG( 'E','O','F',' ')) ///< End of file +#define AVERROR_EXIT (-MKTAG( 'E','X','I','T')) ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_FILTER_NOT_FOUND (-MKTAG(0xF8,'F','I','L')) ///< Filter not found +#define AVERROR_INVALIDDATA (-MKTAG( 'I','N','D','A')) ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND (-MKTAG(0xF8,'M','U','X')) ///< Muxer not found +#define AVERROR_OPTION_NOT_FOUND (-MKTAG(0xF8,'O','P','T')) ///< Option not found +#define AVERROR_PATCHWELCOME (-MKTAG( 'P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome +#define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8,'P','R','O')) ///< Protocol not found +#define AVERROR_STREAM_NOT_FOUND (-MKTAG(0xF8,'S','T','R')) ///< Stream not found /** - * Puts a description of the AVERROR code errnum in errbuf. + * Put 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 errnum error code to describe + * @param errbuf buffer to which description is written * @param errbuf_size the size in bytes of errbuf * @return 0 on success, a negative value if a description for errnum * cannot be found diff --git a/3rdparty/include/ffmpeg_/libavutil/eval.h b/3rdparty/include/ffmpeg_/libavutil/eval.h new file mode 100644 index 000000000..ee378a29b --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/eval.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2002 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple arithmetic expression evaluator + */ + +#ifndef AVUTIL_EVAL_H +#define AVUTIL_EVAL_H + +#include "avutil.h" + +typedef struct AVExpr AVExpr; + +/** + * Parse and evaluate an expression. + * Note, this is significantly slower than av_expr_eval(). + * + * @param res a pointer to a double where is put the result value of + * the expression, or NAN in case of error + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param const_values a zero terminated array of values for the identifiers from const_names + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @param log_ctx parent logging context + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse_and_eval(double *res, const char *s, + const char * const *const_names, const double *const_values, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + void *opaque, int log_offset, void *log_ctx); + +/** + * Parse an expression. + * + * @param expr a pointer where is put an AVExpr containing the parsed + * value in case of successfull parsing, or NULL otherwise. + * The pointed to AVExpr must be freed with av_expr_free() by the user + * when it is not needed anymore. + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param log_ctx parent logging context + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse(AVExpr **expr, const char *s, + const char * const *const_names, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + int log_offset, void *log_ctx); + +/** + * Evaluate a previously parsed expression. + * + * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @return the value of the expression + */ +double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); + +/** + * Free a parsed expression previously created with av_expr_parse(). + */ +void av_expr_free(AVExpr *e); + +#if FF_API_OLD_EVAL_NAMES +/** + * @deprecated Deprecated in favor of av_expr_parse_and_eval(). + */ +attribute_deprecated +int av_parse_and_eval_expr(double *res, const char *s, + const char * const *const_names, const double *const_values, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + void *opaque, int log_offset, void *log_ctx); + +/** + * @deprecated Deprecated in favor of av_expr_parse(). + */ +attribute_deprecated +int av_parse_expr(AVExpr **expr, const char *s, + const char * const *const_names, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + int log_offset, void *log_ctx); +/** + * @deprecated Deprecated in favor of av_expr_eval(). + */ +attribute_deprecated +double av_eval_expr(AVExpr *e, const double *const_values, void *opaque); + +/** + * @deprecated Deprecated in favor of av_expr_free(). + */ +attribute_deprecated +void av_free_expr(AVExpr *e); +#endif /* FF_API_OLD_EVAL_NAMES */ + +/** + * Parse the string in numstr and return its value as a double. If + * the string is empty, contains only whitespaces, or does not contain + * an initial substring that has the expected syntax for a + * floating-point number, no conversion is performed. In this case, + * returns a value of zero and the value returned in tail is the value + * of numstr. + * + * @param numstr a string representing a number, may contain one of + * the International System number postfixes, for example 'K', 'M', + * 'G'. If 'i' is appended after the postfix, powers of 2 are used + * instead of powers of 10. The 'B' postfix multiplies the value for + * 8, and can be appended after another postfix or used alone. This + * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. + * @param tail if non-NULL puts here the pointer to the char next + * after the last parsed character + */ +double av_strtod(const char *numstr, char **tail); + +#endif /* AVUTIL_EVAL_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/fifo.h b/3rdparty/include/ffmpeg_/libavutil/fifo.h index a3531ebc9..999d0bf89 100644 --- a/3rdparty/include/ffmpeg_/libavutil/fifo.h +++ b/3rdparty/include/ffmpeg_/libavutil/fifo.h @@ -24,7 +24,7 @@ #ifndef AVUTIL_FIFO_H #define AVUTIL_FIFO_H -#include +#include typedef struct AVFifoBuffer { uint8_t *buffer; @@ -33,26 +33,26 @@ typedef struct AVFifoBuffer { } AVFifoBuffer; /** - * Initializes an AVFifoBuffer. + * Initialize an AVFifoBuffer. * @param size of FIFO * @return AVFifoBuffer or NULL in case of memory allocation failure */ AVFifoBuffer *av_fifo_alloc(unsigned int size); /** - * Frees an AVFifoBuffer. + * Free an AVFifoBuffer. * @param *f AVFifoBuffer to free */ void av_fifo_free(AVFifoBuffer *f); /** - * Resets the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. + * Reset 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 + * Return the amount of data in bytes in the AVFifoBuffer, that is the * amount of data you can read from it. * @param *f AVFifoBuffer to read from * @return size @@ -60,7 +60,7 @@ void av_fifo_reset(AVFifoBuffer *f); int av_fifo_size(AVFifoBuffer *f); /** - * Returns the amount of space in bytes in the AVFifoBuffer, that is the + * Return 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 @@ -68,7 +68,7 @@ int av_fifo_size(AVFifoBuffer *f); int av_fifo_space(AVFifoBuffer *f); /** - * Feeds data from an AVFifoBuffer to a user-supplied callback. + * Feed data from an AVFifoBuffer to a user-supplied callback. * @param *f AVFifoBuffer to read from * @param buf_size number of bytes to read * @param *func generic read function @@ -77,7 +77,7 @@ int av_fifo_space(AVFifoBuffer *f); 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. + * Feed data from a user-supplied callback to an AVFifoBuffer. * @param *f AVFifoBuffer to write to * @param *src data source; non-const since it may be used as a * modifiable context by the function defined in func @@ -92,7 +92,7 @@ int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func) int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); /** - * Resizes an AVFifoBuffer. + * Resize an AVFifoBuffer. * @param *f AVFifoBuffer to resize * @param size new AVFifoBuffer size in bytes * @return <0 for failure, >=0 otherwise @@ -100,7 +100,7 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); /** - * Reads and discards the specified amount of data from an AVFifoBuffer. + * Read and discard the specified amount of data from an AVFifoBuffer. * @param *f AVFifoBuffer to read from * @param size amount of data to read in bytes */ diff --git a/3rdparty/include/ffmpeg_/libavutil/file.h b/3rdparty/include/ffmpeg_/libavutil/file.h new file mode 100644 index 000000000..f28627c9d --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/file.h @@ -0,0 +1,52 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_FILE_H +#define AVUTIL_FILE_H + +#include "avutil.h" + +/** + * @file + * Misc file utilities. + */ + +/** + * Read the file with name filename, and put its content in a newly + * allocated buffer or map it with mmap() when available. + * In case of success set *bufptr to the read or mmapped buffer, and + * *size to the size in bytes of the buffer in *bufptr. + * The returned buffer must be released with av_file_unmap(). + * + * @param log_offset loglevel offset used for logging + * @param log_ctx context used for logging + * @return a non negative number in case of success, a negative value + * corresponding to an AVERROR error code in case of failure + */ +int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, + int log_offset, void *log_ctx); + +/** + * Unmap or free the buffer bufptr created by av_file_map(). + * + * @param size size in bytes of bufptr, must be the same as returned + * by av_file_map() + */ +void av_file_unmap(uint8_t *bufptr, size_t size); + +#endif /* AVUTIL_FILE_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/imgutils.h b/3rdparty/include/ffmpeg_/libavutil/imgutils.h new file mode 100644 index 000000000..12fe1c685 --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/imgutils.h @@ -0,0 +1,130 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_IMGUTILS_H +#define AVUTIL_IMGUTILS_H + +/** + * @file + * misc image utilities + */ + +#include "avutil.h" +#include "pixdesc.h" + +/** + * Compute the max pixel step for each plane of an image with a + * format described by pixdesc. + * + * The pixel step is the distance in bytes between the first byte of + * the group of bytes which describe a pixel component and the first + * byte of the successive group in the same plane for the same + * component. + * + * @param max_pixsteps an array which is filled with the max pixel step + * for each plane. Since a plane may contain different pixel + * components, the computed max_pixsteps[plane] is relative to the + * component in the plane with the max pixel step. + * @param max_pixstep_comps an array which is filled with the component + * for each plane which has the max pixel step. May be NULL. + */ +void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc); + +/** + * Compute the size of an image line with format pix_fmt and width + * width for the plane plane. + * + * @return the computed size in bytes + */ +int av_image_get_linesize(enum PixelFormat pix_fmt, int width, int plane); + +/** + * Fill plane linesizes for an image with pixel format pix_fmt and + * width width. + * + * @param linesizes array to be filled with the linesize for each plane + * @return >= 0 in case of success, a negative error code otherwise + */ +int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width); + +/** + * Fill plane data pointers for an image with pixel format pix_fmt and + * height height. + * + * @param data pointers array to be filled with the pointer for each image plane + * @param ptr the pointer to a buffer which will contain the image + * @param linesizes the array containing the linesize for each + * plane, should be filled by av_image_fill_linesizes() + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int height, + uint8_t *ptr, const int linesizes[4]); + +/** + * Allocate an image with size w and h and pixel format pix_fmt, and + * fill pointers and linesizes accordingly. + * The allocated image buffer has to be freed by using + * av_freep(&pointers[0]). + * + * @param align the value to use for buffer size alignment + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_alloc(uint8_t *pointers[4], int linesizes[4], + int w, int h, enum PixelFormat pix_fmt, int align); + +/** + * Copy image plane from src to dst. + * That is, copy "height" number of lines of "bytewidth" bytes each. + * The first byte of each successive line is separated by *_linesize + * bytes. + * + * @param dst_linesize linesize for the image plane in dst + * @param src_linesize linesize for the image plane in src + */ +void av_image_copy_plane(uint8_t *dst, int dst_linesize, + const uint8_t *src, int src_linesize, + int bytewidth, int height); + +/** + * Copy image in src_data to dst_data. + * + * @param dst_linesize linesizes for the image in dst_data + * @param src_linesize linesizes for the image in src_data + */ +void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], + const uint8_t *src_data[4], const int src_linesizes[4], + enum PixelFormat pix_fmt, int width, int height); + +/** + * Check if the given dimension of an image is valid, meaning that all + * bytes of the image can be addressed with a signed int. + * + * @param w the width of the picture + * @param h the height of the picture + * @param log_offset the offset to sum to the log level for logging with log_ctx + * @param log_ctx the parent logging context, it may be NULL + * @return >= 0 if valid, a negative error code otherwise + */ +int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); + +int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt); + +#endif /* AVUTIL_IMGUTILS_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/intfloat_readwrite.h b/3rdparty/include/ffmpeg_/libavutil/intfloat_readwrite.h index 0f156768c..1b80fc6e9 100644 --- a/3rdparty/include/ffmpeg_/libavutil/intfloat_readwrite.h +++ b/3rdparty/include/ffmpeg_/libavutil/intfloat_readwrite.h @@ -21,7 +21,7 @@ #ifndef AVUTIL_INTFLOAT_READWRITE_H #define AVUTIL_INTFLOAT_READWRITE_H -#include +#include #include "attributes.h" /* IEEE 80 bits extended float */ diff --git a/3rdparty/include/ffmpeg_/libavutil/intreadwrite.h b/3rdparty/include/ffmpeg_/libavutil/intreadwrite.h new file mode 100644 index 000000000..09d796c8b --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/intreadwrite.h @@ -0,0 +1,522 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTREADWRITE_H +#define AVUTIL_INTREADWRITE_H + +#include +#include "libavutil/avconfig.h" +#include "attributes.h" +#include "bswap.h" + +typedef union { + uint64_t u64; + uint32_t u32[2]; + uint16_t u16[4]; + uint8_t u8 [8]; + double f64; + float f32[2]; +} av_alias av_alias64; + +typedef union { + uint32_t u32; + uint16_t u16[2]; + uint8_t u8 [4]; + float f32; +} av_alias av_alias32; + +typedef union { + uint16_t u16; + uint8_t u8 [2]; +} av_alias av_alias16; + +/* + * Arch-specific headers can provide any combination of + * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. + * Preprocessor symbols must be defined, even if these are implemented + * as inline functions. + */ + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_ARM +# include "arm/intreadwrite.h" +#elif ARCH_AVR32 +# include "avr32/intreadwrite.h" +#elif ARCH_MIPS +# include "mips/intreadwrite.h" +#elif ARCH_PPC +# include "ppc/intreadwrite.h" +#elif ARCH_TOMI +# include "tomi/intreadwrite.h" +#elif ARCH_X86 +# include "x86/intreadwrite.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +/* + * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. + */ + +#if AV_HAVE_BIGENDIAN + +# if defined(AV_RN16) && !defined(AV_RB16) +# define AV_RB16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RB16) +# define AV_RN16(p) AV_RB16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WB16) +# define AV_WB16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WB16) +# define AV_WN16(p, v) AV_WB16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RB24) +# define AV_RB24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RB24) +# define AV_RN24(p) AV_RB24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WB24) +# define AV_WB24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WB24) +# define AV_WN24(p, v) AV_WB24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RB32) +# define AV_RB32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RB32) +# define AV_RN32(p) AV_RB32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WB32) +# define AV_WB32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WB32) +# define AV_WN32(p, v) AV_WB32(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RB64) +# define AV_RB64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RB64) +# define AV_RN64(p) AV_RB64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WB64) +# define AV_WB64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WB64) +# define AV_WN64(p, v) AV_WB64(p, v) +# endif + +#else /* AV_HAVE_BIGENDIAN */ + +# if defined(AV_RN16) && !defined(AV_RL16) +# define AV_RL16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RL16) +# define AV_RN16(p) AV_RL16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WL16) +# define AV_WL16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WL16) +# define AV_WN16(p, v) AV_WL16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RL24) +# define AV_RL24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RL24) +# define AV_RN24(p) AV_RL24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WL24) +# define AV_WL24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WL24) +# define AV_WN24(p, v) AV_WL24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RL32) +# define AV_RL32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RL32) +# define AV_RN32(p) AV_RL32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WL32) +# define AV_WL32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WL32) +# define AV_WN32(p, v) AV_WL32(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RL64) +# define AV_RL64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RL64) +# define AV_RN64(p) AV_RL64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WL64) +# define AV_WL64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WL64) +# define AV_WN64(p, v) AV_WL64(p, v) +# endif + +#endif /* !AV_HAVE_BIGENDIAN */ + +/* + * Define AV_[RW]N helper macros to simplify definitions not provided + * by per-arch headers. + */ + +#if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__) + +union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; +union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; +union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; + +# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) +# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) + +#elif defined(__DECC) + +# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) +# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) + +#elif AV_HAVE_FAST_UNALIGNED + +# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) +# define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#else + +#ifndef AV_RB16 +# define AV_RB16(x) \ + ((((const uint8_t*)(x))[0] << 8) | \ + ((const uint8_t*)(x))[1]) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, d) do { \ + ((uint8_t*)(p))[1] = (d); \ + ((uint8_t*)(p))[0] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RL16 +# define AV_RL16(x) \ + ((((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RB32 +# define AV_RB32(x) \ + (((uint32_t)((const uint8_t*)(x))[0] << 24) | \ + (((const uint8_t*)(x))[1] << 16) | \ + (((const uint8_t*)(x))[2] << 8) | \ + ((const uint8_t*)(x))[3]) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, d) do { \ + ((uint8_t*)(p))[3] = (d); \ + ((uint8_t*)(p))[2] = (d)>>8; \ + ((uint8_t*)(p))[1] = (d)>>16; \ + ((uint8_t*)(p))[0] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RL32 +# define AV_RL32(x) \ + (((uint32_t)((const uint8_t*)(x))[3] << 24) | \ + (((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RB64 +# define AV_RB64(x) \ + (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 8) | \ + (uint64_t)((const uint8_t*)(x))[7]) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, d) do { \ + ((uint8_t*)(p))[7] = (d); \ + ((uint8_t*)(p))[6] = (d)>>8; \ + ((uint8_t*)(p))[5] = (d)>>16; \ + ((uint8_t*)(p))[4] = (d)>>24; \ + ((uint8_t*)(p))[3] = (d)>>32; \ + ((uint8_t*)(p))[2] = (d)>>40; \ + ((uint8_t*)(p))[1] = (d)>>48; \ + ((uint8_t*)(p))[0] = (d)>>56; \ + } while(0) +#endif + +#ifndef AV_RL64 +# define AV_RL64(x) \ + (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ + (uint64_t)((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + ((uint8_t*)(p))[4] = (d)>>32; \ + ((uint8_t*)(p))[5] = (d)>>40; \ + ((uint8_t*)(p))[6] = (d)>>48; \ + ((uint8_t*)(p))[7] = (d)>>56; \ + } while(0) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RN(s, p) AV_RB##s(p) +# define AV_WN(s, p, v) AV_WB##s(p, v) +#else +# define AV_RN(s, p) AV_RL##s(p) +# define AV_WN(s, p, v) AV_WL##s(p, v) +#endif + +#endif /* HAVE_FAST_UNALIGNED */ + +#ifndef AV_RN16 +# define AV_RN16(p) AV_RN(16, p) +#endif + +#ifndef AV_RN32 +# define AV_RN32(p) AV_RN(32, p) +#endif + +#ifndef AV_RN64 +# define AV_RN64(p) AV_RN(64, p) +#endif + +#ifndef AV_WN16 +# define AV_WN16(p, v) AV_WN(16, p, v) +#endif + +#ifndef AV_WN32 +# define AV_WN32(p, v) AV_WN(32, p, v) +#endif + +#ifndef AV_WN64 +# define AV_WN64(p, v) AV_WN(64, p, v) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RB(s, p) AV_RN##s(p) +# define AV_WB(s, p, v) AV_WN##s(p, v) +# define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) +#else +# define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) +# define AV_RL(s, p) AV_RN##s(p) +# define AV_WL(s, p, v) AV_WN##s(p, v) +#endif + +#define AV_RB8(x) (((const uint8_t*)(x))[0]) +#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) + +#define AV_RL8(x) AV_RB8(x) +#define AV_WL8(p, d) AV_WB8(p, d) + +#ifndef AV_RB16 +# define AV_RB16(p) AV_RB(16, p) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, v) AV_WB(16, p, v) +#endif + +#ifndef AV_RL16 +# define AV_RL16(p) AV_RL(16, p) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, v) AV_WL(16, p, v) +#endif + +#ifndef AV_RB32 +# define AV_RB32(p) AV_RB(32, p) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, v) AV_WB(32, p, v) +#endif + +#ifndef AV_RL32 +# define AV_RL32(p) AV_RL(32, p) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, v) AV_WL(32, p, v) +#endif + +#ifndef AV_RB64 +# define AV_RB64(p) AV_RB(64, p) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, v) AV_WB(64, p, v) +#endif + +#ifndef AV_RL64 +# define AV_RL64(p) AV_RL(64, p) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, v) AV_WL(64, p, v) +#endif + +#ifndef AV_RB24 +# define AV_RB24(x) \ + ((((const uint8_t*)(x))[0] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[2]) +#endif +#ifndef AV_WB24 +# define AV_WB24(p, d) do { \ + ((uint8_t*)(p))[2] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[0] = (d)>>16; \ + } while(0) +#endif + +#ifndef AV_RL24 +# define AV_RL24(x) \ + ((((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL24 +# define AV_WL24(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + } while(0) +#endif + +/* + * The AV_[RW]NA macros access naturally aligned data + * in a type-safe way. + */ + +#define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) +#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#ifndef AV_RN16A +# define AV_RN16A(p) AV_RNA(16, p) +#endif + +#ifndef AV_RN32A +# define AV_RN32A(p) AV_RNA(32, p) +#endif + +#ifndef AV_RN64A +# define AV_RN64A(p) AV_RNA(64, p) +#endif + +#ifndef AV_WN16A +# define AV_WN16A(p, v) AV_WNA(16, p, v) +#endif + +#ifndef AV_WN32A +# define AV_WN32A(p, v) AV_WNA(32, p, v) +#endif + +#ifndef AV_WN64A +# define AV_WN64A(p, v) AV_WNA(64, p, v) +#endif + +/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be + * naturally aligned. They may be implemented using MMX, + * so emms_c() must be called before using any float code + * afterwards. + */ + +#define AV_COPY(n, d, s) \ + (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) + +#ifndef AV_COPY16 +# define AV_COPY16(d, s) AV_COPY(16, d, s) +#endif + +#ifndef AV_COPY32 +# define AV_COPY32(d, s) AV_COPY(32, d, s) +#endif + +#ifndef AV_COPY64 +# define AV_COPY64(d, s) AV_COPY(64, d, s) +#endif + +#ifndef AV_COPY128 +# define AV_COPY128(d, s) \ + do { \ + AV_COPY64(d, s); \ + AV_COPY64((char*)(d)+8, (char*)(s)+8); \ + } while(0) +#endif + +#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) + +#ifndef AV_SWAP64 +# define AV_SWAP64(a, b) AV_SWAP(64, a, b) +#endif + +#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) + +#ifndef AV_ZERO16 +# define AV_ZERO16(d) AV_ZERO(16, d) +#endif + +#ifndef AV_ZERO32 +# define AV_ZERO32(d) AV_ZERO(32, d) +#endif + +#ifndef AV_ZERO64 +# define AV_ZERO64(d) AV_ZERO(64, d) +#endif + +#ifndef AV_ZERO128 +# define AV_ZERO128(d) \ + do { \ + AV_ZERO64(d); \ + AV_ZERO64((char*)(d)+8); \ + } while(0) +#endif + +#endif /* AVUTIL_INTREADWRITE_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/lfg.h b/3rdparty/include/ffmpeg_/libavutil/lfg.h new file mode 100644 index 000000000..854ffce73 --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/lfg.h @@ -0,0 +1,62 @@ +/* + * Lagged Fibonacci PRNG + * Copyright (c) 2008 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LFG_H +#define AVUTIL_LFG_H + +typedef struct { + unsigned int state[64]; + int index; +} AVLFG; + +void av_lfg_init(AVLFG *c, unsigned int seed); + +/** + * Get the next random unsigned 32-bit number using an ALFG. + * + * Please also consider a simple LCG like state= state*1664525+1013904223, + * it may be good enough and faster for your specific use case. + */ +static inline unsigned int av_lfg_get(AVLFG *c){ + c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; + return c->state[c->index++ & 63]; +} + +/** + * Get the next random unsigned 32-bit number using a MLFG. + * + * Please also consider av_lfg_get() above, it is faster. + */ +static inline unsigned int av_mlfg_get(AVLFG *c){ + unsigned int a= c->state[(c->index-55) & 63]; + unsigned int b= c->state[(c->index-24) & 63]; + return c->state[c->index++ & 63] = 2*a*b+a+b; +} + +/** + * Get the next two numbers generated by a Box-Muller Gaussian + * generator using the random numbers issued by lfg. + * + * @param out array where the two generated numbers are placed + */ +void av_bmg_get(AVLFG *lfg, double out[2]); + +#endif /* AVUTIL_LFG_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/log.h b/3rdparty/include/ffmpeg_/libavutil/log.h index 1c3e49013..53c8aa0f6 100644 --- a/3rdparty/include/ffmpeg_/libavutil/log.h +++ b/3rdparty/include/ffmpeg_/libavutil/log.h @@ -25,7 +25,7 @@ #include "avutil.h" /** - * Describes the class of an AVClass context structure. That is an + * Describe the class of an AVClass context structure. That is an * arbitrary struct of which the first field is a pointer to an * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). */ @@ -56,6 +56,27 @@ typedef struct { */ int version; + + /** + * Offset in the structure where log_level_offset is stored. + * 0 means there is no such variable + */ + int log_level_offset_offset; + + /** + * Offset in the structure where a pointer to the parent context for loging is stored. + * for example a decoder that uses eval.c could pass its AVCodecContext to eval as such + * parent context. And a av_log() implementation could then display the parent context + * can be NULL of course + */ + int parent_log_context_offset; + + /** + * A function for extended searching, e.g. in possible + * children objects. + */ + const struct AVOption* (*opt_find)(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags); } AVClass; /* av_log API */ @@ -95,7 +116,7 @@ typedef struct { #define AV_LOG_DEBUG 48 /** - * Sends the specified message to the log if the level is less than or equal + * Send the specified message to the log if the level is less than or equal * to the current av_log_level. By default, all logging messages are sent to * stderr. This behavior can be altered by setting a different av_vlog callback * function. @@ -109,15 +130,38 @@ typedef struct { * @see av_vlog */ #ifdef __GNUC__ -void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); +void av_log(void *avcl, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); #else -void av_log(void*, int level, const char *fmt, ...); +void av_log(void *avcl, int level, const char *fmt, ...); #endif -void av_vlog(void*, int level, const char *fmt, va_list); +void av_vlog(void *avcl, int level, const char *fmt, va_list); int av_log_get_level(void); void av_log_set_level(int); void av_log_set_callback(void (*)(void*, int, const char*, va_list)); void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); +const char* av_default_item_name(void* ctx); + +/** + * av_dlog macros + * Useful to print debug messages that shouldn't get compiled in normally. + */ + +#ifdef DEBUG +# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) +#else +# define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) +#endif + +/** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end + */ +#define AV_LOG_SKIP_REPEATED 1 +void av_log_set_flags(int arg); #endif /* AVUTIL_LOG_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/lzo.h b/3rdparty/include/ffmpeg_/libavutil/lzo.h index 374f530a7..7fa3bd2f8 100644 --- a/3rdparty/include/ffmpeg_/libavutil/lzo.h +++ b/3rdparty/include/ffmpeg_/libavutil/lzo.h @@ -22,9 +22,9 @@ #ifndef AVUTIL_LZO_H #define AVUTIL_LZO_H -#include +#include -/** \defgroup errflags Error flags returned by av_lzo1x_decode +/** @name Error flags returned by av_lzo1x_decode * \{ */ //! end of the input buffer reached before decoding finished #define AV_LZO_INPUT_DEPLETED 1 diff --git a/3rdparty/include/ffmpeg_/libavutil/mathematics.h b/3rdparty/include/ffmpeg_/libavutil/mathematics.h index afa8333f9..882a51639 100644 --- a/3rdparty/include/ffmpeg_/libavutil/mathematics.h +++ b/3rdparty/include/ffmpeg_/libavutil/mathematics.h @@ -21,7 +21,7 @@ #ifndef AVUTIL_MATHEMATICS_H #define AVUTIL_MATHEMATICS_H -#include +#include #include #include "attributes.h" #include "rational.h" @@ -38,6 +38,9 @@ #ifndef M_LOG2_10 #define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ #endif +#ifndef M_PHI +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ +#endif #ifndef M_PI #define M_PI 3.14159265358979323846 /* pi */ #endif @@ -63,36 +66,47 @@ enum AVRounding { }; /** - * Returns the greatest common divisor of a and b. + * Return 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); /** - * Rescales a 64-bit integer with rounding to nearest. + * Rescale a 64-bit integer with rounding to nearest. * A simple a*b/c isn't possible as it can overflow. */ int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; /** - * Rescales a 64-bit integer with specified rounding. + * Rescale a 64-bit integer with specified rounding. * A simple a*b/c isn't possible as it can overflow. */ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; /** - * Rescales a 64-bit integer by 2 rational numbers. + * Rescale a 64-bit integer by 2 rational numbers. */ int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; /** - * Compares 2 timestamps each in its own timebases. + * Compare 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); +/** + * Compare 2 integers modulo mod. + * That is we compare integers a and b for which only the least + * significant log2(mod) bits are known. + * + * @param mod must be a power of 2 + * @return a negative value if a is smaller than b + * a positive value if a is greater than b + * 0 if a equals b + */ +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); #endif /* AVUTIL_MATHEMATICS_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/md5.h b/3rdparty/include/ffmpeg_/libavutil/md5.h index ccb8dae70..969202a80 100644 --- a/3rdparty/include/ffmpeg_/libavutil/md5.h +++ b/3rdparty/include/ffmpeg_/libavutil/md5.h @@ -21,7 +21,7 @@ #ifndef AVUTIL_MD5_H #define AVUTIL_MD5_H -#include +#include extern const int av_md5_size; diff --git a/3rdparty/include/ffmpeg_/libavutil/mem.h b/3rdparty/include/ffmpeg_/libavutil/mem.h index 148879270..7c30e160f 100644 --- a/3rdparty/include/ffmpeg_/libavutil/mem.h +++ b/3rdparty/include/ffmpeg_/libavutil/mem.h @@ -27,8 +27,9 @@ #define AVUTIL_MEM_H #include "attributes.h" +#include "avutil.h" -#if defined(__ICC) || defined(__SUNPRO_C) +#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || 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__) @@ -40,7 +41,7 @@ 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 + #define DECLARE_ASM_CONST(n,t,v) static const t av_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 @@ -55,26 +56,26 @@ #define av_malloc_attrib #endif -#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3) +#if 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 size bytes with alignment suitable for all + * Allocate 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 * be allocated. * @see av_mallocz() */ -void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1); +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); /** - * Allocates or reallocates a block of memory. - * If ptr is NULL and size > 0, allocates a new block. If - * size is zero, frees the memory block pointed to by ptr. + * Allocate or reallocate a block of memory. + * If ptr is NULL and size > 0, allocate a new block. If + * size is zero, free 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 @@ -83,10 +84,10 @@ void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1); * cannot be reallocated or the function is used to free the memory block. * @see av_fast_realloc() */ -void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2); +void *av_realloc(void *ptr, size_t size) av_alloc_size(2); /** - * Frees a memory block which has been allocated with av_malloc(z)() or + * Free a memory block which has been allocated with av_malloc(z)() or * av_realloc(). * @param ptr Pointer to the memory block which should be freed. * @note ptr = NULL is explicitly allowed. @@ -96,17 +97,17 @@ void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2); void av_free(void *ptr); /** - * Allocates a block of size bytes with alignment suitable for all + * Allocate 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. + * zero all the bytes of the block. * @param size Size in bytes for the memory block to be allocated. * @return Pointer to the allocated block, NULL if it cannot be allocated. * @see av_malloc() */ -void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1); +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); /** - * Duplicates the string s. + * Duplicate the string s. * @param s string to be duplicated * @return Pointer to a newly allocated string containing a * copy of s or NULL if the string cannot be allocated. @@ -114,7 +115,7 @@ void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1); char *av_strdup(const char *s) av_malloc_attrib; /** - * Frees a memory block which has been allocated with av_malloc(z)() or + * Free a memory block which has been allocated with av_malloc(z)() or * av_realloc() and set the pointer pointing to it to NULL. * @param ptr Pointer to the pointer to the memory block which should * be freed. @@ -122,4 +123,13 @@ char *av_strdup(const char *s) av_malloc_attrib; */ void av_freep(void *ptr); +/** + * Add an element to a dynamic array. + * + * @param tab_ptr Pointer to the array. + * @param nb_ptr Pointer to the number of elements in the array. + * @param elem Element to be added. + */ +void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); + #endif /* AVUTIL_MEM_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/opt.h b/3rdparty/include/ffmpeg_/libavutil/opt.h new file mode 100644 index 000000000..68873de56 --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/opt.h @@ -0,0 +1,243 @@ +/* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OPT_H +#define AVUTIL_OPT_H + +/** + * @file + * AVOptions + */ + +#include "rational.h" +#include "avutil.h" +#include "dict.h" + +enum AVOptionType{ + FF_OPT_TYPE_FLAGS, + FF_OPT_TYPE_INT, + FF_OPT_TYPE_INT64, + FF_OPT_TYPE_DOUBLE, + FF_OPT_TYPE_FLOAT, + FF_OPT_TYPE_STRING, + FF_OPT_TYPE_RATIONAL, + FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + FF_OPT_TYPE_CONST=128, +}; + +/** + * AVOption + */ +typedef struct AVOption { + const char *name; + + /** + * short English help text + * @todo What about other languages? + */ + const char *help; + + /** + * The offset relative to the context structure where the option + * value is stored. It should be 0 for named constants. + */ + int offset; + enum AVOptionType type; + + /** + * the default value for scalar options + */ + union { + double dbl; + const char *str; + /* TODO those are unused now */ + int64_t i64; + AVRational q; + } default_val; + double min; ///< minimum valid value for the option + double max; ///< maximum valid value for the option + + int flags; +#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding +#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding +#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... +#define AV_OPT_FLAG_AUDIO_PARAM 8 +#define AV_OPT_FLAG_VIDEO_PARAM 16 +#define AV_OPT_FLAG_SUBTITLE_PARAM 32 +//FIXME think about enc-audio, ... style flags + + /** + * The logical unit to which the option belongs. Non-constant + * options and corresponding named constants share the same + * unit. May be NULL. + */ + const char *unit; +} AVOption; + +#if FF_API_FIND_OPT +/** + * Look for an option in obj. Look only for the options which + * have the flags set as specified in mask and flags (that is, + * for which it is the case that opt->flags & mask == flags). + * + * @param[in] obj a pointer to a struct whose first element is a + * pointer to an AVClass + * @param[in] name the name of the option to look for + * @param[in] unit the unit of the option to look for, or any if NULL + * @return a pointer to the option found, or NULL if no option + * has been found + * + * @deprecated use av_opt_find. + */ +attribute_deprecated +const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); +#endif + +/** + * Set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an + * AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. If the field is not of a string + * type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param[out] o_out if non-NULL put here a pointer to the AVOption + * found + * @param alloc when 1 then the old value will be av_freed() and the + * new av_strduped() + * when 0 then no av_free() nor av_strdup() will be used + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR(ENOENT) if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + */ +int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); + +const AVOption *av_set_double(void *obj, const char *name, double n); +const AVOption *av_set_q(void *obj, const char *name, AVRational n); +const AVOption *av_set_int(void *obj, const char *name, int64_t n); +double av_get_double(void *obj, const char *name, const AVOption **o_out); +AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); +int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); +const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); +const AVOption *av_next_option(void *obj, const AVOption *last); + +/** + * Show the obj options. + * + * @param req_flags requested flags for the options to show. Show only the + * options for which it is opt->flags & req_flags. + * @param rej_flags rejected flags for the options to show. Show only the + * options for which it is !(opt->flags & req_flags). + * @param av_log_obj log context to use for showing the options + */ +int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); + +void av_opt_set_defaults(void *s); +void av_opt_set_defaults2(void *s, int mask, int flags); + +/** + * Parse the key/value pairs list in opts. For each key/value pair + * found, stores the value in the field in ctx that is named like the + * key. ctx must be an AVClass context, storing is done using + * AVOptions. + * + * @param opts options string to parse, may be NULL + * @param key_val_sep a 0-terminated list of characters used to + * separate key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @return the number of successfully set key/value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_set_string3() if a key/value pair + * cannot be set + */ +int av_set_options_string(void *ctx, const char *opts, + const char *key_val_sep, const char *pairs_sep); + +/** + * Free all string and binary options in obj. + */ +void av_opt_free(void *obj); + +/** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + */ +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); + +/* + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + */ +int av_opt_set_dict(void *obj, struct AVDictionary **options); + +#define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the + given object first. */ + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return A pointer to the option found, or NULL if no option + * was found. + * + * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable + * directly with av_set_string3(). Use special calls which take an options + * AVDictionary (e.g. avformat_open_input()) to set options found with this + * flag. + */ +const AVOption *av_opt_find(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags); + +#endif /* AVUTIL_OPT_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/parseutils.h b/3rdparty/include/ffmpeg_/libavutil/parseutils.h new file mode 100644 index 000000000..d31212e25 --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/parseutils.h @@ -0,0 +1,117 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PARSEUTILS_H +#define AVUTIL_PARSEUTILS_H + +#include "rational.h" + +/** + * @file + * misc parsing utilities + */ + +/** + * Parse str and put in width_ptr and height_ptr the detected values. + * + * @param[in,out] width_ptr pointer to the variable which will contain the detected + * width value + * @param[in,out] height_ptr pointer to the variable which will contain the detected + * height value + * @param[in] str the string to parse: it has to be a string in the format + * width x height or a valid video size abbreviation. + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); + +/** + * Parse str and store the detected values in *rate. + * + * @param[in,out] rate pointer to the AVRational which will contain the detected + * frame rate + * @param[in] str the string to parse: it has to be a string in the format + * rate_num / rate_den, a float number or a valid video rate abbreviation + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_rate(AVRational *rate, const char *str); + +/** + * Put the RGBA values that correspond to color_string in rgba_color. + * + * @param color_string a string specifying a color. It can be the name of + * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, + * possibly followed by "@" and a string representing the alpha + * component. + * The alpha component may be a string composed by "0x" followed by an + * hexadecimal number or a decimal number between 0.0 and 1.0, which + * represents the opacity value (0x00/0.0 means completely transparent, + * 0xff/1.0 completely opaque). + * If the alpha component is not specified then 0xff is assumed. + * The string "random" will result in a random color. + * @param slen length of the initial part of color_string containing the + * color. It can be set to -1 if color_string is a null terminated string + * containing nothing else than the color. + * @return >= 0 in case of success, a negative value in case of + * failure (for example if color_string cannot be parsed). + */ +int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, + void *log_ctx); + +/** + * Parses timestr and returns in *time a corresponding number of + * microseconds. + * + * @param timeval puts here the number of microseconds corresponding + * to the string in timestr. If the string represents a duration, it + * is the number of microseconds contained in the time interval. If + * the string is a date, is the number of microseconds since 1st of + * January, 1970 up to the time of the parsed date. If timestr cannot + * be successfully parsed, set *time to INT64_MIN. + + * @param datestr a string representing a date or a duration. + * - If a date the syntax is: + * @code + * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z] + * now + * @endcode + * If the value is "now" it takes the current time. + * Time is local time unless Z is appended, in which case it is + * interpreted as UTC. + * If the year-month-day part is not specified it takes the current + * year-month-day. + * - If a duration the syntax is: + * @code + * [-]HH[:MM[:SS[.m...]]] + * [-]S+[.m...] + * @endcode + * @param duration flag which tells how to interpret timestr, if not + * zero timestr is interpreted as a duration, otherwise as a date + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_parse_time(int64_t *timeval, const char *timestr, int duration); + +/** + * Attempt to find a specific tag in a URL. + * + * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. + * Return 1 if found. + */ +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); + +#endif /* AVUTIL_PARSEUTILS_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/pixdesc.h b/3rdparty/include/ffmpeg_/libavutil/pixdesc.h index 8e4c85d71..f0de9981e 100644 --- a/3rdparty/include/ffmpeg_/libavutil/pixdesc.h +++ b/3rdparty/include/ffmpeg_/libavutil/pixdesc.h @@ -23,6 +23,7 @@ #define AVUTIL_PIXDESC_H #include +#include "pixfmt.h" typedef struct AVComponentDescriptor{ uint16_t plane :2; ///< which of the 4 planes contains the component @@ -93,11 +94,11 @@ typedef struct AVPixFmtDescriptor{ extern const AVPixFmtDescriptor av_pix_fmt_descriptors[]; /** - * Reads a line from an image, and writes the values of the + * Read a line from an image, and write 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 linesize 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 @@ -108,28 +109,28 @@ extern const AVPixFmtDescriptor av_pix_fmt_descriptors[]; * 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); +void av_read_image_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 + * Write 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 linesize 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); +void av_write_image_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. + * Return 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 @@ -142,7 +143,27 @@ void write_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], enum PixelFormat av_get_pix_fmt(const char *name); /** - * Returns the number of bits per pixel used by the pixel format + * Return the short name for a pixel format, NULL in case pix_fmt is + * unknown. + * + * @see av_get_pix_fmt(), av_get_pix_fmt_string() + */ +const char *av_get_pix_fmt_name(enum PixelFormat pix_fmt); + +/** + * Print in buf the string corresponding to the pixel format with + * number pix_fmt, or an header if pix_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param pix_fmt the number of the pixel format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + */ +char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt); + +/** + * Return 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 diff --git a/3rdparty/include/ffmpeg_/libavutil/pixfmt.h b/3rdparty/include/ffmpeg_/libavutil/pixfmt.h index d976f343b..0f170d209 100644 --- a/3rdparty/include/ffmpeg_/libavutil/pixfmt.h +++ b/3rdparty/include/ffmpeg_/libavutil/pixfmt.h @@ -71,9 +71,9 @@ enum PixelFormat { 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) - PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG) + PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing PIX_FMT_XVMC_MPEG2_IDCT, PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 @@ -95,7 +95,7 @@ enum PixelFormat { PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) - PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG) + PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers @@ -128,14 +128,33 @@ enum PixelFormat { 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_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 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_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + PIX_FMT_GRAY8A, ///< 8bit gray, 8bit alpha + PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + + //the following 10 formats have the disadvantage of needing 1 format for each bit depth, thus + //If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored seperately + //is better + PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + 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 }; +#define PIX_FMT_Y400A PIX_FMT_GRAY8A + #if AV_HAVE_BIGENDIAN # define PIX_FMT_NE(be, le) PIX_FMT_##be #else @@ -152,10 +171,16 @@ enum PixelFormat { #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_BGR48 PIX_FMT_NE(BGR48BE, BGR48LE) #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_YUV420P9 PIX_FMT_NE(YUV420P9BE , YUV420P9LE) +#define PIX_FMT_YUV444P9 PIX_FMT_NE(YUV444P9BE , YUV444P9LE) +#define PIX_FMT_YUV420P10 PIX_FMT_NE(YUV420P10BE, YUV420P10LE) +#define PIX_FMT_YUV422P10 PIX_FMT_NE(YUV422P10BE, YUV422P10LE) +#define PIX_FMT_YUV444P10 PIX_FMT_NE(YUV444P10BE, YUV444P10LE) #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) diff --git a/3rdparty/include/ffmpeg_/libavutil/random_seed.h b/3rdparty/include/ffmpeg_/libavutil/random_seed.h new file mode 100644 index 000000000..7f7506323 --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/random_seed.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2009 Baptiste Coudurier + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_RANDOM_SEED_H +#define AVUTIL_RANDOM_SEED_H + +#include + +/** + * Get a seed to use in conjunction with random functions. + */ +uint32_t av_get_random_seed(void); + +#endif /* AVUTIL_RANDOM_SEED_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/rational.h b/3rdparty/include/ffmpeg_/libavutil/rational.h index aebd107b4..789e4aca2 100644 --- a/3rdparty/include/ffmpeg_/libavutil/rational.h +++ b/3rdparty/include/ffmpeg_/libavutil/rational.h @@ -28,7 +28,8 @@ #ifndef AVUTIL_RATIONAL_H #define AVUTIL_RATIONAL_H -#include +#include +#include #include "attributes.h" /** @@ -40,20 +41,23 @@ typedef struct AVRational{ } AVRational; /** - * Compares two rationals. + * Compare two rationals. * @param a first rational * @param b second rational - * @return 0 if a==b, 1 if a>b and -1 if ab, -1 if a>63)|1; - else return 0; + if(tmp) return ((tmp ^ a.den ^ b.den)>>63)|1; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; } /** - * Converts rational to double. + * Convert rational to double. * @param a rational to convert * @return (double) a */ @@ -62,7 +66,7 @@ static inline double av_q2d(AVRational a){ } /** - * Reduces a fraction. + * Reduce a fraction. * This is useful for framerate calculations. * @param dst_num destination numerator * @param dst_den destination denominator @@ -74,7 +78,7 @@ static inline double av_q2d(AVRational a){ int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); /** - * Multiplies two rationals. + * Multiply two rationals. * @param b first rational * @param c second rational * @return b*c @@ -82,7 +86,7 @@ int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max) AVRational av_mul_q(AVRational b, AVRational c) av_const; /** - * Divides one rational by another. + * Divide one rational by another. * @param b first rational * @param c second rational * @return b/c @@ -90,7 +94,7 @@ AVRational av_mul_q(AVRational b, AVRational c) av_const; AVRational av_div_q(AVRational b, AVRational c) av_const; /** - * Adds two rationals. + * Add two rationals. * @param b first rational * @param c second rational * @return b+c @@ -98,7 +102,7 @@ AVRational av_div_q(AVRational b, AVRational c) av_const; AVRational av_add_q(AVRational b, AVRational c) av_const; /** - * Subtracts one rational from another. + * Subtract one rational from another. * @param b first rational * @param c second rational * @return b-c @@ -106,7 +110,9 @@ AVRational av_add_q(AVRational b, AVRational c) av_const; AVRational av_sub_q(AVRational b, AVRational c) av_const; /** - * Converts a double precision floating point number to a rational. + * Convert a double precision floating point number to a rational. + * inf is expressed as {1,0} or {-1,0} depending on the sign. + * * @param d double to convert * @param max the maximum allowed numerator and denominator * @return (AVRational) d @@ -120,7 +126,7 @@ AVRational av_d2q(double d, int max) av_const; int av_nearer_q(AVRational q, AVRational q1, AVRational q2); /** - * Finds the nearest value in q_list to q. + * Find 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 */ diff --git a/3rdparty/include/ffmpeg_/libavutil/samplefmt.h b/3rdparty/include/ffmpeg_/libavutil/samplefmt.h new file mode 100644 index 000000000..b06755d2c --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/samplefmt.h @@ -0,0 +1,125 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SAMPLEFMT_H +#define AVUTIL_SAMPLEFMT_H + +#include "avutil.h" + +/** + * all in native-endian format + */ +enum AVSampleFormat { + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically +}; + +/** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + */ +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); + +/** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + */ +enum AVSampleFormat av_get_sample_fmt(const char *name); + +/** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL if sample_fmt is + * unknown or in case of other errors + */ +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); + +#if FF_API_GET_BITS_PER_SAMPLE_FMT +/** + * @deprecated Use av_get_bytes_per_sample() instead. + */ +attribute_deprecated +int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); +#endif + +/** + * Return number of bytes per sample. + * + * @param sample_fmt the sample format + * @return number of bytes per sample or zero if unknown for the given + * sample format + */ +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); + +/** + * Fill channel data pointers and linesizes for samples with sample + * format sample_fmt. + * + * The pointers array is filled with the pointers to the samples data: + * for planar, set the start point of each plane's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The linesize array is filled with the aligned size of each samples + * plane, that is linesize[i] will contain the linesize of the plane i, + * and will be zero for all the unused planes. All linesize values are + * equal. + * + * @param pointers array to be filled with the pointer for each plane, may be NULL + * @param linesizes array to be filled with the linesize, may be NULL + * @param buf the pointer to a buffer containing the samples + * @param nb_samples the number of samples in a single channel + * @param planar 1 if the samples layout is planar, 0 if it is packed + * @param nb_channels the number of channels + * @return the total size of the buffer, a negative + * error code in case of failure + */ +int av_samples_fill_arrays(uint8_t *pointers[8], int linesizes[8], + uint8_t *buf, int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int planar, int align); + +/** + * Allocate a samples buffer for nb_samples samples, and + * fill pointers and linesizes accordingly. + * The allocated samples buffer has to be freed by using + * av_freep(&pointers[0]). + * + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param planar 1 if the samples layout is planar, 0 if packed, + * @param align the value to use for buffer size alignment + * @return the size in bytes required for the samples buffer, a negative + * error code in case of failure + * @see av_samples_fill_arrays() + */ +int av_samples_alloc(uint8_t *pointers[8], int linesizes[8], + int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int planar, + int align); + +#endif /* AVCORE_SAMPLEFMT_H */ diff --git a/3rdparty/include/ffmpeg_/libavutil/sha.h b/3rdparty/include/ffmpeg_/libavutil/sha.h new file mode 100644 index 000000000..543f5a194 --- /dev/null +++ b/3rdparty/include/ffmpeg_/libavutil/sha.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SHA_H +#define AVUTIL_SHA_H + +#include + +extern const int av_sha_size; + +struct AVSHA; + +/** + * Initialize SHA-1 or SHA-2 hashing. + * + * @param context pointer to the function context (of size av_sha_size) + * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_sha_init(struct AVSHA* context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_sha_final(struct AVSHA* context, uint8_t *digest); + +#endif /* AVUTIL_SHA_H */ diff --git a/3rdparty/include/ffmpeg_/libswscale/swscale.h b/3rdparty/include/ffmpeg_/libswscale/swscale.h index 1e7af3a4e..0876c915f 100644 --- a/3rdparty/include/ffmpeg_/libswscale/swscale.h +++ b/3rdparty/include/ffmpeg_/libswscale/swscale.h @@ -29,8 +29,8 @@ #include "libavutil/avutil.h" -#define LIBSWSCALE_VERSION_MAJOR 0 -#define LIBSWSCALE_VERSION_MINOR 11 +#define LIBSWSCALE_VERSION_MAJOR 2 +#define LIBSWSCALE_VERSION_MINOR 0 #define LIBSWSCALE_VERSION_MICRO 0 #define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \ @@ -43,6 +43,20 @@ #define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION) +/** + * Those FF_API_* defines are not part of public API. + * They may change, break or disappear at any time. + */ +#ifndef FF_API_SWS_GETCONTEXT +#define FF_API_SWS_GETCONTEXT (LIBSWSCALE_VERSION_MAJOR < 3) +#endif +#ifndef FF_API_SWS_CPU_CAPS +#define FF_API_SWS_CPU_CAPS (LIBSWSCALE_VERSION_MAJOR < 3) +#endif +#ifndef FF_API_SWS_FORMAT_NAME +#define FF_API_SWS_FORMAT_NAME (LIBSWSCALE_VERSION_MAJOR < 3) +#endif + /** * Returns the LIBSWSCALE_VERSION_INT constant. */ @@ -87,11 +101,18 @@ const char *swscale_license(void); #define SWS_ACCURATE_RND 0x40000 #define SWS_BITEXACT 0x80000 +#if FF_API_SWS_CPU_CAPS +/** + * CPU caps are autodetected now, those flags + * are only provided for API compatibility. + */ #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_CPU_CAPS_SSE2 0x02000000 +#endif #define SWS_MAX_REDUCE_CUTOFF 0.002 @@ -142,12 +163,28 @@ int sws_isSupportedInput(enum PixelFormat pix_fmt); */ int sws_isSupportedOutput(enum PixelFormat pix_fmt); +/** + * Allocates an empty SwsContext. This must be filled and passed to + * sws_init_context(). For filling see AVOptions, options.c and + * sws_setColorspaceDetails(). + */ +struct SwsContext *sws_alloc_context(void); + +/** + * Initializes the swscaler context sws_context. + * + * @return zero or positive value on success, a negative value on + * error + */ +int sws_init_context(struct SwsContext *sws_context, SwsFilter *srcFilter, SwsFilter *dstFilter); + /** * Frees the swscaler context swsContext. * If swsContext is NULL, then does nothing. */ void sws_freeContext(struct SwsContext *swsContext); +#if FF_API_SWS_GETCONTEXT /** * Allocates and returns a SwsContext. You need it to perform * scaling/conversion operations using sws_scale(). @@ -160,11 +197,15 @@ void sws_freeContext(struct SwsContext *swsContext); * @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 + * @note this function is to be removed after a saner alternative is + * written + * @deprecated Use sws_getCachedContext() instead. */ 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); +#endif /** * Scales the image slice in srcSlice and puts the resulting scaled @@ -194,6 +235,7 @@ struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat */ 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. @@ -205,7 +247,6 @@ int sws_scale_ordered(struct SwsContext *context, const uint8_t* const src[], /** * @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], @@ -312,7 +353,7 @@ struct SwsContext *sws_getCachedContext(struct SwsContext *context, * @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); +void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette); /** * Converts an 8bit paletted frame into a frame with a color depth of 24 bits. @@ -324,7 +365,7 @@ void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, long num_pi * @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); +void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, int num_pixels, const uint8_t *palette); #endif /* SWSCALE_SWSCALE_H */ diff --git a/3rdparty/lib/libavcodec.a b/3rdparty/lib/libavcodec.a index 7035dcc7f..56997263e 100644 Binary files a/3rdparty/lib/libavcodec.a and b/3rdparty/lib/libavcodec.a differ diff --git a/3rdparty/lib/libavcodec64.a b/3rdparty/lib/libavcodec64.a index 127452526..32ce59a14 100644 Binary files a/3rdparty/lib/libavcodec64.a and b/3rdparty/lib/libavcodec64.a differ diff --git a/3rdparty/lib/libavcore64.a b/3rdparty/lib/libavcore64.a index 932a54ade..04b3e1d63 100644 Binary files a/3rdparty/lib/libavcore64.a and b/3rdparty/lib/libavcore64.a differ diff --git a/3rdparty/lib/libavdevice.a b/3rdparty/lib/libavdevice.a index 3fc6ec2ed..5ab33ab72 100644 Binary files a/3rdparty/lib/libavdevice.a and b/3rdparty/lib/libavdevice.a differ diff --git a/3rdparty/lib/libavdevice64.a b/3rdparty/lib/libavdevice64.a index 8125741f0..d7d658d6c 100644 Binary files a/3rdparty/lib/libavdevice64.a and b/3rdparty/lib/libavdevice64.a differ diff --git a/3rdparty/lib/libavformat.a b/3rdparty/lib/libavformat.a index b358827cc..8b8f98a0e 100644 Binary files a/3rdparty/lib/libavformat.a and b/3rdparty/lib/libavformat.a differ diff --git a/3rdparty/lib/libavformat64.a b/3rdparty/lib/libavformat64.a index 2e2a25e31..ed047c014 100644 Binary files a/3rdparty/lib/libavformat64.a and b/3rdparty/lib/libavformat64.a differ diff --git a/3rdparty/lib/libavutil.a b/3rdparty/lib/libavutil.a index 2f2467fdb..18815e196 100644 Binary files a/3rdparty/lib/libavutil.a and b/3rdparty/lib/libavutil.a differ diff --git a/3rdparty/lib/libavutil64.a b/3rdparty/lib/libavutil64.a index eaeb74455..eac1d0043 100644 Binary files a/3rdparty/lib/libavutil64.a and b/3rdparty/lib/libavutil64.a differ diff --git a/3rdparty/lib/libswscale.a b/3rdparty/lib/libswscale.a index 4f7b9ff2b..cb3e777f6 100644 Binary files a/3rdparty/lib/libswscale.a and b/3rdparty/lib/libswscale.a differ diff --git a/3rdparty/lib/libswscale64.a b/3rdparty/lib/libswscale64.a index 48c45f0fc..0ff587e9f 100644 Binary files a/3rdparty/lib/libswscale64.a and b/3rdparty/lib/libswscale64.a differ