#ifdef HAVE_CONFIG_H
#include "src/webp/config.h"
#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "src/utils/utils.h"
#include "src/webp/decode.h"
#include "src/webp/demux.h"
#include "src/webp/format_constants.h"
#define DMUX_MAJ_VERSION …
#define DMUX_MIN_VERSION …
#define DMUX_REV_VERSION …
MemBuffer;
ChunkData;
Frame;
Chunk;
struct WebPDemuxer { … };
ParseStatus;
ChunkParser;
static ParseStatus ParseSingleImage(WebPDemuxer* const dmux);
static ParseStatus ParseVP8X(WebPDemuxer* const dmux);
static int IsValidSimpleFormat(const WebPDemuxer* const dmux);
static int IsValidExtendedFormat(const WebPDemuxer* const dmux);
static const ChunkParser kMasterChunks[] = …;
int WebPGetDemuxVersion(void) { … }
static int RemapMemBuffer(MemBuffer* const mem,
const uint8_t* data, size_t size) { … }
static int InitMemBuffer(MemBuffer* const mem,
const uint8_t* data, size_t size) { … }
static WEBP_INLINE size_t MemDataSize(const MemBuffer* const mem) { … }
static WEBP_INLINE int SizeIsInvalid(const MemBuffer* const mem, size_t size) { … }
static WEBP_INLINE void Skip(MemBuffer* const mem, size_t size) { … }
static WEBP_INLINE void Rewind(MemBuffer* const mem, size_t size) { … }
static WEBP_INLINE const uint8_t* GetBuffer(MemBuffer* const mem) { … }
static WEBP_INLINE uint8_t ReadByte(MemBuffer* const mem) { … }
static WEBP_INLINE int ReadLE16s(MemBuffer* const mem) { … }
static WEBP_INLINE int ReadLE24s(MemBuffer* const mem) { … }
static WEBP_INLINE uint32_t ReadLE32(MemBuffer* const mem) { … }
static void AddChunk(WebPDemuxer* const dmux, Chunk* const chunk) { … }
static int AddFrame(WebPDemuxer* const dmux, Frame* const frame) { … }
static void SetFrameInfo(size_t start_offset, size_t size,
int frame_num, int complete,
const WebPBitstreamFeatures* const features,
Frame* const frame) { … }
static ParseStatus StoreFrame(int frame_num, uint32_t min_size,
MemBuffer* const mem, Frame* const frame) { … }
static ParseStatus NewFrame(const MemBuffer* const mem,
uint32_t min_size, uint32_t actual_size,
Frame** frame) { … }
static ParseStatus ParseAnimationFrame(
WebPDemuxer* const dmux, uint32_t frame_chunk_size) { … }
static int StoreChunk(WebPDemuxer* const dmux,
size_t start_offset, uint32_t size) { … }
static ParseStatus ReadHeader(MemBuffer* const mem) { … }
static ParseStatus ParseSingleImage(WebPDemuxer* const dmux) { … }
static ParseStatus ParseVP8XChunks(WebPDemuxer* const dmux) { … }
static ParseStatus ParseVP8X(WebPDemuxer* const dmux) { … }
static int IsValidSimpleFormat(const WebPDemuxer* const dmux) { … }
static int CheckFrameBounds(const Frame* const frame, int exact,
int canvas_width, int canvas_height) { … }
static int IsValidExtendedFormat(const WebPDemuxer* const dmux) { … }
static void InitDemux(WebPDemuxer* const dmux, const MemBuffer* const mem) { … }
static ParseStatus CreateRawImageDemuxer(MemBuffer* const mem,
WebPDemuxer** demuxer) { … }
WebPDemuxer* WebPDemuxInternal(const WebPData* data, int allow_partial,
WebPDemuxState* state, int version) { … }
void WebPDemuxDelete(WebPDemuxer* dmux) { … }
uint32_t WebPDemuxGetI(const WebPDemuxer* dmux, WebPFormatFeature feature) { … }
static const Frame* GetFrame(const WebPDemuxer* const dmux, int frame_num) { … }
static const uint8_t* GetFramePayload(const uint8_t* const mem_buf,
const Frame* const frame,
size_t* const data_size) { … }
static int SynthesizeFrame(const WebPDemuxer* const dmux,
const Frame* const frame,
WebPIterator* const iter) { … }
static int SetFrame(int frame_num, WebPIterator* const iter) { … }
int WebPDemuxGetFrame(const WebPDemuxer* dmux, int frame, WebPIterator* iter) { … }
int WebPDemuxNextFrame(WebPIterator* iter) { … }
int WebPDemuxPrevFrame(WebPIterator* iter) { … }
void WebPDemuxReleaseIterator(WebPIterator* iter) { … }
static int ChunkCount(const WebPDemuxer* const dmux, const char fourcc[4]) { … }
static const Chunk* GetChunk(const WebPDemuxer* const dmux,
const char fourcc[4], int chunk_num) { … }
static int SetChunk(const char fourcc[4], int chunk_num,
WebPChunkIterator* const iter) { … }
int WebPDemuxGetChunk(const WebPDemuxer* dmux,
const char fourcc[4], int chunk_num,
WebPChunkIterator* iter) { … }
int WebPDemuxNextChunk(WebPChunkIterator* iter) { … }
int WebPDemuxPrevChunk(WebPChunkIterator* iter) { … }
void WebPDemuxReleaseChunkIterator(WebPChunkIterator* iter) { … }