26 #include "libavutil/avassert.h"
27 #include "libavutil/imgutils.h"
28 #include "libavutil/log.h"
29 #include "libavutil/opt.h"
32 int loop_count, uint32_t *
palette)
45 for (i = 0; i < 256; i++) {
46 const uint32_t
v = palette[i] & 0xffffff;
56 if (loop_count >= 0 ) {
61 avio_write(pb,
"NETSCAPE2.0",
sizeof(
"NETSCAPE2.0") - 1);
91 "GIF muxer supports only a single video GIF stream.\n");
96 width = video_enc->
width;
97 height = video_enc->
height;
131 unsigned i, smallest_alpha = 0xff;
134 const uint32_t
v = palette[i];
135 if (v >> 24 < smallest_alpha) {
136 smallest_alpha = v >> 24;
137 transparent_color_index = i;
140 if (smallest_alpha < 128)
155 avio_w8(pb, transparent_color_index);
192 #define OFFSET(x) offsetof(GIFContext, x)
193 #define ENC AV_OPT_FLAG_ENCODING_PARAM
195 {
"loop",
"Number of times to loop the output: -1 - no loop, 0 - infinite loop",
OFFSET(
loop),
197 {
"final_delay",
"Force delay (in ms) after the last frame",
OFFSET(last_delay),
212 .mime_type =
"image/gif",
220 .priv_class = &gif_muxer_class,
void av_free_packet(AVPacket *pkt)
Free a packet.
#define LIBAVUTIL_VERSION_INT
AVCodecContext * codec
Codec context associated with this stream.
int av_copy_packet(AVPacket *dst, AVPacket *src)
Copy packet, including contents.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
const char * av_default_item_name(void *ctx)
Return the context name.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
const OptionDef options[]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * priv_data
Format private data.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt)
unsigned int nb_streams
A list of all streams in the file.
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
int width
picture width / height.
static int write_trailer(AVFormatContext *s1)
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
enum AVMediaType codec_type
main external API structure.
AVIOContext * pb
I/O context.
BYTE int const BYTE int int int height
Describe the class of an AVClass context structure.
#define AVERROR_INVALIDDATA
static void write_header(FFV1Context *f)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
8 bit with PIX_FMT_RGB32 palette
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
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.