Go to the documentation of this file.
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;
181 if (
w->using_webp_anim_encoder) {
204 #define OFFSET(x) offsetof(WebpContext, x)
205 #define ENC AV_OPT_FLAG_ENCODING_PARAM
207 {
"loop",
"Number of times to loop the output: 0 - infinite loop",
OFFSET(
loop),
221 .p.extensions =
"webp",
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int using_webp_anim_encoder
#define FF_OFMT_FLAG_ONLY_DEFAULT_CODECS
If this flag is set, then the only permitted audio/video/subtitle codec ids are AVOutputFormat....
void avio_wl16(AVIOContext *s, unsigned int val)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
static const AVOption options[]
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
const char * av_default_item_name(void *ptr)
Return the context name.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int is_animated_webp_packet(AVPacket *pkt)
#define AV_NOPTS_VALUE
Undefined timestamp value.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
void avio_wl32(AVIOContext *s, unsigned int val)
static const AVClass webp_muxer_class
static int64_t filesize(AVIOContext *pb)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static int flush(AVFormatContext *s, int trailer, int64_t pts)
Returns 1 if it has written a RIFF header with a correct length field.
static int webp_write_packet(AVFormatContext *s, AVPacket *pkt)
#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....
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
const FFOutputFormat ff_webp_muxer
AVPacket * pkt
Used to hold temporary packets for the generic demuxing code.
This structure stores compressed data.
static int webp_init(AVFormatContext *s)
#define flags(name, subs,...)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
static int webp_write_trailer(AVFormatContext *s)