*/
#define AV_GET_BUFFER_FLAG_REF (1 << 0)
+/**
+ * The encoder will keep a reference to the packet and may reuse it later.
+ */
+#define AV_GET_ENCODE_BUFFER_FLAG_REF (1 << 0)
+
struct AVCodecInternal;
/**
*/
int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags);
+#if FF_API_OLD_ENCDEC
/**
* If non-zero, the decoded audio and video frames returned from
* avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted
*/
attribute_deprecated
int refcounted_frames;
+#endif
/* - encoding parameters */
float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
/**
* Error recognition; may misdetect some more or less valid parts as errors.
- * - encoding: unused
+ * - encoding: Set by user.
* - decoding: Set by user.
*/
int err_recognition;
*/
int bits_per_raw_sample;
-#if FF_API_LOWRES
/**
* low resolution decoding, 1-> 1/2 size, 2->1/4 size
* - encoding: unused
* - decoding: Set by user.
*/
int lowres;
-#endif
#if FF_API_CODED_FRAME
/**
*
* @deprecated the custom get_buffer2() callback should always be
* thread-safe. Thread-unsafe get_buffer2() implementations will be
- * invalid once this field is removed.
+ * invalid starting with LIBAVCODEC_VERSION_MAJOR=60; in other words,
+ * libavcodec will behave as if this field was always set to 1.
+ * Callers that want to be forward compatible with future libavcodec
+ * versions should wrap access to this field in
+ * #if LIBAVCODEC_VERSION_MAJOR < 60
*/
attribute_deprecated
int thread_safe_callbacks;
*/
const AVCodecDescriptor *codec_descriptor;
-#if !FF_API_LOWRES
- /**
- * low resolution decoding, 1-> 1/2 size, 2->1/4 size
- * - encoding: unused
- * - decoding: Set by user.
- */
- int lowres;
-#endif
-
/**
* Current statistics for PTS correction.
* - decoding: maintained and used by libavcodec, not intended to be used by user apps
*/
int seek_preroll;
+#if FF_API_DEBUG_MV
/**
- * debug motion vectors
- * - encoding: Set by user.
- * - decoding: Set by user.
+ * @deprecated unused
*/
+ attribute_deprecated
int debug_mv;
#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames
#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames
#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames
+#endif
/**
* custom intra quantization matrix
* - 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.
+ *
+ * The following field will be set in the packet before this callback is
+ * called:
+ * - size
+ * This callback must use the above value to calculate the required buffer size,
+ * which must padded by at least AV_INPUT_BUFFER_PADDING_SIZE bytes.
+ *
+ * This callback must fill the following fields in the packet:
+ * - data: alignment requirements for AVPacket apply, if any. Some architectures and
+ * encoders may benefit from having aligned data.
+ * - buf: must contain a pointer to an AVBufferRef structure. The packet's
+ * data pointer must be contained in it. See: av_buffer_create(), av_buffer_alloc(),
+ * and av_buffer_ref().
+ *
+ * If AV_CODEC_CAP_DR1 is not set then get_encode_buffer() must call
+ * avcodec_default_get_encode_buffer() instead of providing a buffer allocated by
+ * some other means.
+ *
+ * The flags field may contain a combination of AV_GET_ENCODE_BUFFER_FLAG_ flags.
+ * They may be used for example to hint what use the buffer may get after being
+ * created.
+ * Implementations of this callback may ignore flags they don't understand.
+ * If AV_GET_ENCODE_BUFFER_FLAG_REF is set in flags then the packet may be reused
+ * (read and/or written to if it is writable) later by libavcodec.
+ *
+ * This callback must be thread-safe, as when frame threading is used, it may
+ * be called from multiple threads simultaneously.
+ *
+ * @see avcodec_default_get_encode_buffer()
+ *
+ * - encoding: Set by libavcodec, user can override.
+ * - decoding: unused
+ */
+ int (*get_encode_buffer)(struct AVCodecContext *s, AVPacket *pkt, int flags);
} AVCodecContext;
#if FF_API_CODEC_GET_SET
attribute_deprecated
unsigned av_codec_get_codec_properties(const AVCodecContext *avctx);
-#if FF_API_LOWRES
attribute_deprecated
int av_codec_get_lowres(const AVCodecContext *avctx);
attribute_deprecated
void av_codec_set_lowres(AVCodecContext *avctx, int val);
-#endif
attribute_deprecated
int av_codec_get_seek_preroll(const AVCodecContext *avctx);
int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
} AVSubtitle;
-#if FF_API_NEXT
-/**
- * If c is NULL, returns the first registered codec,
- * if c is non-NULL, returns the next registered codec after c,
- * or NULL if c is the last one.
- */
-attribute_deprecated
-AVCodec *av_codec_next(const AVCodec *c);
-#endif
-
/**
* Return the LIBAVCODEC_VERSION_INT constant.
*/
*/
const char *avcodec_license(void);
-#if FF_API_NEXT
-/**
- * Register the codec codec and initialize libavcodec.
- *
- * @warning either this function or avcodec_register_all() must be called
- * before any other libavcodec functions.
- *
- * @see avcodec_register_all()
- */
-attribute_deprecated
-void avcodec_register(AVCodec *codec);
-
-/**
- * Register all the codecs, parsers and bitstream filters which were enabled at
- * configuration time. If you do not call this function you can select exactly
- * which formats you want to support, by using the individual registration
- * functions.
- *
- * @see avcodec_register
- * @see av_register_codec_parser
- * @see av_register_bitstream_filter
- */
-attribute_deprecated
-void avcodec_register_all(void);
-#endif
-
/**
* Allocate an AVCodecContext and set its fields to default values. The
* resulting struct should be freed with avcodec_free_context().
*/
const AVClass *avcodec_get_class(void);
-#if FF_API_COPY_CONTEXT
+#if FF_API_GET_FRAME_CLASS
/**
- * Get the AVClass for AVFrame. It can be used in combination with
- * AV_OPT_SEARCH_FAKE_OBJ for examining options.
- *
- * @see av_opt_find().
+ * @deprecated This function should not be used.
*/
+attribute_deprecated
const AVClass *avcodec_get_frame_class(void);
+#endif
/**
* Get the AVClass for AVSubtitleRect. It can be used in combination with
*/
const AVClass *avcodec_get_subtitle_rect_class(void);
+#if FF_API_COPY_CONTEXT
/**
* Copy the settings of the source AVCodecContext into the destination
* AVCodecContext. The resulting destination codec context will be
* @ref avcodec_receive_frame()).
*
* @code
- * avcodec_register_all();
* av_dict_set(&opts, "b", "2.5M", 0);
* codec = avcodec_find_decoder(AV_CODEC_ID_H264);
* if (!codec)
*/
int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags);
+/**
+ * The default callback for AVCodecContext.get_encode_buffer(). It is made public so
+ * it can be called by custom get_encode_buffer() implementations for encoders without
+ * AV_CODEC_CAP_DR1 set.
+ */
+int avcodec_default_get_encode_buffer(AVCodecContext *s, AVPacket *pkt, int flags);
+
/**
* Modify width and height values so that they will result in a memory
* buffer that is acceptable for the codec if you do not use any horizontal
*/
enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos);
+#if FF_API_OLD_ENCDEC
/**
* Decode the audio frame of size avpkt->size from avpkt->data into frame.
*
int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
int *got_picture_ptr,
const AVPacket *avpkt);
+#endif
/**
* Decode a subtitle message.
const uint8_t *buf, int buf_size);
void (*parser_close)(AVCodecParserContext *s);
int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
- struct AVCodecParser *next;
} AVCodecParser;
/**
*/
const AVCodecParser *av_parser_iterate(void **opaque);
-#if FF_API_NEXT
-attribute_deprecated
-AVCodecParser *av_parser_next(const AVCodecParser *c);
-
-attribute_deprecated
-void av_register_codec_parser(AVCodecParser *parser);
-#endif
AVCodecParserContext *av_parser_init(int codec_id);
/**
int64_t pts, int64_t dts,
int64_t pos);
+#if FF_API_PARSER_CHANGE
/**
* @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed
- * @deprecated use AVBitStreamFilter
+ * @deprecated Use dump_extradata, remove_extra or extract_extradata
+ * bitstream filters instead.
*/
+attribute_deprecated
int av_parser_change(AVCodecParserContext *s,
AVCodecContext *avctx,
uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size, int keyframe);
+#endif
void av_parser_close(AVCodecParserContext *s);
/**
* @{
*/
+#if FF_API_OLD_ENCDEC
/**
* Encode a frame of audio.
*
* not be used.
* @return 0 on success, negative error code on failure
*
- * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
+ * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead.
+ * If allowed and required, set AVCodecContext.get_encode_buffer to
+ * a custom function to pass user supplied output buffers.
*/
attribute_deprecated
int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
* not be used.
* @return 0 on success, negative error code on failure
*
- * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead
+ * @deprecated use avcodec_send_frame()/avcodec_receive_packet() instead.
+ * If allowed and required, set AVCodecContext.get_encode_buffer to
+ * a custom function to pass user supplied output buffers.
*/
attribute_deprecated
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr);
+#endif
int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const AVSubtitle *sub);
*/
unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt);
-/**
- * @deprecated see av_get_pix_fmt_loss()
- */
-int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
- int has_alpha);
-
/**
* Find the best pixel format to convert to given a certain source pixel
* format. When converting from one pixel format to another, information loss
enum AVPixelFormat src_pix_fmt,
int has_alpha, int *loss_ptr);
+#if FF_API_AVCODEC_PIX_FMT
+/**
+ * @deprecated see av_get_pix_fmt_loss()
+ */
+attribute_deprecated
+int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt,
+ int has_alpha);
/**
* @deprecated see av_find_best_pix_fmt_of_2()
*/
+attribute_deprecated
enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
attribute_deprecated
enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2,
enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr);
+#endif
enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt);
const AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f);
#endif
-#if FF_API_NEXT
-attribute_deprecated
-const AVBitStreamFilter *av_bsf_next(void **opaque);
-#endif
-
/* memory */
/**