summaryrefslogtreecommitdiffstats
path: root/media/ffvpx/libavcodec/avcodec.h
diff options
context:
space:
mode:
Diffstat (limited to 'media/ffvpx/libavcodec/avcodec.h')
-rw-r--r--media/ffvpx/libavcodec/avcodec.h761
1 files changed, 347 insertions, 414 deletions
diff --git a/media/ffvpx/libavcodec/avcodec.h b/media/ffvpx/libavcodec/avcodec.h
index 7fb44e28f4..83dc487251 100644
--- a/media/ffvpx/libavcodec/avcodec.h
+++ b/media/ffvpx/libavcodec/avcodec.h
@@ -187,12 +187,16 @@ struct AVCodecParameters;
* @{
*/
+#if FF_API_BUFFER_MIN_SIZE
/**
* @ingroup lavc_encoding
* minimum encoding buffer size
* Used to avoid some checks during header writing.
+ * @deprecated Unused: avcodec_receive_packet() does not work
+ * with preallocated packet buffers.
*/
#define AV_INPUT_BUFFER_MIN_SIZE 16384
+#endif
/**
* @ingroup lavc_encoding
@@ -491,29 +495,6 @@ typedef struct AVCodecContext {
int64_t bit_rate;
/**
- * number of bits the bitstream is allowed to diverge from the reference.
- * the reference can be CBR (for CBR pass1) or VBR (for pass2)
- * - encoding: Set by user; unused for constant quantizer encoding.
- * - decoding: unused
- */
- int bit_rate_tolerance;
-
- /**
- * Global quality for codecs which cannot change it per frame.
- * This should be proportional to MPEG-1/2/4 qscale.
- * - encoding: Set by user.
- * - decoding: unused
- */
- int global_quality;
-
- /**
- * - encoding: Set by user.
- * - decoding: unused
- */
- int compression_level;
-#define FF_COMPRESSION_DEFAULT -1
-
- /**
* AV_CODEC_FLAG_*.
* - encoding: Set by user.
* - decoding: Set by user.
@@ -562,6 +543,22 @@ typedef struct AVCodecContext {
*/
AVRational time_base;
+ /**
+ * Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
+ * - encoding: unused.
+ * - decoding: set by user.
+ */
+ AVRational pkt_timebase;
+
+ /**
+ * - decoding: For codecs that store a framerate value in the compressed
+ * bitstream, the decoder may export it here. { 0, 1} when
+ * unknown.
+ * - encoding: May be used to signal the framerate of CFR content to an
+ * encoder.
+ */
+ AVRational framerate;
+
#if FF_API_TICKS_PER_FRAME
/**
* For some codecs, the time base is closer to the field rate than the frame rate.
@@ -636,11 +633,13 @@ typedef struct AVCodecContext {
int coded_width, coded_height;
/**
- * the number of pictures in a group of pictures, or 0 for intra_only
+ * sample aspect ratio (0 if unknown)
+ * That is the width of a pixel divided by the height of the pixel.
+ * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
* - encoding: Set by user.
- * - decoding: unused
+ * - decoding: Set by libavcodec.
*/
- int gop_size;
+ AVRational sample_aspect_ratio;
/**
* Pixel format, see AV_PIX_FMT_xxx.
@@ -658,6 +657,82 @@ typedef struct AVCodecContext {
enum AVPixelFormat pix_fmt;
/**
+ * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
+ * - encoding: unused.
+ * - decoding: Set by libavcodec before calling get_format()
+ */
+ enum AVPixelFormat sw_pix_fmt;
+
+ /**
+ * 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 to override the default output color range value,
+ * If not specified, libavcodec sets the color range depending on the
+ * output format.
+ * - decoding: Set by libavcodec, can be set by the user to propagate the
+ * color range to components reading from the decoder context.
+ */
+ enum AVColorRange color_range;
+
+ /**
+ * This defines the location of chroma samples.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ enum AVChromaLocation chroma_sample_location;
+
+ /** Field order
+ * - encoding: set by libavcodec
+ * - decoding: Set by user.
+ */
+ enum AVFieldOrder field_order;
+
+ /**
+ * number of reference frames
+ * - encoding: Set by user.
+ * - decoding: Set by lavc.
+ */
+ int refs;
+
+ /**
+ * Size of the frame reordering buffer in the decoder.
+ * For MPEG-2 it is 1 IPB or 0 low delay IP.
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ int has_b_frames;
+
+ /**
+ * slice flags
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int slice_flags;
+#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
+#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
+#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
+
+ /**
* 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
@@ -736,14 +811,6 @@ typedef struct AVCodecContext {
float b_quant_offset;
/**
- * Size of the frame reordering buffer in the decoder.
- * For MPEG-2 it is 1 IPB or 0 low delay IP.
- * - encoding: Set by libavcodec.
- * - decoding: Set by libavcodec.
- */
- int has_b_frames;
-
- /**
* qscale factor between P- and I-frames
* If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset).
* If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset).
@@ -794,32 +861,12 @@ typedef struct AVCodecContext {
*/
float dark_masking;
-#if FF_API_SLICE_OFFSET
/**
- * slice count
- * - encoding: Set by libavcodec.
- * - decoding: Set by user (or 0).
- */
- attribute_deprecated
- int slice_count;
-
- /**
- * slice offsets in the frame in bytes
- * - encoding: Set/allocated by libavcodec.
- * - decoding: Set/allocated by user (or NULL).
- */
- attribute_deprecated
- int *slice_offset;
-#endif
-
- /**
- * sample aspect ratio (0 if unknown)
- * That is the width of a pixel divided by the height of the pixel.
- * Numerator and denominator must be relatively prime and smaller than 256 for some video standards.
+ * noise vs. sse weight for the nsse comparison function
* - encoding: Set by user.
- * - decoding: Set by libavcodec.
+ * - decoding: unused
*/
- AVRational sample_aspect_ratio;
+ int nsse_weight;
/**
* motion estimation comparison function
@@ -908,16 +955,6 @@ typedef struct AVCodecContext {
int me_range;
/**
- * slice flags
- * - encoding: unused
- * - decoding: Set by user.
- */
- int slice_flags;
-#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display
-#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics)
-#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1)
-
- /**
* macroblock decision mode
* - encoding: Set by user.
* - decoding: unused
@@ -946,6 +983,13 @@ typedef struct AVCodecContext {
uint16_t *inter_matrix;
/**
+ * custom intra quantization matrix
+ * - encoding: Set by user, can be NULL.
+ * - decoding: unused.
+ */
+ uint16_t *chroma_intra_matrix;
+
+ /**
* precision of the intra DC coefficient - 8
* - encoding: Set by user.
* - decoding: Set by libavcodec
@@ -953,20 +997,6 @@ typedef struct AVCodecContext {
int intra_dc_precision;
/**
- * Number of macroblock rows at the top which are skipped.
- * - encoding: unused
- * - decoding: Set by user.
- */
- int skip_top;
-
- /**
- * Number of macroblock rows at the bottom which are skipped.
- * - encoding: unused
- * - decoding: Set by user.
- */
- int skip_bottom;
-
- /**
* minimum MB Lagrange multiplier
* - encoding: Set by user.
* - decoding: unused
@@ -994,11 +1024,11 @@ typedef struct AVCodecContext {
int keyint_min;
/**
- * number of reference frames
+ * the number of pictures in a group of pictures, or 0 for intra_only
* - encoding: Set by user.
- * - decoding: Set by lavc.
+ * - decoding: unused
*/
- int refs;
+ int gop_size;
/**
* Note: Value depends upon the compare function used for fullpel ME.
@@ -1008,44 +1038,6 @@ typedef struct AVCodecContext {
int mv0_threshold;
/**
- * 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 to override the default output color range value,
- * If not specified, libavcodec sets the color range depending on the
- * output format.
- * - decoding: Set by libavcodec, can be set by the user to propagate the
- * color range to components reading from the decoder context.
- */
- enum AVColorRange color_range;
-
- /**
- * This defines the location of chroma samples.
- * - encoding: Set by user
- * - decoding: Set by libavcodec
- */
- enum AVChromaLocation chroma_sample_location;
-
- /**
* Number of slices.
* Indicates number of picture subdivisions. Used for parallelized
* decoding.
@@ -1054,24 +1046,9 @@ typedef struct AVCodecContext {
*/
int slices;
- /** Field order
- * - encoding: set by libavcodec
- * - decoding: Set by user.
- */
- enum AVFieldOrder field_order;
-
/* audio only */
int sample_rate; ///< samples per second
-#if FF_API_OLD_CHANNEL_LAYOUT
- /**
- * number of audio channels
- * @deprecated use ch_layout.nb_channels
- */
- attribute_deprecated
- int channels;
-#endif
-
/**
* audio sample format
* - encoding: Set by user.
@@ -1079,6 +1056,14 @@ typedef struct AVCodecContext {
*/
enum AVSampleFormat sample_fmt; ///< sample format
+ /**
+ * Audio channel layout.
+ * - encoding: must be set by the caller, to one of AVCodec.ch_layouts.
+ * - decoding: may be set by the caller if known e.g. from the container.
+ * The decoder can then override during decoding as needed.
+ */
+ AVChannelLayout ch_layout;
+
/* The following data should not be initialized. */
/**
* Number of samples per channel in an audio frame.
@@ -1091,21 +1076,6 @@ typedef struct AVCodecContext {
*/
int frame_size;
-#if FF_API_AVCTX_FRAME_NUMBER
- /**
- * Frame counter, set by libavcodec.
- *
- * - decoding: total number of frames returned from the decoder so far.
- * - encoding: total number of frames passed to the encoder so far.
- *
- * @note the counter is not incremented if encoding/decoding resulted in
- * an error.
- * @deprecated use frame_num instead
- */
- attribute_deprecated
- int frame_number;
-#endif
-
/**
* number of bytes per packet if constant and known or 0
* Used by some WAV based audio codecs.
@@ -1119,26 +1089,6 @@ typedef struct AVCodecContext {
*/
int cutoff;
-#if FF_API_OLD_CHANNEL_LAYOUT
- /**
- * Audio channel layout.
- * - encoding: set by user.
- * - decoding: set by user, may be overwritten by libavcodec.
- * @deprecated use ch_layout
- */
- attribute_deprecated
- uint64_t channel_layout;
-
- /**
- * Request decoder to use this channel layout if it can (0 for default)
- * - encoding: unused
- * - decoding: Set by user.
- * @deprecated use "downmix" codec private option
- */
- attribute_deprecated
- uint64_t request_channel_layout;
-#endif
-
/**
* Type of service that the audio stream conveys.
* - encoding: Set by user.
@@ -1155,6 +1105,41 @@ typedef struct AVCodecContext {
enum AVSampleFormat request_sample_fmt;
/**
+ * Audio only. The number of "priming" samples (padding) inserted by the
+ * encoder at the beginning of the audio. I.e. this number of leading
+ * decoded samples must be discarded by the caller to get the original audio
+ * without leading padding.
+ *
+ * - decoding: unused
+ * - encoding: Set by libavcodec. The timestamps on the output packets are
+ * adjusted by the encoder so that they always refer to the
+ * first sample of the data actually contained in the packet,
+ * including any added padding. E.g. if the timebase is
+ * 1/samplerate and the timestamp of the first input sample is
+ * 0, the timestamp of the first output packet will be
+ * -initial_padding.
+ */
+ int initial_padding;
+
+ /**
+ * Audio only. The amount of padding (in samples) appended by the encoder to
+ * the end of the audio. I.e. this number of decoded samples must be
+ * discarded by the caller from the end of the stream to get the original
+ * audio without any trailing padding.
+ *
+ * - decoding: unused
+ * - encoding: unused
+ */
+ int trailing_padding;
+
+ /**
+ * Number of samples to skip after a discontinuity
+ * - decoding: unused
+ * - encoding: set by libavcodec
+ */
+ int seek_preroll;
+
+ /**
* This callback is called at the beginning of each frame to get data
* buffer(s) for it. There may be one contiguous buffer for all the data or
* there may be a buffer per each data plane or anything in between. What
@@ -1237,6 +1222,29 @@ typedef struct AVCodecContext {
int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
/* - encoding parameters */
+ /**
+ * number of bits the bitstream is allowed to diverge from the reference.
+ * the reference can be CBR (for CBR pass1) or VBR (for pass2)
+ * - encoding: Set by user; unused for constant quantizer encoding.
+ * - decoding: unused
+ */
+ int bit_rate_tolerance;
+
+ /**
+ * Global quality for codecs which cannot change it per frame.
+ * This should be proportional to MPEG-1/2/4 qscale.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int global_quality;
+
+ /**
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int compression_level;
+#define FF_COMPRESSION_DEFAULT -1
+
float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
@@ -1411,22 +1419,6 @@ typedef struct AVCodecContext {
*/
int err_recognition;
-#if FF_API_REORDERED_OPAQUE
- /**
- * opaque 64-bit number (generally a PTS) that will be reordered and
- * output in AVFrame.reordered_opaque
- * - encoding: Set by libavcodec to the reordered_opaque of the input
- * frame corresponding to the last returned packet. Only
- * supported by encoders with the
- * AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability.
- * - decoding: Set by user.
- *
- * @deprecated Use AV_CODEC_FLAG_COPY_OPAQUE instead
- */
- attribute_deprecated
- int64_t reordered_opaque;
-#endif
-
/**
* Hardware accelerator in use
* - encoding: unused.
@@ -1459,6 +1451,75 @@ typedef struct AVCodecContext {
void *hwaccel_context;
/**
+ * A reference to the AVHWFramesContext describing the input (for encoding)
+ * or output (decoding) frames. The reference is set by the caller and
+ * afterwards owned (and freed) by libavcodec - it should never be read by
+ * the caller after being set.
+ *
+ * - decoding: This field should be set by the caller from the get_format()
+ * callback. The previous reference (if any) will always be
+ * unreffed by libavcodec before the get_format() call.
+ *
+ * If the default get_buffer2() is used with a hwaccel pixel
+ * format, then this AVHWFramesContext will be used for
+ * allocating the frame buffers.
+ *
+ * - encoding: For hardware encoders configured to use a hwaccel pixel
+ * format, this field should be set by the caller to a reference
+ * to the AVHWFramesContext describing input frames.
+ * AVHWFramesContext.format must be equal to
+ * AVCodecContext.pix_fmt.
+ *
+ * This field should be set before avcodec_open2() is called.
+ */
+ AVBufferRef *hw_frames_ctx;
+
+ /**
+ * A reference to the AVHWDeviceContext describing the device which will
+ * be used by a hardware encoder/decoder. The reference is set by the
+ * caller and afterwards owned (and freed) by libavcodec.
+ *
+ * This should be used if either the codec device does not require
+ * hardware frames or any that are used are to be allocated internally by
+ * libavcodec. If the user wishes to supply any of the frames used as
+ * encoder input or decoder output then hw_frames_ctx should be used
+ * instead. When hw_frames_ctx is set in get_format() for a decoder, this
+ * field will be ignored while decoding the associated stream segment, but
+ * may again be used on a following one after another get_format() call.
+ *
+ * For both encoders and decoders this field should be set before
+ * avcodec_open2() is called and must not be written to thereafter.
+ *
+ * Note that some decoders may require this field to be set initially in
+ * order to support hw_frames_ctx at all - in that case, all frames
+ * contexts used must be created on the same device.
+ */
+ AVBufferRef *hw_device_ctx;
+
+ /**
+ * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
+ * decoding (if active).
+ * - encoding: unused
+ * - decoding: Set by user (either before avcodec_open2(), or in the
+ * AVCodecContext.get_format callback)
+ */
+ int hwaccel_flags;
+
+ /**
+ * Video decoding only. Sets the number of extra hardware frames which
+ * the decoder will allocate for use by the caller. This must be set
+ * before avcodec_open2() is called.
+ *
+ * Some hardware decoders require all frames that they will use for
+ * output to be defined in advance before decoding starts. For such
+ * decoders, the hardware frame pool must therefore be of a fixed size.
+ * The extra frames set here are on top of any number that the decoder
+ * needs internally in order to operate normally (for example, frames
+ * used as reference pictures).
+ */
+ int extra_hw_frames;
+
+ /**
* error
* - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR.
* - decoding: unused
@@ -1496,10 +1557,6 @@ typedef struct AVCodecContext {
#define FF_IDCT_SIMPLEARMV6 17
#define FF_IDCT_FAAN 20
#define FF_IDCT_SIMPLENEON 22
-#if FF_API_IDCT_NONE
-// formerly used by xvmc
-#define FF_IDCT_NONE 24
-#endif
#define FF_IDCT_SIMPLEAUTO 128
/**
@@ -1517,13 +1574,6 @@ typedef struct AVCodecContext {
int bits_per_raw_sample;
/**
- * low resolution decoding, 1-> 1/2 size, 2->1/4 size
- * - encoding: unused
- * - decoding: Set by user.
- */
- int lowres;
-
- /**
* thread count
* is used to decide how many independent tasks should be passed to execute()
* - encoding: Set by user.
@@ -1581,13 +1631,6 @@ typedef struct AVCodecContext {
int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count);
/**
- * noise vs. sse weight for the nsse comparison function
- * - encoding: Set by user.
- * - decoding: unused
- */
- int nsse_weight;
-
- /**
* profile
* - encoding: Set by user.
* - decoding: Set by libavcodec.
@@ -1745,6 +1788,16 @@ typedef struct AVCodecContext {
#endif
/**
+ * Properties of the stream that gets decoded
+ * - encoding: unused
+ * - decoding: set by libavcodec
+ */
+ unsigned properties;
+#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001
+#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
+#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004
+
+ /**
* Skip loop filtering for selected frames.
* - encoding: unused
* - decoding: Set by user.
@@ -1766,55 +1819,39 @@ typedef struct AVCodecContext {
enum AVDiscard skip_frame;
/**
- * Header containing style information for text subtitles.
- * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
- * [Script Info] and [V4+ Styles] section, plus the [Events] line and
- * the Format line following. It shouldn't include any Dialogue line.
- * - encoding: Set/allocated/freed by user (before avcodec_open2())
- * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
- */
- uint8_t *subtitle_header;
- int subtitle_header_size;
-
- /**
- * Audio only. The number of "priming" samples (padding) inserted by the
- * encoder at the beginning of the audio. I.e. this number of leading
- * decoded samples must be discarded by the caller to get the original audio
- * without leading padding.
+ * Skip processing alpha if supported by codec.
+ * Note that if the format uses pre-multiplied alpha (common with VP6,
+ * and recommended due to better video quality/compression)
+ * the image will look as if alpha-blended onto a black background.
+ * However for formats that do not use pre-multiplied alpha
+ * there might be serious artefacts (though e.g. libswscale currently
+ * assumes pre-multiplied alpha anyway).
*
- * - decoding: unused
- * - encoding: Set by libavcodec. The timestamps on the output packets are
- * adjusted by the encoder so that they always refer to the
- * first sample of the data actually contained in the packet,
- * including any added padding. E.g. if the timebase is
- * 1/samplerate and the timestamp of the first input sample is
- * 0, the timestamp of the first output packet will be
- * -initial_padding.
+ * - decoding: set by user
+ * - encoding: unused
*/
- int initial_padding;
+ int skip_alpha;
/**
- * - decoding: For codecs that store a framerate value in the compressed
- * bitstream, the decoder may export it here. { 0, 1} when
- * unknown.
- * - encoding: May be used to signal the framerate of CFR content to an
- * encoder.
+ * Number of macroblock rows at the top which are skipped.
+ * - encoding: unused
+ * - decoding: Set by user.
*/
- AVRational framerate;
+ int skip_top;
/**
- * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
- * - encoding: unused.
- * - decoding: Set by libavcodec before calling get_format()
+ * Number of macroblock rows at the bottom which are skipped.
+ * - encoding: unused
+ * - decoding: Set by user.
*/
- enum AVPixelFormat sw_pix_fmt;
+ int skip_bottom;
/**
- * Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
- * - encoding: unused.
- * - decoding: set by user.
+ * low resolution decoding, 1-> 1/2 size, 2->1/4 size
+ * - encoding: unused
+ * - decoding: Set by user.
*/
- AVRational pkt_timebase;
+ int lowres;
/**
* AVCodecDescriptor
@@ -1824,16 +1861,6 @@ typedef struct AVCodecContext {
const struct AVCodecDescriptor *codec_descriptor;
/**
- * Current statistics for PTS correction.
- * - decoding: maintained and used by libavcodec, not intended to be used by user apps
- * - encoding: unused
- */
- int64_t pts_correction_num_faulty_pts; /// Number of incorrect PTS values so far
- int64_t pts_correction_num_faulty_dts; /// Number of incorrect DTS values so far
- int64_t pts_correction_last_pts; /// PTS of the last frame
- int64_t pts_correction_last_dts; /// DTS of the last frame
-
- /**
* Character encoding of the input subtitles file.
* - decoding: set by user
* - encoding: unused
@@ -1853,32 +1880,15 @@ typedef struct AVCodecContext {
#define FF_SUB_CHARENC_MODE_IGNORE 2 ///< neither convert the subtitles, nor check them for valid UTF-8
/**
- * Skip processing alpha if supported by codec.
- * Note that if the format uses pre-multiplied alpha (common with VP6,
- * and recommended due to better video quality/compression)
- * the image will look as if alpha-blended onto a black background.
- * However for formats that do not use pre-multiplied alpha
- * there might be serious artefacts (though e.g. libswscale currently
- * assumes pre-multiplied alpha anyway).
- *
- * - decoding: set by user
- * - encoding: unused
- */
- int skip_alpha;
-
- /**
- * Number of samples to skip after a discontinuity
- * - decoding: unused
- * - encoding: set by libavcodec
- */
- int seek_preroll;
-
- /**
- * custom intra quantization matrix
- * - encoding: Set by user, can be NULL.
- * - decoding: unused.
+ * Header containing style information for text subtitles.
+ * For SUBTITLE_ASS subtitle type, it should contain the whole ASS
+ * [Script Info] and [V4+ Styles] section, plus the [Events] line and
+ * the Format line following. It shouldn't include any Dialogue line.
+ * - encoding: Set/allocated/freed by user (before avcodec_open2())
+ * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2())
*/
- uint16_t *chroma_intra_matrix;
+ int subtitle_header_size;
+ uint8_t *subtitle_header;
/**
* dump format separator.
@@ -1897,16 +1907,6 @@ typedef struct AVCodecContext {
char *codec_whitelist;
/**
- * Properties of the stream that gets decoded
- * - encoding: unused
- * - decoding: set by libavcodec
- */
- unsigned properties;
-#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001
-#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
-#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004
-
- /**
* Additional data associated with the entire coded stream.
*
* - decoding: may be set by user before calling avcodec_open2().
@@ -1916,39 +1916,14 @@ typedef struct AVCodecContext {
int nb_coded_side_data;
/**
- * A reference to the AVHWFramesContext describing the input (for encoding)
- * or output (decoding) frames. The reference is set by the caller and
- * afterwards owned (and freed) by libavcodec - it should never be read by
- * the caller after being set.
- *
- * - decoding: This field should be set by the caller from the get_format()
- * callback. The previous reference (if any) will always be
- * unreffed by libavcodec before the get_format() call.
- *
- * If the default get_buffer2() is used with a hwaccel pixel
- * format, then this AVHWFramesContext will be used for
- * allocating the frame buffers.
- *
- * - encoding: For hardware encoders configured to use a hwaccel pixel
- * format, this field should be set by the caller to a reference
- * to the AVHWFramesContext describing input frames.
- * AVHWFramesContext.format must be equal to
- * AVCodecContext.pix_fmt.
- *
- * This field should be set before avcodec_open2() is called.
- */
- AVBufferRef *hw_frames_ctx;
-
- /**
- * Audio only. The amount of padding (in samples) appended by the encoder to
- * the end of the audio. I.e. this number of decoded samples must be
- * discarded by the caller from the end of the stream to get the original
- * audio without any trailing padding.
+ * Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of
+ * metadata exported in frame, packet, or coded stream side data by
+ * decoders and encoders.
*
- * - decoding: unused
- * - encoding: unused
+ * - decoding: set by user
+ * - encoding: set by user
*/
- int trailing_padding;
+ int export_side_data;
/**
* The number of pixels per image to maximally accept.
@@ -1959,37 +1934,6 @@ typedef struct AVCodecContext {
int64_t max_pixels;
/**
- * A reference to the AVHWDeviceContext describing the device which will
- * be used by a hardware encoder/decoder. The reference is set by the
- * caller and afterwards owned (and freed) by libavcodec.
- *
- * This should be used if either the codec device does not require
- * hardware frames or any that are used are to be allocated internally by
- * libavcodec. If the user wishes to supply any of the frames used as
- * encoder input or decoder output then hw_frames_ctx should be used
- * instead. When hw_frames_ctx is set in get_format() for a decoder, this
- * field will be ignored while decoding the associated stream segment, but
- * may again be used on a following one after another get_format() call.
- *
- * For both encoders and decoders this field should be set before
- * avcodec_open2() is called and must not be written to thereafter.
- *
- * Note that some decoders may require this field to be set initially in
- * order to support hw_frames_ctx at all - in that case, all frames
- * contexts used must be created on the same device.
- */
- AVBufferRef *hw_device_ctx;
-
- /**
- * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
- * decoding (if active).
- * - encoding: unused
- * - decoding: Set by user (either before avcodec_open2(), or in the
- * AVCodecContext.get_format callback)
- */
- int hwaccel_flags;
-
- /**
* Video decoding only. Certain video codecs support cropping, meaning that
* only a sub-rectangle of the decoded frame is intended for display. This
* option controls how cropping is handled by libavcodec.
@@ -2016,20 +1960,6 @@ typedef struct AVCodecContext {
*/
int apply_cropping;
- /*
- * Video decoding only. Sets the number of extra hardware frames which
- * the decoder will allocate for use by the caller. This must be set
- * before avcodec_open2() is called.
- *
- * Some hardware decoders require all frames that they will use for
- * output to be defined in advance before decoding starts. For such
- * decoders, the hardware frame pool must therefore be of a fixed size.
- * The extra frames set here are on top of any number that the decoder
- * needs internally in order to operate normally (for example, frames
- * used as reference pictures).
- */
- int extra_hw_frames;
-
/**
* The percentage of damaged samples to discard a frame.
*
@@ -2047,16 +1977,6 @@ typedef struct AVCodecContext {
int64_t max_samples;
/**
- * Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of
- * metadata exported in frame, packet, or coded stream side data by
- * decoders and encoders.
- *
- * - decoding: set by user
- * - encoding: set by user
- */
- int export_side_data;
-
- /**
* This callback is called at the beginning of each packet to get a data
* buffer for it.
*
@@ -2099,14 +2019,6 @@ typedef struct AVCodecContext {
int (*get_encode_buffer)(struct AVCodecContext *s, AVPacket *pkt, int flags);
/**
- * Audio channel layout.
- * - encoding: must be set by the caller, to one of AVCodec.ch_layouts.
- * - decoding: may be set by the caller if known e.g. from the container.
- * The decoder can then override during decoding as needed.
- */
- AVChannelLayout ch_layout;
-
- /**
* Frame counter, set by libavcodec.
*
* - decoding: total number of frames returned from the decoder so far.
@@ -2116,6 +2028,53 @@ typedef struct AVCodecContext {
* an error.
*/
int64_t frame_num;
+
+ /**
+ * Decoding only. May be set by the caller before avcodec_open2() to an
+ * av_malloc()'ed array (or via AVOptions). Owned and freed by the decoder
+ * afterwards.
+ *
+ * Side data attached to decoded frames may come from several sources:
+ * 1. coded_side_data, which the decoder will for certain types translate
+ * from packet-type to frame-type and attach to frames;
+ * 2. side data attached to an AVPacket sent for decoding (same
+ * considerations as above);
+ * 3. extracted from the coded bytestream.
+ * The first two cases are supplied by the caller and typically come from a
+ * container.
+ *
+ * This array configures decoder behaviour in cases when side data of the
+ * same type is present both in the coded bytestream and in the
+ * user-supplied side data (items 1. and 2. above). In all cases, at most
+ * one instance of each side data type will be attached to output frames. By
+ * default it will be the bytestream side data. Adding an
+ * AVPacketSideDataType value to this array will flip the preference for
+ * this type, thus making the decoder prefer user-supplied side data over
+ * bytestream. In case side data of the same type is present both in
+ * coded_data and attacked to a packet, the packet instance always has
+ * priority.
+ *
+ * The array may also contain a single -1, in which case the preference is
+ * switched for all side data types.
+ */
+ int *side_data_prefer_packet;
+ /**
+ * Number of entries in side_data_prefer_packet.
+ */
+ unsigned nb_side_data_prefer_packet;
+
+ /**
+ * Array containing static side data, such as HDR10 CLL / MDCV structures.
+ * Side data entries should be allocated by usage of helpers defined in
+ * libavutil/frame.h.
+ *
+ * - encoding: may be set by user before calling avcodec_open2() for
+ * encoder configuration. Afterwards owned and freed by the
+ * encoder.
+ * - decoding: unused
+ */
+ AVFrameSideData **decoded_side_data;
+ int nb_decoded_side_data;
} AVCodecContext;
/**
@@ -2252,6 +2211,7 @@ typedef struct AVSubtitleRect {
uint8_t *data[4];
int linesize[4];
+ int flags;
enum AVSubtitleType type;
char *text; ///< 0 terminated plain UTF-8 text
@@ -2262,8 +2222,6 @@ typedef struct AVSubtitleRect {
* struct.
*/
char *ass;
-
- int flags;
} AVSubtitleRect;
typedef struct AVSubtitle {
@@ -2411,6 +2369,7 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
*/
int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
+#if FF_API_AVCODEC_CLOSE
/**
* Close a given AVCodecContext and free all the data associated with it
* (but not the AVCodecContext itself).
@@ -2419,12 +2378,14 @@ int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **op
* the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL
* codec. Subsequent calls will do nothing.
*
- * @note Do not use this function. Use avcodec_free_context() to destroy a
+ * @deprecated Do not use this function. Use avcodec_free_context() to destroy a
* codec context (either open or closed). Opening and closing a codec context
* multiple times is not supported anymore -- use multiple codec contexts
* instead.
*/
+attribute_deprecated
int avcodec_close(AVCodecContext *avctx);
+#endif
/**
* Free all allocated data in the given subtitle struct.
@@ -2475,34 +2436,6 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height);
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
int linesize_align[AV_NUM_DATA_POINTERS]);
-#ifdef FF_API_AVCODEC_CHROMA_POS
-/**
- * Converts AVChromaLocation to swscale x/y chroma position.
- *
- * The positions represent the chroma (0,0) position in a coordinates system
- * with luma (0,0) representing the origin and luma(1,1) representing 256,256
- *
- * @param xpos horizontal chroma sample position
- * @param ypos vertical chroma sample position
- * @deprecated Use av_chroma_location_enum_to_pos() instead.
- */
- attribute_deprecated
-int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos);
-
-/**
- * Converts swscale x/y chroma position to AVChromaLocation.
- *
- * The positions represent the chroma (0,0) position in a coordinates system
- * with luma (0,0) representing the origin and luma(1,1) representing 256,256
- *
- * @param xpos horizontal chroma sample position
- * @param ypos vertical chroma sample position
- * @deprecated Use av_chroma_location_pos_to_enum() instead.
- */
- attribute_deprecated
-enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
-#endif
-
/**
* Decode a subtitle message.
* Return a negative value on error, otherwise return the number of bytes used.