81 14 + 24 ], *bufp = buf;
82 int writing_webp_header = 0,
skip = 0;
86 if (!
w->last_pkt->size)
94 if (vp8x_end >
w->last_pkt->size)
101 if (!
w->wrote_webp_header) {
102 bytestream_put_le32(&bufp,
MKTAG(
'R',
'I',
'F',
'F'));
103 bytestream_put_le32(&bufp, 0);
104 bytestream_put_le32(&bufp,
MKTAG(
'W',
'E',
'B',
'P'));
105 writing_webp_header = 1;
106 w->wrote_webp_header = 1;
107 if (
w->frame_count > 1)
111 if (
w->frame_count == 1) {
118 bytestream_put_le32(&bufp,
MKTAG(
'V',
'P',
'8',
'X'));
119 bytestream_put_le32(&bufp, 10);
120 bytestream_put_byte(&bufp,
flags);
121 bytestream_put_le24(&bufp, 0);
126 bytestream_put_le32(&bufp,
MKTAG(
'A',
'N',
'I',
'M'));
127 bytestream_put_le32(&bufp, 6);
128 bytestream_put_le32(&bufp, 0xFFFFFFFF);
129 bytestream_put_le16(&bufp,
w->loop);
133 if (
w->frame_count > trailer) {
134 bytestream_put_le32(&bufp,
MKTAG(
'A',
'N',
'M',
'F'));
135 bytestream_put_le32(&bufp, 16 +
w->last_pkt->size -
skip);
136 bytestream_put_le24(&bufp, 0);
137 bytestream_put_le24(&bufp, 0);
141 bytestream_put_le24(&bufp,
pts -
w->last_pkt->pts);
143 bytestream_put_le24(&bufp,
w->last_pkt->duration);
144 bytestream_put_byte(&bufp, 0);
146 if (trailer && writing_webp_header)
147 AV_WL32(buf + 4, bufp - (buf + 8) +
w->last_pkt->size -
skip);
152 return trailer && writing_webp_header;
165 w->using_webp_anim_encoder |= ret;
167 if (
w->using_webp_anim_encoder) {
169 w->wrote_webp_header = 1;
185 if (
w->using_webp_anim_encoder) {
208#define OFFSET(x) offsetof(WebpContext, x)
209#define ENC AV_OPT_FLAG_ENCODING_PARAM
211 {
"loop",
"Number of times to loop the output: 0 - infinite loop",
OFFSET(
loop),
217 .class_name =
"WebP muxer",
225 .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)