FFmpeg
Data Structures | Macros | Functions | Variables
apngenc.c File Reference
#include "avformat.h"
#include "mux.h"
#include "libavutil/avassert.h"
#include "libavutil/crc.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "libavcodec/apng.h"
#include "libavcodec/png.h"

Go to the source code of this file.

Data Structures

struct  APNGMuxContext
 

Macros

#define OFFSET(x)   offsetof(APNGMuxContext, x)
 
#define ENC   AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static const uint8_t * apng_find_chunk (uint32_t tag, const uint8_t *buf, size_t length)
 
static void apng_write_chunk (AVIOContext *io_context, uint32_t tag, uint8_t *buf, size_t length)
 
static int apng_write_header (AVFormatContext *format_context)
 
static int flush_packet (AVFormatContext *format_context, AVPacket *packet)
 
static int apng_write_packet (AVFormatContext *format_context, AVPacket *packet)
 
static int apng_write_trailer (AVFormatContext *format_context)
 
static void apng_deinit (AVFormatContext *s)
 

Variables

static const AVOption options []
 
static const AVClass apng_muxer_class
 
const FFOutputFormat ff_apng_muxer
 

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(APNGMuxContext, x)

Definition at line 293 of file apngenc.c.

◆ ENC

#define ENC   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 294 of file apngenc.c.

Function Documentation

◆ apng_find_chunk()

static const uint8_t* apng_find_chunk ( uint32_t  tag,
const uint8_t *  buf,
size_t  length 
)
static

Definition at line 52 of file apngenc.c.

Referenced by flush_packet().

◆ apng_write_chunk()

static void apng_write_chunk ( AVIOContext io_context,
uint32_t  tag,
uint8_t *  buf,
size_t  length 
)
static

Definition at line 62 of file apngenc.c.

Referenced by apng_write_trailer(), and flush_packet().

◆ apng_write_header()

static int apng_write_header ( AVFormatContext format_context)
static

Definition at line 82 of file apngenc.c.

◆ flush_packet()

static int flush_packet ( AVFormatContext format_context,
AVPacket packet 
)
static

Definition at line 117 of file apngenc.c.

Referenced by apng_write_packet(), and apng_write_trailer().

◆ apng_write_packet()

static int apng_write_packet ( AVFormatContext format_context,
AVPacket packet 
)
static

Definition at line 238 of file apngenc.c.

◆ apng_write_trailer()

static int apng_write_trailer ( AVFormatContext format_context)
static

Definition at line 258 of file apngenc.c.

◆ apng_deinit()

static void apng_deinit ( AVFormatContext s)
static

Definition at line 284 of file apngenc.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "plays", "Number of times to play the output: 0 - infinite loop, 1 - no loop", OFFSET(plays),
AV_OPT_TYPE_INT, { .i64 = 1 }, 0, UINT16_MAX, ENC },
{ "final_delay", "Force delay after the last frame", OFFSET(last_delay),
AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, UINT16_MAX, ENC },
{ NULL },
}

Definition at line 295 of file apngenc.c.

◆ apng_muxer_class

const AVClass apng_muxer_class
static
Initial value:
= {
.class_name = "APNG muxer",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 303 of file apngenc.c.

◆ ff_apng_muxer

const FFOutputFormat ff_apng_muxer
Initial value:
= {
.p.name = "apng",
.p.long_name = NULL_IF_CONFIG_SMALL("Animated Portable Network Graphics"),
.p.mime_type = "image/png",
.p.extensions = "apng",
.priv_data_size = sizeof(APNGMuxContext),
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_APNG,
.write_header = apng_write_header,
.write_packet = apng_write_packet,
.write_trailer = apng_write_trailer,
.deinit = apng_deinit,
.p.priv_class = &apng_muxer_class,
.p.flags = AVFMT_VARIABLE_FPS,
}

Definition at line 310 of file apngenc.c.

APNGMuxContext
Definition: apngenc.c:34
apng_muxer_class
static const AVClass apng_muxer_class
Definition: apngenc.c:303
apng_write_trailer
static int apng_write_trailer(AVFormatContext *format_context)
Definition: apngenc.c:258
AVFMT_VARIABLE_FPS
#define AVFMT_VARIABLE_FPS
Format allows variable fps.
Definition: avformat.h:483
AV_CODEC_ID_APNG
@ AV_CODEC_ID_APNG
Definition: codec_id.h:268
AV_OPT_TYPE_RATIONAL
@ AV_OPT_TYPE_RATIONAL
Definition: opt.h:230
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
ENC
#define ENC
Definition: apngenc.c:294
options
static const AVOption options[]
Definition: apngenc.c:295
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
OFFSET
#define OFFSET(x)
Definition: apngenc.c:293
apng_write_packet
static int apng_write_packet(AVFormatContext *format_context, AVPacket *packet)
Definition: apngenc.c:238
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
apng_write_header
static int apng_write_header(AVFormatContext *format_context)
Definition: apngenc.c:82
apng_deinit
static void apng_deinit(AVFormatContext *s)
Definition: apngenc.c:284