summaryrefslogtreecommitdiffstats
path: root/third_party/ffmpeg
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 19:26:27 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 19:26:27 +0000
commit11309735fce8bf91f70643e955c6153b79f40095 (patch)
tree6a87158dbb3995246322c135de4112336ff38e45 /third_party/ffmpeg
parentbfd71998f58c08dafbdb58ebf59e56b1c7845fc3 (diff)
downloadchromium_src-11309735fce8bf91f70643e955c6153b79f40095.zip
chromium_src-11309735fce8bf91f70643e955c6153b79f40095.tar.gz
chromium_src-11309735fce8bf91f70643e955c6153b79f40095.tar.bz2
New FFmpeg public API headers to match our source tarball in deps.
Review URL: http://codereview.chromium.org/113748 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/ffmpeg')
-rw-r--r--third_party/ffmpeg/README.chromium17
-rw-r--r--third_party/ffmpeg/avcodec-52.def10
-rwxr-xr-xthird_party/ffmpeg/ffmpeg.gyp1
-rw-r--r--third_party/ffmpeg/include/libavcodec/avcodec.h383
-rw-r--r--third_party/ffmpeg/include/libavdevice/avdevice.h46
-rw-r--r--third_party/ffmpeg/include/libavformat/avformat.h98
-rw-r--r--third_party/ffmpeg/include/libavutil/avutil.h2
-rw-r--r--third_party/ffmpeg/include/libavutil/fifo.h8
-rw-r--r--third_party/ffmpeg/include/libavutil/pixfmt.h11
9 files changed, 382 insertions, 194 deletions
diff --git a/third_party/ffmpeg/README.chromium b/third_party/ffmpeg/README.chromium
index 816d4d0..9548c1d 100644
--- a/third_party/ffmpeg/README.chromium
+++ b/third_party/ffmpeg/README.chromium
@@ -1,12 +1,16 @@
This contains FFmpeg's public header files from the output of a "make install"
-command. The header files are from FFmpeg revision 18286.
+command. The header files are from Chromium's copy of FFmpeg.
Steps to reproduce:
- 1) If on Windows, refer to http://ffmpeg.arrozcru.org for environment setup
- 2) Check out FFmpeg from their repository
- 3) ./configure --prefix=/path/to/chrome/src/third_party/ffmpeg
- 4) make && make install
- 5) Remove bin and lib folders, leaving the include folder behind
+ 1) If on Windows, refer to our MinGW/MSYS environment setup:
+ http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/mingw/
+ 2) Grab Chromium's copy of FFmpeg:
+ http://src.chromium.org/viewvc/chrome/trunk/deps/third_party/ffmpeg/
+ 3) Follow the instructions to build and install.
+ 4) Go to your install location and copy the following into the Chromium tree:
+ /path/to/install/include/libavcodec
+ /path/to/install/include/libavformat
+ /path/to/install/include/libavutil
The project contains some hand-written DEF files used to generate import
libraries to permit dynamically loading FFmpeg. The libaries are linked in
@@ -17,4 +21,3 @@ export every method by ordinal, which makes binary compatability with different
builds of FFmpeg difficult if not impossible. Furthermore, it is much easier
to update a DEF file instead of rebuilding FFmpeg to generate new import
libraries.
-
diff --git a/third_party/ffmpeg/avcodec-52.def b/third_party/ffmpeg/avcodec-52.def
index 5c0ebab..cadf0c0a 100644
--- a/third_party/ffmpeg/avcodec-52.def
+++ b/third_party/ffmpeg/avcodec-52.def
@@ -1,15 +1,13 @@
LIBRARY avcodec-52
EXPORTS
+ av_free_packet
av_get_bits_per_sample_format
+ av_init_packet
av_new_packet
- avcodec_alloc_context
avcodec_alloc_frame
- avcodec_decode_audio2
- avcodec_decode_video
+ avcodec_decode_audio3
+ avcodec_decode_video2
avcodec_find_decoder
- avcodec_get_frame_defaults
avcodec_init
avcodec_open
- avcodec_thread_execute
- avcodec_thread_free
avcodec_thread_init
diff --git a/third_party/ffmpeg/ffmpeg.gyp b/third_party/ffmpeg/ffmpeg.gyp
index 0b069c8..30d03b7 100755
--- a/third_party/ffmpeg/ffmpeg.gyp
+++ b/third_party/ffmpeg/ffmpeg.gyp
@@ -23,7 +23,6 @@
'include/libavcodec/opt.h',
'include/libavcodec/vdpau.h',
'include/libavcodec/xvmc.h',
- 'include/libavdevice/avdevice.h',
'include/libavformat/avformat.h',
'include/libavformat/avio.h',
'include/libavutil/adler32.h',
diff --git a/third_party/ffmpeg/include/libavcodec/avcodec.h b/third_party/ffmpeg/include/libavcodec/avcodec.h
index 2b9adf2..55935e39 100644
--- a/third_party/ffmpeg/include/libavcodec/avcodec.h
+++ b/third_party/ffmpeg/include/libavcodec/avcodec.h
@@ -30,8 +30,8 @@
#include "libavutil/avutil.h"
#define LIBAVCODEC_VERSION_MAJOR 52
-#define LIBAVCODEC_VERSION_MINOR 22
-#define LIBAVCODEC_VERSION_MICRO 3
+#define LIBAVCODEC_VERSION_MINOR 28
+#define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
@@ -193,6 +193,8 @@ enum CodecID {
CODEC_ID_TQI,
CODEC_ID_AURA,
CODEC_ID_AURA2,
+ CODEC_ID_V210X,
+ CODEC_ID_TMV,
/* various PCM "codecs" */
CODEC_ID_PCM_S16LE= 0x10000,
@@ -313,6 +315,7 @@ enum CodecID {
CODEC_ID_MP1,
CODEC_ID_TWINVQ,
CODEC_ID_TRUEHD,
+ CODEC_ID_MP4ALS,
/* subtitle codecs */
CODEC_ID_DVD_SUBTITLE= 0x17000,
@@ -379,13 +382,17 @@ enum SampleFormat {
/* 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_7POINT1 (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT)
-#define CH_LAYOUT_7POINT1_WIDE (CH_LAYOUT_SURROUND|CH_LOW_FREQUENCY|\
- 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)
@@ -435,6 +442,43 @@ enum AVDiscard{
AVDISCARD_ALL = 48, ///< discard all
};
+enum AVColorPrimaries{
+ AVCOL_PRI_BT709 =1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
+ AVCOL_PRI_UNSPECIFIED=2,
+ AVCOL_PRI_BT470M =4,
+ AVCOL_PRI_BT470BG =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
+ AVCOL_PRI_SMPTE170M =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
+ AVCOL_PRI_SMPTE240M =7, ///< functionally identical to above
+ AVCOL_PRI_FILM =8,
+ AVCOL_PRI_NB , ///< Not part of ABI
+};
+
+enum AVColorTransferCharacteristic{
+ AVCOL_TRC_BT709 =1, ///< also ITU-R BT1361
+ AVCOL_TRC_UNSPECIFIED=2,
+ AVCOL_TRC_GAMMA22 =4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
+ AVCOL_TRC_GAMMA28 =5, ///< also ITU-R BT470BG
+ AVCOL_TRC_NB , ///< Not part of ABI
+};
+
+enum AVColorSpace{
+ AVCOL_SPC_RGB =0,
+ AVCOL_SPC_BT709 =1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
+ AVCOL_SPC_UNSPECIFIED=2,
+ AVCOL_SPC_FCC =4,
+ AVCOL_SPC_BT470BG =5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
+ AVCOL_SPC_SMPTE170M =6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
+ AVCOL_SPC_SMPTE240M =7,
+ AVCOL_SPC_NB , ///< Not part of ABI
+};
+
+enum AVColorRange{
+ AVCOL_RANGE_UNSPECIFIED=0,
+ AVCOL_RANGE_MPEG =1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
+ AVCOL_RANGE_JPEG =2, ///< the normal 2^n-1 "JPEG" YUV ranges
+ AVCOL_RANGE_NB , ///< Not part of ABI
+};
+
typedef struct RcOverride{
int start_frame;
int end_frame;
@@ -538,6 +582,10 @@ typedef struct RcOverride{
* Codec can export data for HW decoding (VDPAU).
*/
#define CODEC_CAP_HWACCEL_VDPAU 0x0080
+/**
+ * Codec supports frame-based multithreading.
+ */
+#define CODEC_CAP_FRAME_THREADS 0x0100
//The following defines may change, don't expect compatibility if you use them.
#define MB_TYPE_INTRA4x4 0x0001
@@ -817,7 +865,20 @@ typedef struct AVPanScan{
* - decoding: Set by libavcodec\
*/\
void *hwaccel_picture_private;\
-
+\
+ /**\
+ * the AVCodecContext which ff_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;
#define FF_QSCALE_TYPE_MPEG1 0
#define FF_QSCALE_TYPE_MPEG2 1
@@ -842,6 +903,55 @@ typedef struct AVPanScan{
#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content.
#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update).
+typedef struct AVPacket {
+ /**
+ * Presentation timestamp in AVStream->time_base units; the time at which
+ * the decompressed packet will be presented to the user.
+ * Can be AV_NOPTS_VALUE if it is not stored in the file.
+ * pts MUST be larger or equal to dts as presentation cannot happen before
+ * decompression, unless one wants to view hex dumps. Some formats misuse
+ * the terms dts and pts/cts to mean something different. Such timestamps
+ * must be converted to true pts/dts before they are stored in AVPacket.
+ */
+ int64_t pts;
+ /**
+ * Decompression timestamp in AVStream->time_base units; the time at which
+ * the packet is decompressed.
+ * Can be AV_NOPTS_VALUE if it is not stored in the file.
+ */
+ int64_t dts;
+ uint8_t *data;
+ int size;
+ int stream_index;
+ int flags;
+ /**
+ * Duration of this packet in AVStream->time_base units, 0 if unknown.
+ * Equals next_pts - this_pts in presentation order.
+ */
+ int duration;
+ void (*destruct)(struct AVPacket *);
+ void *priv;
+ int64_t pos; ///< byte position in stream, -1 if unknown
+
+ /**
+ * Time difference in AVStream->time_base units from the pts of this
+ * packet to the point at which the output from the decoder has converged
+ * independent from the availability of previous frames. That is, the
+ * frames are virtually identical no matter if decoding started from
+ * the very first frame or from this keyframe.
+ * Is AV_NOPTS_VALUE if unknown.
+ * This field is not the display duration of the current packet.
+ *
+ * The purpose of this field is to allow seeking in streams that have no
+ * keyframes in the conventional sense. It corresponds to the
+ * recovery point SEI in H.264 and match_time_delta in NUT. It is also
+ * essential for some types of subtitle streams to ensure that all
+ * subtitles are correctly displayed after seeking.
+ */
+ int64_t convergence_duration;
+} AVPacket;
+#define PKT_FLAG_KEY 0x0001
+
/**
* Audio Video Frame.
* New fields can be added to the end of FF_COMMON_FRAME with minor version
@@ -971,7 +1081,7 @@ typedef struct AVCodecContext {
* 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.
+ * beforehand. May be called by different threads at the same time.
* 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.
@@ -1006,7 +1116,7 @@ typedef struct AVCodecContext {
* Samples per packet, initialized when calling 'init'.
*/
int frame_size;
- int frame_number; ///< audio or video frame number
+ int frame_number; ///< Number of audio or video frames returned so far
int real_pict_num; ///< Returns the real picture number of previous encoded frame.
/**
@@ -1216,6 +1326,8 @@ typedef struct AVCodecContext {
* If pic.reference is set then the frame will be read later by libavcodec.
* avcodec_align_dimensions() should be used to find the required width and
* height, as they normally need to be rounded up to the next multiple of 16.
+ * May be called by different threads if frame threading is enabled, but not
+ * by more than one at the same time.
* - encoding: unused
* - decoding: Set by libavcodec., user can override.
*/
@@ -1224,7 +1336,9 @@ 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.
+ * pic.data[*] must be set to NULL. May be called by different threads
+ * if frame threading is enabled, but not more than one at the same time.
+ *
* - encoding: unused
* - decoding: Set by libavcodec., user can override.
*/
@@ -1456,12 +1570,17 @@ typedef struct AVCodecContext {
/* 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
@@ -2328,7 +2447,7 @@ typedef struct AVCodecContext {
*/
float rc_min_vbv_overflow_use;
- /**
+ /**
* Hardware accelerator in use
* - encoding: unused.
* - decoding: Set by libavcodec
@@ -2355,6 +2474,60 @@ typedef struct AVCodecContext {
* - decoding: Set by user
*/
void *hwaccel_context;
+
+ /**
+ * Chromaticity coordinates of the source primaries.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorPrimaries color_primaries;
+
+ /**
+ * Color Transfer Characteristic.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorTransferCharacteristic color_trc;
+
+ /**
+ * YUV colorspace type.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorSpace colorspace;
+
+ /**
+ * MPEG vs JPEG YUV range.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVColorRange color_range;
+
+ /**
+ * Whether this is a copy of the context which had init() called on it.
+ * This is used by multithreading - shared tables and picture pointers
+ * should be freed from the original context only.
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ int is_copy;
+
+ /**
+ * Which multithreading methods to use, for codecs that support more than one.
+ * - encoding: Set by user, otherwise the default is used.
+ * - decoding: Set by user, otherwise the default is used.
+ */
+ int thread_type;
+#define FF_THREAD_FRAME 1 //< Decode more than one frame at once
+#define FF_THREAD_SLICE 2 //< Decode more than one part of a single frame at once
+#define FF_THREAD_DEFAULT 3 //< Use both if possible.
+
+ /**
+ * Which multithreading methods are actually active at the moment.
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ int active_thread_type;
} AVCodecContext;
/**
@@ -2374,8 +2547,7 @@ typedef struct AVCodec {
int (*init)(AVCodecContext *);
int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
int (*close)(AVCodecContext *);
- int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
- const uint8_t *buf, int buf_size);
+ int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
/**
* Codec capabilities.
* see CODEC_CAP_*
@@ -2397,6 +2569,26 @@ typedef struct AVCodec {
const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
const enum SampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
const int64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
+
+ /**
+ * @defgroup framethreading Frame threading support functions.
+ * @{
+ */
+ /**
+ * If the codec allocates writable tables in init(), define init_copy() to re-allocate
+ * them in the copied contexts. Before calling it, priv_data will be set to a copy of
+ * the original.
+ */
+ int (*init_copy)(AVCodecContext *);
+ /**
+ * Copy all necessary context variables from the last thread before starting the next one.
+ * If the codec doesn't define this, the next thread will start automatically; otherwise,
+ * the codec must call ff_report_frame_setup_done(). Do not assume anything about the
+ * contents of priv data except that it has been copied from the original some time after
+ * codec init. Will not be called if frame threading is disabled.
+ */
+ int (*update_context)(AVCodecContext *, AVCodecContext *from);
+ /** @} */
} AVCodec;
/**
@@ -2574,6 +2766,55 @@ typedef struct AVSubtitle {
AVSubtitleRect **rects;
} AVSubtitle;
+/* packet functions */
+
+/**
+ * @deprecated use NULL instead
+ */
+attribute_deprecated void av_destruct_packet_nofree(AVPacket *pkt);
+
+/**
+ * Default packet destructor.
+ */
+void av_destruct_packet(AVPacket *pkt);
+
+/**
+ * Initialize optional fields of a packet with default values.
+ *
+ * @param pkt packet
+ */
+void av_init_packet(AVPacket *pkt);
+
+/**
+ * Allocate the payload of a packet and initialize its fields with
+ * default values.
+ *
+ * @param pkt packet
+ * @param size wanted payload size
+ * @return 0 if OK, AVERROR_xxx otherwise
+ */
+int av_new_packet(AVPacket *pkt, int size);
+
+/**
+ * Reduce packet size, correctly zeroing padding
+ *
+ * @param pkt packet
+ * @param size new size
+ */
+void av_shrink_packet(AVPacket *pkt, int size);
+
+/**
+ * @warning This is a hack - the packet memory allocation stuff is broken. The
+ * packet is allocated if it was not really allocated.
+ */
+int av_dup_packet(AVPacket *pkt);
+
+/**
+ * Free a packet.
+ *
+ * @param pkt packet to free
+ */
+void av_free_packet(AVPacket *pkt);
/* resample.c */
@@ -2965,26 +3206,44 @@ int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, v
*/
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
+#if LIBAVCODEC_VERSION_MAJOR < 53
/**
* Decodes an audio frame from \p buf into \p samples.
- * The avcodec_decode_audio2() function decodes an audio frame from the input
- * buffer \p buf of size \p buf_size. To decode it, it makes use of the
- * audio codec which was coupled with \p avctx using avcodec_open(). The
- * resulting decoded frame is stored in output buffer \p samples. If no frame
+ * 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.
+ * Some decoders may support multiple frames in a single AVPacket, such
+ * decoders would then just decode the first frame.
+ * If no frame
* could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the
* decompressed frame size in \e bytes.
*
* @warning You \e must set \p frame_size_ptr to the allocated size of the
- * output buffer before calling avcodec_decode_audio2().
+ * output buffer before calling avcodec_decode_audio3().
*
* @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than
* the actual read bytes because some optimized bitstream readers read 32 or 64
* bits at once and could read over the end.
*
- * @warning The end of the input buffer \p buf should be set to 0 to ensure that
+ * @warning The end of the input buffer \p avpkt->data should be set to 0 to ensure that
* no overreading happens for damaged MPEG streams.
*
- * @note You might have to align the input buffer \p buf and output buffer \p
+ * @note You might have to align the input buffer \p avpkt->data and output buffer \p
* samples. The alignment requirements depend on the CPU: On some CPUs it isn't
* necessary at all, on others it won't work at all if not aligned and on others
* it will work but it will have an impact on performance. In practice, the
@@ -2996,21 +3255,37 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
* @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
+ * @param[in] avpkt The input AVPacket containing the input buffer.
* @return On error a negative value is returned, otherwise the number of bytes
* used or zero if no frame could be decompressed.
*/
-int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
+int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
int *frame_size_ptr,
- const uint8_t *buf, int buf_size);
+ AVPacket *avpkt);
+#if LIBAVCODEC_VERSION_MAJOR < 53
/**
* Decodes a video frame from \p buf into \p picture.
- * The avcodec_decode_video() function decodes a video frame from the input
- * buffer \p buf of size \p buf_size. To decode it, it makes use of the
- * video codec which was coupled with \p avctx using avcodec_open(). The
- * resulting decoded frame is stored in \p 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.
+ * Some decoders may support multiple frames in a single AVPacket, such
+ * decoders would then just decode the first frame.
*
* @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than
* the actual read bytes because some optimized bitstream readers read 32 or 64
@@ -3019,7 +3294,7 @@ int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
* @warning The end of the input buffer \p buf should be set to 0 to ensure that
* no overreading happens for damaged MPEG streams.
*
- * @note You might have to align the input buffer \p buf and output buffer \p
+ * @note You might have to align the input buffer \p avpkt->data and output buffer \p
* samples. The alignment requirements depend on the CPU: on some CPUs it isn't
* necessary at all, on others it won't work at all if not aligned and on others
* it will work but it will have an impact on performance. In practice, the
@@ -3029,38 +3304,53 @@ int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
* start of the buffer to 16.
*
* @note Some codecs have a delay between input and output, these need to be
- * feeded with buf=NULL, buf_size=0 at the end to return the remaining frames.
+ * feeded with avpkt->data=NULL, avpkt->size=0 at the end to return the remaining frames.
*
* @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] avpkt The input AVpacket containing the input buffer.
* @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.
*/
-int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
+int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
int *got_picture_ptr,
- const uint8_t *buf, int buf_size);
+ 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. */
-int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *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.
+ * If no subtitle could be decompressed, \p got_sub_ptr is zero.
+ * Otherwise, the subtitle is stored in \p *sub.
+ *
+ * @param avctx the codec context
+ * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored.
+ * @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);
int avcodec_parse_frame(AVCodecContext *avctx, uint8_t **pdata,
int *data_size_ptr,
uint8_t *buf, int buf_size);
/**
* Encodes an audio frame from \p samples into \p buf.
- * The avcodec_encode_audio() function encodes an audio frame from the input
- * buffer \p samples. To encode it, it makes use of the audio codec which was
- * coupled with \p avctx using avcodec_open(). The resulting encoded frame is
- * stored in output buffer \p buf.
*
* @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large.
+ * However, for PCM audio the user will know how much space is needed
+ * because it depends on the value passed in \p buf_size as described
+ * below. In that case a lower value can be used.
*
* @param avctx the codec context
* @param[out] buf the output buffer
@@ -3078,10 +3368,7 @@ int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
/**
* Encodes a video frame from \p pict into \p buf.
- * The avcodec_encode_video() function encodes a video frame from the input
- * \p pict. To encode it, it makes use of the video codec which was coupled with
- * \p avctx using avcodec_open(). The resulting encoded bytes representing the
- * frame are stored in the output buffer \p buf. The input picture should be
+ * The input picture should be
* stored using a specific format, namely \c avctx.pix_fmt.
*
* @param avctx the codec context
@@ -3376,6 +3663,20 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
/**
+ * Allocates 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
+ * handling to avoid memleaks is necessary.
+ *
+ * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
+ * @param size size of the buffer *ptr points to
+ * @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);
+
+/**
* Copy image 'src' to 'dst'.
*/
void av_picture_copy(AVPicture *dst, const AVPicture *src,
diff --git a/third_party/ffmpeg/include/libavdevice/avdevice.h b/third_party/ffmpeg/include/libavdevice/avdevice.h
deleted file mode 100644
index 7e6d461..0000000
--- a/third_party/ffmpeg/include/libavdevice/avdevice.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 AVDEVICE_AVDEVICE_H
-#define AVDEVICE_AVDEVICE_H
-
-#define LIBAVDEVICE_VERSION_MAJOR 52
-#define LIBAVDEVICE_VERSION_MINOR 1
-#define LIBAVDEVICE_VERSION_MICRO 0
-
-#define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
- LIBAVDEVICE_VERSION_MINOR, \
- LIBAVDEVICE_VERSION_MICRO)
-#define LIBAVDEVICE_VERSION AV_VERSION(LIBAVDEVICE_VERSION_MAJOR, \
- LIBAVDEVICE_VERSION_MINOR, \
- LIBAVDEVICE_VERSION_MICRO)
-#define LIBAVDEVICE_BUILD LIBAVDEVICE_VERSION_INT
-
-/**
- * Returns the LIBAVDEVICE_VERSION_INT constant.
- */
-unsigned avdevice_version(void);
-
-/**
- * Initialize libavdevice and register all the input and output devices.
- * @warning This function is not thread safe.
- */
-void avdevice_register_all(void);
-
-#endif /* AVDEVICE_AVDEVICE_H */
-
diff --git a/third_party/ffmpeg/include/libavformat/avformat.h b/third_party/ffmpeg/include/libavformat/avformat.h
index 5458db9..8732b56 100644
--- a/third_party/ffmpeg/include/libavformat/avformat.h
+++ b/third_party/ffmpeg/include/libavformat/avformat.h
@@ -63,7 +63,7 @@ struct AVFormatContext;
* want to store, e.g., the email address of the child of producer Alice
* and actor Bob, that could have key=alice_and_bobs_childs_email_address.
* 3. A tag whose value is localized for a particular language is appended
- * with a dash character ('-') and the ISO 639 3-letter language code.
+ * with a dash character ('-') and 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.
@@ -114,78 +114,6 @@ void av_metadata_free(AVMetadata **m);
/* packet functions */
-typedef struct AVPacket {
- /**
- * Presentation timestamp in time_base units; the time at which the
- * decompressed packet will be presented to the user.
- * Can be AV_NOPTS_VALUE if it is not stored in the file.
- * pts MUST be larger or equal to dts as presentation cannot happen before
- * decompression, unless one wants to view hex dumps. Some formats misuse
- * the terms dts and pts/cts to mean something different. Such timestamps
- * must be converted to true pts/dts before they are stored in AVPacket.
- */
- int64_t pts;
- /**
- * Decompression timestamp in time_base units; the time at which the
- * packet is decompressed.
- * Can be AV_NOPTS_VALUE if it is not stored in the file.
- */
- int64_t dts;
- uint8_t *data;
- int size;
- int stream_index;
- int flags;
- /**
- * Duration of this packet in time_base units, 0 if unknown.
- * Equals next_pts - this_pts in presentation order.
- */
- int duration;
- void (*destruct)(struct AVPacket *);
- void *priv;
- int64_t pos; ///< byte position in stream, -1 if unknown
-
- /**
- * Time difference in stream time base units from the pts of this
- * packet to the point at which the output from the decoder has converged
- * independent from the availability of previous frames. That is, the
- * frames are virtually identical no matter if decoding started from
- * the very first frame or from this keyframe.
- * Is AV_NOPTS_VALUE if unknown.
- * This field is not the display duration of the current packet.
- *
- * The purpose of this field is to allow seeking in streams that have no
- * keyframes in the conventional sense. It corresponds to the
- * recovery point SEI in H.264 and match_time_delta in NUT. It is also
- * essential for some types of subtitle streams to ensure that all
- * subtitles are correctly displayed after seeking.
- */
- int64_t convergence_duration;
-} AVPacket;
-#define PKT_FLAG_KEY 0x0001
-
-void av_destruct_packet_nofree(AVPacket *pkt);
-
-/**
- * Default packet destructor.
- */
-void av_destruct_packet(AVPacket *pkt);
-
-/**
- * Initialize optional fields of a packet with default values.
- *
- * @param pkt packet
- */
-void av_init_packet(AVPacket *pkt);
-
-/**
- * Allocate the payload of a packet and initialize its fields with
- * default values.
- *
- * @param pkt packet
- * @param size wanted payload size
- * @return 0 if OK, AVERROR_xxx otherwise
- */
-int av_new_packet(AVPacket *pkt, int size);
/**
* Allocate and read the payload of a packet and initialize its fields with
@@ -197,23 +125,6 @@ int av_new_packet(AVPacket *pkt, int size);
*/
int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size);
-/**
- * @warning This is a hack - the packet memory allocation stuff is broken. The
- * packet is allocated if it was not really allocated.
- */
-int av_dup_packet(AVPacket *pkt);
-
-/**
- * Free a packet.
- *
- * @param pkt packet to free
- */
-static inline void av_free_packet(AVPacket *pkt)
-{
- if (pkt && pkt->destruct) {
- pkt->destruct(pkt);
- }
-}
/*************************************************/
/* fractional numbers for exact pts handling */
@@ -338,7 +249,10 @@ typedef struct AVInputFormat {
AVFormatParameters *ap);
/** Read one packet and put it in 'pkt'. pts and flags are also
set. 'av_new_stream' can be called only if the flag
- AVFMTCTX_NOHEADER is used. */
+ AVFMTCTX_NOHEADER is used.
+ @return 0 on success, < 0 on error.
+ When returning an error, pkt must not have been allocated
+ or must be freed before returning */
int (*read_packet)(struct AVFormatContext *, AVPacket *pkt);
/** Close the stream. The AVFormatContext and AVStreams are not
freed by this function */
@@ -476,7 +390,7 @@ typedef struct AVStream {
int64_t duration;
#if LIBAVFORMAT_VERSION_INT < (53<<16)
- char language[4]; /** ISO 639 3-letter language code (empty string if undefined) */
+ char language[4]; /** ISO 639-2/B 3-letter language code (empty string if undefined) */
#endif
/* av_read_frame() support */
diff --git a/third_party/ffmpeg/include/libavutil/avutil.h b/third_party/ffmpeg/include/libavutil/avutil.h
index dfc129b..fac1f5e 100644
--- a/third_party/ffmpeg/include/libavutil/avutil.h
+++ b/third_party/ffmpeg/include/libavutil/avutil.h
@@ -35,7 +35,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 2
+#define LIBAVUTIL_VERSION_MINOR 3
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/third_party/ffmpeg/include/libavutil/fifo.h b/third_party/ffmpeg/include/libavutil/fifo.h
index d353844..a904dfd 100644
--- a/third_party/ffmpeg/include/libavutil/fifo.h
+++ b/third_party/ffmpeg/include/libavutil/fifo.h
@@ -62,6 +62,14 @@ 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
+ * amount of data you can write into it.
+ * @param *f AVFifoBuffer to write into
+ * @return size
+ */
+int av_fifo_space(AVFifoBuffer *f);
+
+/**
* Feeds data from an AVFifoBuffer to a user-supplied callback.
* @param *f AVFifoBuffer to read from
* @param buf_size number of bytes to read
diff --git a/third_party/ffmpeg/include/libavutil/pixfmt.h b/third_party/ffmpeg/include/libavutil/pixfmt.h
index 21a72a8..4995a4da 100644
--- a/third_party/ffmpeg/include/libavutil/pixfmt.h
+++ b/third_party/ffmpeg/include/libavutil/pixfmt.h
@@ -116,6 +116,13 @@ enum PixelFormat {
PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers
PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers
PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
+
+ PIX_FMT_YUV420PLE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ PIX_FMT_YUV420PBE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ PIX_FMT_YUV422PLE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ PIX_FMT_YUV422PBE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ PIX_FMT_YUV444PLE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ PIX_FMT_YUV444PBE, ///< planar YUV 4:4:4, 48bpp, (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
};
@@ -137,4 +144,8 @@ enum PixelFormat {
#define PIX_FMT_BGR565 PIX_FMT_NE(BGR565BE, BGR565LE)
#define PIX_FMT_BGR555 PIX_FMT_NE(BGR555BE, BGR555LE)
+#define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420PBE, YUV420PLE)
+#define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422PBE, YUV422PLE)
+#define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444PBE, YUV444PLE)
+
#endif /* AVUTIL_PIXFMT_H */