69 crc =
av_crc(crc_table, crc, tagbuf, 4);
72 crc =
av_crc(crc_table, crc, buf, length);
86 "APNG muxer supports only a single video APNG stream.\n");
94 "Last frame delay is too precise. Reducing to %d/%d (%f).\n",
117 av_log(format_context,
AV_LOG_INFO,
"Only a single frame so saving as a normal PNG.\n");
121 if (existing_acTL_chunk) {
122 uint8_t *chunk_after_acTL = existing_acTL_chunk +
AV_RB32(existing_acTL_chunk) + 12;
131 if (existing_fcTL_chunk) {
132 uint8_t *chunk_after_fcTL = existing_fcTL_chunk +
AV_RB32(existing_fcTL_chunk) + 12;
148 if (!existing_acTL_chunk) {
159 if (existing_fcTL_chunk) {
162 existing_fcTL_chunk += 8;
163 delay.
num =
AV_RB16(existing_fcTL_chunk + 20);
164 delay.
den =
AV_RB16(existing_fcTL_chunk + 22);
166 if (delay.
num == 0 && delay.
den == 0) {
170 if (!
av_reduce(&delay.
num, &delay.
den, delay_num_raw, delay_den_raw, USHRT_MAX) &&
173 "Frame rate is too high or specified too precisely. Unable to copy losslessly.\n");
241 #define OFFSET(x) offsetof(APNGMuxContext, x)
242 #define ENC AV_OPT_FLAG_ENCODING_PARAM
244 {
"plays",
"Number of times to play the output: 0 - infinite loop, 1 - no loop",
OFFSET(plays),
246 {
"final_delay",
"Force delay after the last frame",
OFFSET(last_delay),
261 .mime_type =
"image/png",
262 .extensions =
"apng",
269 .priv_class = &apng_muxer_class,
void avio_wb64(AVIOContext *s, uint64_t val)
static int apng_write_trailer(AVFormatContext *format_context)
#define AV_LOG_WARNING
Something somehow does not look correct.
#define LIBAVUTIL_VERSION_INT
static const AVClass apng_muxer_class
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
AVStream ** streams
A list of all streams in the file.
static void apng_write_chunk(AVIOContext *io_context, uint32_t tag, uint8_t *buf, size_t length)
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 flush_packet(AVFormatContext *format_context, AVPacket *packet)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
AVOutputFormat ff_apng_muxer
simple assert() macros that are a bit more flexible than ISO C assert().
AVCodecContext * codec
Codec context associated with this stream.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
static int write_trailer(AVFormatContext *s1)
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
static uint8_t * apng_find_chunk(uint32_t tag, uint8_t *buf, size_t length)
#define AV_LOG_INFO
Standard information.
enum AVMediaType codec_type
AVIOContext * pb
I/O context.
main external API structure.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_copy_packet(AVPacket *dst, const AVPacket *src)
Copy packet, including contents.
Describe the class of an AVClass context structure.
static const AVOption options[]
rational number numerator/denominator
static int apng_write_packet(AVFormatContext *format_context, AVPacket *packet)
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
#define MKBETAG(a, b, c, d)
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
void avio_wb32(AVIOContext *s, unsigned int val)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
static int apng_write_header(AVFormatContext *format_context)