49 "GIF muxer supports only a single video GIF stream.\n");
66 x = bytestream2_get_byte(&gb);
70 x = bytestream2_get_byte(&gb);
72 int block_size = bytestream2_get_byte(&gb);
88 gif->
duration = av_clip_uint16(new->pts - prev->
pts);
119 if (pkt->
data[10] & 0x80)
120 off += 3 * (1 << ((pkt->
data[10] & 0x07) + 1));
122 if (pkt->
size < off + 2)
130 if (pkt->
size <= off)
134 if (gif->
loop >= 0) {
138 avio_write(pb,
"NETSCAPE2.0",
sizeof(
"NETSCAPE2.0") - 1);
146 if (delay_pos > 0 && delay_pos < pkt->
size - off - 2) {
156 if (delay_pos > 0 && delay_pos < pkt->
size - 2) {
189 #define OFFSET(x) offsetof(GIFContext, x) 190 #define ENC AV_OPT_FLAG_ENCODING_PARAM 192 {
"loop",
"Number of times to loop the output: -1 - no loop, 0 - infinite loop",
OFFSET(
loop),
194 {
"final_delay",
"Force delay (in centiseconds) after the last frame",
OFFSET(
last_delay),
209 .mime_type =
"image/gif",
217 .priv_class = &gif_muxer_class,
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
void avio_wl16(AVIOContext *s, unsigned int val)
#define LIBAVUTIL_VERSION_INT
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
const char * av_default_item_name(void *ptr)
Return the context name.
#define GIF_GCE_EXT_LABEL
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
AVStream ** streams
A list of all streams in the file.
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)
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVMediaType codec_type
General type of the encoded data.
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
simple assert() macros that are a bit more flexible than ISO C assert().
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static int write_trailer(AVFormatContext *s1)
#define GIF_APP_EXT_LABEL
#define GIF_EXTENSION_INTRODUCER
static av_always_inline int bytestream2_tell(GetByteContext *g)
AVIOContext * pb
I/O context.
void avio_w8(AVIOContext *s, int b)
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Describe the class of an AVClass context structure.
void * priv_data
Format private data.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
static void write_header(FFV1Context *f)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.