79 14 + 24 ], *bufp = buf;
80 int writing_webp_header = 0,
skip = 0;
84 if (!
w->last_pkt->size)
96 if (!
w->wrote_webp_header) {
97 bytestream_put_le32(&bufp,
MKTAG(
'R',
'I',
'F',
'F'));
98 bytestream_put_le32(&bufp, 0);
99 bytestream_put_le32(&bufp,
MKTAG(
'W',
'E',
'B',
'P'));
100 writing_webp_header = 1;
101 w->wrote_webp_header = 1;
102 if (
w->frame_count > 1)
106 if (
w->frame_count == 1) {
113 bytestream_put_le32(&bufp,
MKTAG(
'V',
'P',
'8',
'X'));
114 bytestream_put_le32(&bufp, 10);
115 bytestream_put_byte(&bufp,
flags);
116 bytestream_put_le24(&bufp, 0);
121 bytestream_put_le32(&bufp,
MKTAG(
'A',
'N',
'I',
'M'));
122 bytestream_put_le32(&bufp, 6);
123 bytestream_put_le32(&bufp, 0xFFFFFFFF);
124 bytestream_put_le16(&bufp,
w->loop);
128 if (
w->frame_count > trailer) {
129 bytestream_put_le32(&bufp,
MKTAG(
'A',
'N',
'M',
'F'));
130 bytestream_put_le32(&bufp, 16 +
w->last_pkt->size -
skip);
131 bytestream_put_le24(&bufp, 0);
132 bytestream_put_le24(&bufp, 0);
136 bytestream_put_le24(&bufp,
pts -
w->last_pkt->pts);
138 bytestream_put_le24(&bufp,
w->last_pkt->duration);
139 bytestream_put_byte(&bufp, 0);
141 if (trailer && writing_webp_header)
142 AV_WL32(buf + 4, bufp - (buf + 8) +
w->last_pkt->size -
skip);
147 return trailer && writing_webp_header;
160 w->using_webp_anim_encoder |= ret;
162 if (
w->using_webp_anim_encoder) {
164 w->wrote_webp_header = 1;
180 if (
w->using_webp_anim_encoder) {
203#define OFFSET(x) offsetof(WebpContext, x)
204#define ENC AV_OPT_FLAG_ENCODING_PARAM
206 {
"loop",
"Number of times to loop the output: 0 - infinite loop",
OFFSET(
loop),
212 .class_name =
"WebP muxer",
220 .p.extensions =
"webp",
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
void avio_wl32(AVIOContext *s, unsigned int val)
void avio_wl16(AVIOContext *s, unsigned int val)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static void BS_FUNC skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
#define flags(name, subs,...)
void(* flush)(AVBSFContext *ctx)
static int64_t filesize(AVIOContext *pb)
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const char * av_default_item_name(void *ptr)
Return the context name.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define LIBAVUTIL_VERSION_INT
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define MKTAG(a, b, c, d)
#define FF_OFMT_FLAG_MAX_ONE_OF_EACH
If this flag is set, it indicates that for each codec type whose corresponding default codec (i....
#define FF_OFMT_FLAG_ONLY_DEFAULT_CODECS
If this flag is set, then the only permitted audio/video/subtitle codec ids are AVOutputFormat....
Describe the class of an AVClass context structure.
int height
The height of the video frame in pixels.
int width
The width of the video frame in pixels.
This structure stores compressed data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVPacket * pkt
Used to hold temporary packets for the generic demuxing code.
int using_webp_anim_encoder
static int webp_write_trailer(AVFormatContext *s)
static int webp_init(AVFormatContext *s)
static const AVClass webp_muxer_class
static int is_animated_webp_packet(AVPacket *pkt)
static int webp_write_packet(AVFormatContext *s, AVPacket *pkt)