33 #define DEFAULT_TRANSPARENCY_INDEX 0x1f
37 int transparent_color_index = -1;
38 unsigned i, smallest_alpha = 0xff;
44 const uint32_t v = palette[i];
45 if (v >> 24 < smallest_alpha) {
46 smallest_alpha = v >> 24;
47 transparent_color_index = i;
50 return smallest_alpha < 128 ? transparent_color_index : -1;
54 int loop_count, uint32_t *
palette)
60 if (sar.
num > 0 && sar.
den > 0) {
61 aspect = sar.
num * 64LL / sar.
den - 15;
62 if (aspect < 0 || aspect > 255)
77 for (i = 0; i < 256; i++) {
78 const uint32_t v = palette[i] & 0xffffff;
88 if (loop_count >= 0 ) {
93 avio_write(pb,
"NETSCAPE2.0",
sizeof(
"NETSCAPE2.0") - 1);
122 "GIF muxer supports only a single video GIF stream.\n");
169 avio_w8(pb, 1<<2 | (bcid >= 0));
226 #define OFFSET(x) offsetof(GIFContext, x)
227 #define ENC AV_OPT_FLAG_ENCODING_PARAM
229 {
"loop",
"Number of times to loop the output: -1 - no loop, 0 - infinite loop",
OFFSET(
loop),
231 {
"final_delay",
"Force delay (in centiseconds) after the last frame",
OFFSET(last_delay),
246 .mime_type =
"image/gif",
254 .priv_class = &gif_muxer_class,
void avio_wl16(AVIOContext *s, unsigned int val)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define LIBAVUTIL_VERSION_INT
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
This struct describes the properties of an encoded stream.
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.
8 bits with AV_PIX_FMT_RGB32 palette
int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt)
AVStream ** streams
A list of all streams in the file.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
#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. ...
enum AVMediaType codec_type
General type of the encoded data.
simple assert() macros that are a bit more flexible than ISO C assert().
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int void avio_flush(AVIOContext *s)
Force flushing of buffered data.
static int write_trailer(AVFormatContext *s1)
void avio_wb24(AVIOContext *s, unsigned int val)
AVIOContext * pb
I/O context.
void avio_w8(AVIOContext *s, int b)
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_copy_packet(AVPacket *dst, const AVPacket *src)
Copy packet, including contents.
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost)
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
AVCodecParameters * codecpar
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.