53 WebPAnimEncoderOptions enc_options = { { 0 } };
54 WebPAnimEncoderOptionsInit(&enc_options);
57 s->enc = WebPAnimEncoderNew(avctx->
width, avctx->
height, &enc_options);
76 WebPData assembled_data = { 0 };
77 ret = WebPAnimEncoderAssemble(
s->enc, &assembled_data);
81 WebPDataClear(&assembled_data);
84 memcpy(
pkt->data, assembled_data.bytes, assembled_data.size);
85 WebPDataClear(&assembled_data);
87 pkt->pts =
s->first_frame_pts;
90 pkt->duration =
s->end_pts -
pkt->pts;
93 pkt->opaque =
s->first_frame_opaque;
94 pkt->opaque_ref =
s->first_frame_opaque_ref;
95 s->first_frame_opaque_ref =
NULL;
101 WebPDataClear(&assembled_data);
103 "WebPAnimEncoderAssemble() failed with error: %d\n",
104 VP8_ENC_ERROR_OUT_OF_MEMORY);
110 WebPPicture *pic =
NULL;
118 ret = WebPAnimEncoderAdd(
s->enc, pic, timestamp_ms, &
s->cc.config);
121 "Encoding WebP frame failed with error: %d\n",
128 s->first_frame_pts =
frame->pts;
131 s->first_frame_opaque =
frame->opaque;
145 WebPPictureFree(pic);
156 WebPAnimEncoderDelete(
s->enc);
164 .p.name =
"libwebp_anim",
173 .p.wrapper_name =
"libwebp",
const FFCodec ff_libwebp_anim_encoder
static const FFCodecDefault defaults[]
refcounted data buffer API
#define CODEC_PIXFMTS_ARRAY(array)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
int(* init)(AVBSFContext *ctx)
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_FLAG_COPY_OPAQUE
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
int av_buffer_replace(AVBufferRef **pdst, const AVBufferRef *src)
Ensure dst refers to the same data as src.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_log_get_level(void)
Get the current log level.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int libwebp_anim_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
static int libwebp_anim_encode_close(AVCodecContext *avctx)
static av_cold int libwebp_anim_encode_init(AVCodecContext *avctx)
int ff_libwebp_get_frame(AVCodecContext *avctx, LibWebPContextCommon *s, const AVFrame *frame, AVFrame **alt_frame_ptr, WebPPicture **pic_ptr)
const AVClass ff_libwebpenc_class
enum AVPixelFormat ff_libwebpenc_pix_fmts[]
av_cold int ff_libwebp_encode_init_common(AVCodecContext *avctx)
int ff_libwebp_error_to_averror(int err)
const FFCodecDefault ff_libwebp_defaults[]
WebP encoder using libwebp: common structs and methods.
Memory handling functions.
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
A reference to a data buffer.
main external API structure.
int width
picture width / height.
int64_t frame_num
Frame counter, set by libavcodec.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int flags
AV_CODEC_FLAG_*.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
AVBufferRef * first_frame_opaque_ref
void * first_frame_opaque