avcodec: add a get_encode_buffer() callback to AVCodecContext

This callback is functionally the same as get_buffer2() is for decoders, and
implements for the new encode API the functionality of the old encode API had
where the user could provide their own buffers.

Reviewed-by: Lynne <dev@lynne.ee>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2021-02-20 16:01:52 -03:00
parent 2c96e6cb95
commit 6e7e3a3820
7 changed files with 131 additions and 4 deletions

View File

@@ -24,6 +24,7 @@
#include "libavutil/frame.h"
#include "avcodec.h"
#include "packet.h"
/**
* Called by encoders to get the next frame for encoding.
@@ -36,4 +37,11 @@
*/
int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame);
/**
* Get a buffer for a packet. This is a wrapper around
* AVCodecContext.get_encode_buffer() and should be used instead calling get_encode_buffer()
* directly.
*/
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags);
#endif /* AVCODEC_ENCODE_H */