#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/emms.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/samplefmt.h"
#include "avcodec.h"
#include "avcodec_internal.h"
#include "codec_desc.h"
#include "codec_internal.h"
#include "encode.h"
#include "frame_thread_encoder.h"
#include "internal.h"
EncodeContext;
static EncodeContext *encode_ctx(AVCodecInternal *avci)
{ … }
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
{ … }
int avcodec_default_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int flags)
{ … }
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
{ … }
static int encode_make_refcounted(AVCodecContext *avctx, AVPacket *avpkt)
{ … }
static int pad_last_frame(AVCodecContext *s, AVFrame *frame, const AVFrame *src, int out_samples)
{ … }
int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const AVSubtitle *sub)
{ … }
int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
{ … }
int ff_encode_reordered_opaque(AVCodecContext *avctx,
AVPacket *pkt, const AVFrame *frame)
{ … }
int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
AVFrame *frame, int *got_packet)
{ … }
static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
{ … }
static int encode_simple_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
{ … }
static int encode_receive_packet_internal(AVCodecContext *avctx, AVPacket *avpkt)
{ … }
#if CONFIG_LCMS2
static int encode_generate_icc_profile(AVCodecContext *avctx, AVFrame *frame)
{
enum AVColorTransferCharacteristic trc = frame->color_trc;
enum AVColorPrimaries prim = frame->color_primaries;
const FFCodec *const codec = ffcodec(avctx->codec);
AVCodecInternal *avci = avctx->internal;
cmsHPROFILE profile;
int ret;
if (!(avctx->flags2 & AV_CODEC_FLAG2_ICC_PROFILES))
return 0;
if (!(codec->caps_internal & FF_CODEC_CAP_ICC_PROFILES))
return 0;
if (trc == AVCOL_TRC_UNSPECIFIED)
trc = avctx->color_trc;
if (prim == AVCOL_PRI_UNSPECIFIED)
prim = avctx->color_primaries;
if (trc == AVCOL_TRC_UNSPECIFIED || prim == AVCOL_PRI_UNSPECIFIED)
return 0;
if (av_frame_get_side_data(frame, AV_FRAME_DATA_ICC_PROFILE))
return 0;
if (!avci->icc.avctx) {
ret = ff_icc_context_init(&avci->icc, avctx);
if (ret < 0)
return ret;
}
ret = ff_icc_profile_generate(&avci->icc, prim, trc, &profile);
if (ret < 0)
return ret;
ret = ff_icc_profile_attach(&avci->icc, profile, frame);
cmsCloseProfile(profile);
return ret;
}
#else
static int encode_generate_icc_profile(av_unused AVCodecContext *c, av_unused AVFrame *f)
{ … }
#endif
static int encode_send_frame_internal(AVCodecContext *avctx, const AVFrame *src)
{ … }
int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame)
{ … }
int attribute_align_arg avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
{ … }
static int encode_preinit_video(AVCodecContext *avctx)
{ … }
static int encode_preinit_audio(AVCodecContext *avctx)
{ … }
int ff_encode_preinit(AVCodecContext *avctx)
{ … }
int ff_encode_alloc_frame(AVCodecContext *avctx, AVFrame *frame)
{ … }
int ff_encode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
{ … }
void ff_encode_flush_buffers(AVCodecContext *avctx)
{ … }
AVCodecInternal *ff_encode_internal_alloc(void)
{ … }
AVCPBProperties *ff_encode_add_cpb_side_data(AVCodecContext *avctx)
{ … }