mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-25 21:28:22 +01:00
mux.h: remove '* const' from function parameters
makes the public interface consistent and more readable Change-Id: I33f1d1c4ee752e353e4c10636a4df4e44d7cd03f
This commit is contained in:
parent
31426ebaec
commit
a3ec6225d5
@ -623,9 +623,8 @@ static void InitDemux(WebPDemuxer* const dmux, const MemBuffer* const mem) {
|
||||
dmux->mem_ = *mem;
|
||||
}
|
||||
|
||||
WebPDemuxer* WebPDemuxInternal(
|
||||
const WebPData* const data, int allow_partial,
|
||||
WebPDemuxState* const state, int version) {
|
||||
WebPDemuxer* WebPDemuxInternal(const WebPData* data, int allow_partial,
|
||||
WebPDemuxState* state, int version) {
|
||||
const ChunkParser* parser;
|
||||
int partial;
|
||||
ParseStatus status = PARSE_ERROR;
|
||||
@ -662,7 +661,7 @@ WebPDemuxer* WebPDemuxInternal(
|
||||
return dmux;
|
||||
}
|
||||
|
||||
void WebPDemuxDelete(WebPDemuxer* const dmux) {
|
||||
void WebPDemuxDelete(WebPDemuxer* dmux) {
|
||||
Chunk* c;
|
||||
Frame* f;
|
||||
if (dmux == NULL) return;
|
||||
@ -682,8 +681,7 @@ void WebPDemuxDelete(WebPDemuxer* const dmux) {
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
uint32_t WebPDemuxGetI(const WebPDemuxer* const dmux,
|
||||
WebPFormatFeature feature) {
|
||||
uint32_t WebPDemuxGetI(const WebPDemuxer* dmux, WebPFormatFeature feature) {
|
||||
if (dmux == NULL) return 0;
|
||||
|
||||
switch (feature) {
|
||||
@ -784,8 +782,7 @@ static int SetFrame(int frame_num, WebPIterator* const iter) {
|
||||
return SynthesizeFrame(dmux, frame, 1, iter);
|
||||
}
|
||||
|
||||
int WebPDemuxGetFrame(const WebPDemuxer* const dmux,
|
||||
int frame, WebPIterator* const iter) {
|
||||
int WebPDemuxGetFrame(const WebPDemuxer* dmux, int frame, WebPIterator* iter) {
|
||||
if (iter == NULL) return 0;
|
||||
|
||||
memset(iter, 0, sizeof(*iter));
|
||||
@ -793,18 +790,18 @@ int WebPDemuxGetFrame(const WebPDemuxer* const dmux,
|
||||
return SetFrame(frame, iter);
|
||||
}
|
||||
|
||||
int WebPDemuxNextFrame(WebPIterator* const iter) {
|
||||
int WebPDemuxNextFrame(WebPIterator* iter) {
|
||||
if (iter == NULL) return 0;
|
||||
return SetFrame(iter->frame_num_ + 1, iter);
|
||||
}
|
||||
|
||||
int WebPDemuxPrevFrame(WebPIterator* const iter) {
|
||||
int WebPDemuxPrevFrame(WebPIterator* iter) {
|
||||
if (iter == NULL) return 0;
|
||||
if (iter->frame_num_ <= 1) return 0;
|
||||
return SetFrame(iter->frame_num_ - 1, iter);
|
||||
}
|
||||
|
||||
int WebPDemuxSelectTile(WebPIterator* const iter, int tile) {
|
||||
int WebPDemuxSelectTile(WebPIterator* iter, int tile) {
|
||||
if (iter != NULL && iter->private_ != NULL && tile > 0) {
|
||||
const WebPDemuxer* const dmux = (WebPDemuxer*)iter->private_;
|
||||
const Frame* const frame = GetFrame(dmux, iter->frame_num_);
|
||||
@ -815,7 +812,7 @@ int WebPDemuxSelectTile(WebPIterator* const iter, int tile) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WebPDemuxReleaseIterator(WebPIterator* const iter) {
|
||||
void WebPDemuxReleaseIterator(WebPIterator* iter) {
|
||||
(void)iter;
|
||||
}
|
||||
|
||||
@ -868,9 +865,9 @@ static int SetChunk(const char fourcc[4], int chunk_num,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WebPDemuxGetChunk(const WebPDemuxer* const dmux,
|
||||
int WebPDemuxGetChunk(const WebPDemuxer* dmux,
|
||||
const char fourcc[4], int chunk_num,
|
||||
WebPChunkIterator* const iter) {
|
||||
WebPChunkIterator* iter) {
|
||||
if (iter == NULL) return 0;
|
||||
|
||||
memset(iter, 0, sizeof(*iter));
|
||||
@ -878,7 +875,7 @@ int WebPDemuxGetChunk(const WebPDemuxer* const dmux,
|
||||
return SetChunk(fourcc, chunk_num, iter);
|
||||
}
|
||||
|
||||
int WebPDemuxNextChunk(WebPChunkIterator* const iter) {
|
||||
int WebPDemuxNextChunk(WebPChunkIterator* iter) {
|
||||
if (iter != NULL) {
|
||||
const char* const fourcc =
|
||||
(const char*)iter->chunk_.bytes_ - CHUNK_HEADER_SIZE;
|
||||
@ -887,7 +884,7 @@ int WebPDemuxNextChunk(WebPChunkIterator* const iter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WebPDemuxPrevChunk(WebPChunkIterator* const iter) {
|
||||
int WebPDemuxPrevChunk(WebPChunkIterator* iter) {
|
||||
if (iter != NULL && iter->chunk_num_ > 1) {
|
||||
const char* const fourcc =
|
||||
(const char*)iter->chunk_.bytes_ - CHUNK_HEADER_SIZE;
|
||||
@ -896,7 +893,7 @@ int WebPDemuxPrevChunk(WebPChunkIterator* const iter) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WebPDemuxReleaseChunkIterator(WebPChunkIterator* const iter) {
|
||||
void WebPDemuxReleaseChunkIterator(WebPChunkIterator* iter) {
|
||||
(void)iter;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ static void MuxRelease(WebPMux* const mux) {
|
||||
DeleteAllChunks(&mux->unknown_);
|
||||
}
|
||||
|
||||
void WebPMuxDelete(WebPMux* const mux) {
|
||||
void WebPMuxDelete(WebPMux* mux) {
|
||||
// If mux is NULL MuxRelease is a noop.
|
||||
MuxRelease(mux);
|
||||
free(mux);
|
||||
@ -212,8 +212,8 @@ static WebPMuxError DeleteLoopCount(WebPMux* const mux) {
|
||||
//------------------------------------------------------------------------------
|
||||
// Set API(s).
|
||||
|
||||
WebPMuxError WebPMuxSetImage(WebPMux* const mux,
|
||||
const WebPData* const bitstream, int copy_data) {
|
||||
WebPMuxError WebPMuxSetImage(WebPMux* mux,
|
||||
const WebPData* bitstream, int copy_data) {
|
||||
WebPMuxError err;
|
||||
WebPChunk chunk;
|
||||
WebPMuxImage wpi;
|
||||
@ -267,8 +267,7 @@ WebPMuxError WebPMuxSetImage(WebPMux* const mux,
|
||||
return err;
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxSetMetadata(WebPMux* const mux,
|
||||
const WebPData* const metadata,
|
||||
WebPMuxError WebPMuxSetMetadata(WebPMux* mux, const WebPData* metadata,
|
||||
int copy_data) {
|
||||
WebPMuxError err;
|
||||
|
||||
@ -285,8 +284,7 @@ WebPMuxError WebPMuxSetMetadata(WebPMux* const mux,
|
||||
return MuxSet(mux, IDX_META, 1, metadata, copy_data);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxSetColorProfile(WebPMux* const mux,
|
||||
const WebPData* const color_profile,
|
||||
WebPMuxError WebPMuxSetColorProfile(WebPMux* mux, const WebPData* color_profile,
|
||||
int copy_data) {
|
||||
WebPMuxError err;
|
||||
|
||||
@ -303,7 +301,7 @@ WebPMuxError WebPMuxSetColorProfile(WebPMux* const mux,
|
||||
return MuxSet(mux, IDX_ICCP, 1, color_profile, copy_data);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxSetLoopCount(WebPMux* const mux, int loop_count) {
|
||||
WebPMuxError WebPMuxSetLoopCount(WebPMux* mux, int loop_count) {
|
||||
WebPMuxError err;
|
||||
uint8_t* data = NULL;
|
||||
|
||||
@ -406,16 +404,14 @@ static WebPMuxError MuxPushFrameTileInternal(
|
||||
return err;
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxPushFrame(WebPMux* const mux,
|
||||
const WebPData* const bitstream,
|
||||
WebPMuxError WebPMuxPushFrame(WebPMux* mux, const WebPData* bitstream,
|
||||
int x_offset, int y_offset,
|
||||
int duration, int copy_data) {
|
||||
return MuxPushFrameTileInternal(mux, bitstream, x_offset, y_offset,
|
||||
duration, copy_data, kChunks[IDX_FRAME].tag);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxPushTile(WebPMux* const mux,
|
||||
const WebPData* const bitstream,
|
||||
WebPMuxError WebPMuxPushTile(WebPMux* mux, const WebPData* bitstream,
|
||||
int x_offset, int y_offset,
|
||||
int copy_data) {
|
||||
return MuxPushFrameTileInternal(mux, bitstream, x_offset, y_offset,
|
||||
@ -426,7 +422,7 @@ WebPMuxError WebPMuxPushTile(WebPMux* const mux,
|
||||
//------------------------------------------------------------------------------
|
||||
// Delete API(s).
|
||||
|
||||
WebPMuxError WebPMuxDeleteImage(WebPMux* const mux) {
|
||||
WebPMuxError WebPMuxDeleteImage(WebPMux* mux) {
|
||||
WebPMuxError err;
|
||||
|
||||
if (mux == NULL) return WEBP_MUX_INVALID_ARGUMENT;
|
||||
@ -439,11 +435,11 @@ WebPMuxError WebPMuxDeleteImage(WebPMux* const mux) {
|
||||
return WEBP_MUX_OK;
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxDeleteMetadata(WebPMux* const mux) {
|
||||
WebPMuxError WebPMuxDeleteMetadata(WebPMux* mux) {
|
||||
return MuxDeleteAllNamedData(mux, IDX_META);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxDeleteColorProfile(WebPMux* const mux) {
|
||||
WebPMuxError WebPMuxDeleteColorProfile(WebPMux* mux) {
|
||||
return MuxDeleteAllNamedData(mux, IDX_ICCP);
|
||||
}
|
||||
|
||||
@ -456,11 +452,11 @@ static WebPMuxError DeleteFrameTileInternal(WebPMux* const mux, uint32_t nth,
|
||||
return MuxImageDeleteNth(&mux->images_, nth, id);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxDeleteFrame(WebPMux* const mux, uint32_t nth) {
|
||||
WebPMuxError WebPMuxDeleteFrame(WebPMux* mux, uint32_t nth) {
|
||||
return DeleteFrameTileInternal(mux, nth, IDX_FRAME);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxDeleteTile(WebPMux* const mux, uint32_t nth) {
|
||||
WebPMuxError WebPMuxDeleteTile(WebPMux* mux, uint32_t nth) {
|
||||
return DeleteFrameTileInternal(mux, nth, IDX_TILE);
|
||||
}
|
||||
|
||||
@ -664,8 +660,7 @@ static WebPMuxError CreateVP8XChunk(WebPMux* const mux) {
|
||||
return err;
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxAssemble(WebPMux* const mux,
|
||||
WebPData* const assembled_data) {
|
||||
WebPMuxError WebPMuxAssemble(WebPMux* mux, WebPData* assembled_data) {
|
||||
size_t size = 0;
|
||||
uint8_t* data = NULL;
|
||||
uint8_t* dst = NULL;
|
||||
|
@ -212,14 +212,14 @@ uint8_t* ChunkListEmit(const WebPChunk* chunk_list, uint8_t* dst) {
|
||||
//------------------------------------------------------------------------------
|
||||
// Manipulation of a WebPData object.
|
||||
|
||||
void WebPDataClear(WebPData* const webp_data) {
|
||||
void WebPDataClear(WebPData* webp_data) {
|
||||
if (webp_data != NULL) {
|
||||
free((void*)webp_data->bytes_);
|
||||
memset(webp_data, 0, sizeof(*webp_data));
|
||||
}
|
||||
}
|
||||
|
||||
int WebPDataCopy(const WebPData* const src, WebPData* const dst) {
|
||||
int WebPDataCopy(const WebPData* src, WebPData* dst) {
|
||||
if (src == NULL || dst == NULL) return 0;
|
||||
|
||||
memset(dst, 0, sizeof(*dst));
|
||||
|
@ -76,7 +76,7 @@ static WebPMuxError ChunkVerifyAndAssignData(WebPChunk* chunk,
|
||||
//------------------------------------------------------------------------------
|
||||
// Create a mux object from WebP-RIFF data.
|
||||
|
||||
WebPMux* WebPMuxCreateInternal(const WebPData* const bitstream, int copy_data,
|
||||
WebPMux* WebPMuxCreateInternal(const WebPData* bitstream, int copy_data,
|
||||
int version) {
|
||||
size_t riff_size;
|
||||
uint32_t tag;
|
||||
@ -188,7 +188,7 @@ WebPMux* WebPMuxCreateInternal(const WebPData* const bitstream, int copy_data,
|
||||
//------------------------------------------------------------------------------
|
||||
// Get API(s).
|
||||
|
||||
WebPMuxError WebPMuxGetFeatures(const WebPMux* const mux, uint32_t* flags) {
|
||||
WebPMuxError WebPMuxGetFeatures(const WebPMux* mux, uint32_t* flags) {
|
||||
WebPData data;
|
||||
WebPMuxError err;
|
||||
|
||||
@ -268,8 +268,7 @@ static WebPMuxError SynthesizeBitstream(WebPMuxImage* const wpi,
|
||||
return WEBP_MUX_OK;
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxGetImage(const WebPMux* const mux,
|
||||
WebPData* const bitstream) {
|
||||
WebPMuxError WebPMuxGetImage(const WebPMux* mux, WebPData* bitstream) {
|
||||
WebPMuxError err;
|
||||
WebPMuxImage* wpi = NULL;
|
||||
|
||||
@ -288,20 +287,18 @@ WebPMuxError WebPMuxGetImage(const WebPMux* const mux,
|
||||
return SynthesizeBitstream(wpi, bitstream);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxGetMetadata(const WebPMux* const mux,
|
||||
WebPData* const metadata) {
|
||||
WebPMuxError WebPMuxGetMetadata(const WebPMux* mux, WebPData* metadata) {
|
||||
if (mux == NULL || metadata == NULL) return WEBP_MUX_INVALID_ARGUMENT;
|
||||
return MuxGet(mux, IDX_META, 1, metadata);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxGetColorProfile(const WebPMux* const mux,
|
||||
WebPData* const color_profile) {
|
||||
WebPMuxError WebPMuxGetColorProfile(const WebPMux* mux,
|
||||
WebPData* color_profile) {
|
||||
if (mux == NULL || color_profile == NULL) return WEBP_MUX_INVALID_ARGUMENT;
|
||||
return MuxGet(mux, IDX_ICCP, 1, color_profile);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxGetLoopCount(const WebPMux* const mux,
|
||||
int* const loop_count) {
|
||||
WebPMuxError WebPMuxGetLoopCount(const WebPMux* mux, int* loop_count) {
|
||||
WebPData image;
|
||||
WebPMuxError err;
|
||||
|
||||
@ -348,16 +345,16 @@ static WebPMuxError MuxGetFrameTileInternal(
|
||||
return SynthesizeBitstream(wpi, bitstream);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxGetFrame(const WebPMux* const mux, uint32_t nth,
|
||||
WebPData* const bitstream, int* const x_offset,
|
||||
int* const y_offset, int* const duration) {
|
||||
WebPMuxError WebPMuxGetFrame(const WebPMux* mux, uint32_t nth,
|
||||
WebPData* bitstream,
|
||||
int* x_offset, int* y_offset, int* duration) {
|
||||
return MuxGetFrameTileInternal(mux, nth, bitstream, x_offset, y_offset,
|
||||
duration, kChunks[IDX_FRAME].tag);
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxGetTile(const WebPMux* const mux, uint32_t nth,
|
||||
WebPData* const bitstream,
|
||||
int* const x_offset, int* const y_offset) {
|
||||
WebPMuxError WebPMuxGetTile(const WebPMux* mux, uint32_t nth,
|
||||
WebPData* bitstream,
|
||||
int* x_offset, int* y_offset) {
|
||||
return MuxGetFrameTileInternal(mux, nth, bitstream, x_offset, y_offset, NULL,
|
||||
kChunks[IDX_TILE].tag);
|
||||
}
|
||||
@ -384,7 +381,7 @@ static int CountChunks(const WebPChunk* const chunk_list, uint32_t tag) {
|
||||
return count;
|
||||
}
|
||||
|
||||
WebPMuxError WebPMuxNumChunks(const WebPMux* const mux,
|
||||
WebPMuxError WebPMuxNumChunks(const WebPMux* mux,
|
||||
WebPChunkId id, int* num_elements) {
|
||||
if (mux == NULL || num_elements == NULL) {
|
||||
return WEBP_MUX_INVALID_ARGUMENT;
|
||||
|
104
src/webp/mux.h
104
src/webp/mux.h
@ -102,11 +102,11 @@ typedef struct {
|
||||
|
||||
// Clears the contents of the 'webp_data' object by calling free(). Does not
|
||||
// deallocate the object itself.
|
||||
WEBP_EXTERN(void) WebPDataClear(WebPData* const webp_data);
|
||||
WEBP_EXTERN(void) WebPDataClear(WebPData* webp_data);
|
||||
|
||||
// Allocates necessary storage for 'dst' and copies the contents of 'src'.
|
||||
// Returns true on success.
|
||||
WEBP_EXTERN(int) WebPDataCopy(const WebPData* const src, WebPData* const dst);
|
||||
WEBP_EXTERN(int) WebPDataCopy(const WebPData* src, WebPData* dst);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Life of a Mux object
|
||||
@ -124,13 +124,13 @@ static WEBP_INLINE WebPMux* WebPMuxNew(void) {
|
||||
// Deletes the mux object.
|
||||
// Parameters:
|
||||
// mux - (in/out) object to be deleted
|
||||
WEBP_EXTERN(void) WebPMuxDelete(WebPMux* const mux);
|
||||
WEBP_EXTERN(void) WebPMuxDelete(WebPMux* mux);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Mux creation.
|
||||
|
||||
// Internal, version-checked, entry point
|
||||
WEBP_EXTERN(WebPMux*) WebPMuxCreateInternal(const WebPData* const, int, int);
|
||||
WEBP_EXTERN(WebPMux*) WebPMuxCreateInternal(const WebPData*, int, int);
|
||||
|
||||
// Creates a mux object from raw data given in WebP RIFF format.
|
||||
// Parameters:
|
||||
@ -140,7 +140,7 @@ WEBP_EXTERN(WebPMux*) WebPMuxCreateInternal(const WebPData* const, int, int);
|
||||
// Returns:
|
||||
// A pointer to the mux object created from given data - on success.
|
||||
// NULL - In case of invalid data or memory error.
|
||||
static WEBP_INLINE WebPMux* WebPMuxCreate(const WebPData* const bitstream,
|
||||
static WEBP_INLINE WebPMux* WebPMuxCreate(const WebPData* bitstream,
|
||||
int copy_data) {
|
||||
return WebPMuxCreateInternal(bitstream, copy_data, WEBP_MUX_ABI_VERSION);
|
||||
}
|
||||
@ -160,8 +160,9 @@ static WEBP_INLINE WebPMux* WebPMuxCreate(const WebPData* const bitstream,
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL or bitstream is NULL.
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetImage(
|
||||
WebPMux* const mux, const WebPData* const bitstream, int copy_data);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetImage(WebPMux* mux,
|
||||
const WebPData* bitstream,
|
||||
int copy_data);
|
||||
|
||||
// Gets image data from the mux object.
|
||||
// The content of 'bitstream' is allocated using malloc(), and NOT
|
||||
@ -175,8 +176,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxSetImage(
|
||||
// OR mux contains animation/tiling.
|
||||
// WEBP_MUX_NOT_FOUND - if image is not present in mux object.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetImage(const WebPMux* const mux,
|
||||
WebPData* const bitstream);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetImage(const WebPMux* mux,
|
||||
WebPData* bitstream);
|
||||
|
||||
// Deletes the image in the mux object.
|
||||
// Parameters:
|
||||
@ -186,7 +187,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetImage(const WebPMux* const mux,
|
||||
// OR if mux contains animation/tiling.
|
||||
// WEBP_MUX_NOT_FOUND - if image is not present in mux object.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteImage(WebPMux* const mux);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteImage(WebPMux* mux);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// XMP Metadata.
|
||||
@ -202,8 +203,9 @@ WEBP_EXTERN(WebPMuxError) WebPMuxDeleteImage(WebPMux* const mux);
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux or metadata is NULL.
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetMetadata(
|
||||
WebPMux* const mux, const WebPData* const metadata, int copy_data);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetMetadata(WebPMux* mux,
|
||||
const WebPData* metadata,
|
||||
int copy_data);
|
||||
|
||||
// Gets a reference to the XMP metadata in the mux object.
|
||||
// The caller should NOT free the returned data.
|
||||
@ -214,8 +216,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxSetMetadata(
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either mux or metadata is NULL.
|
||||
// WEBP_MUX_NOT_FOUND - if metadata is not present in mux object.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetMetadata(
|
||||
const WebPMux* const mux, WebPData* const metadata);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetMetadata(const WebPMux* mux,
|
||||
WebPData* metadata);
|
||||
|
||||
// Deletes the XMP metadata in the mux object.
|
||||
// Parameters:
|
||||
@ -224,7 +226,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetMetadata(
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL
|
||||
// WEBP_MUX_NOT_FOUND - If mux does not contain metadata.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteMetadata(WebPMux* const mux);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteMetadata(WebPMux* mux);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// ICC Color Profile.
|
||||
@ -240,8 +242,9 @@ WEBP_EXTERN(WebPMuxError) WebPMuxDeleteMetadata(WebPMux* const mux);
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux or color_profile is NULL
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error
|
||||
// WEBP_MUX_OK - on success
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetColorProfile(
|
||||
WebPMux* const mux, const WebPData* const color_profile, int copy_data);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetColorProfile(WebPMux* mux,
|
||||
const WebPData* color_profile,
|
||||
int copy_data);
|
||||
|
||||
// Gets a reference to the color profile in the mux object.
|
||||
// The caller should NOT free the returned data.
|
||||
@ -252,8 +255,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxSetColorProfile(
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either mux or color_profile is NULL.
|
||||
// WEBP_MUX_NOT_FOUND - if color profile is not present in mux object.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetColorProfile(
|
||||
const WebPMux* const mux, WebPData* const color_profile);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetColorProfile(const WebPMux* mux,
|
||||
WebPData* color_profile);
|
||||
|
||||
// Deletes the color profile in the mux object.
|
||||
// Parameters:
|
||||
@ -262,7 +265,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetColorProfile(
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL
|
||||
// WEBP_MUX_NOT_FOUND - If mux does not contain color profile.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteColorProfile(WebPMux* const mux);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteColorProfile(WebPMux* mux);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Animation.
|
||||
@ -285,7 +288,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxDeleteColorProfile(WebPMux* const mux);
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxPushFrame(
|
||||
WebPMux* const mux, const WebPData* const bitstream,
|
||||
WebPMux* mux, const WebPData* bitstream,
|
||||
int x_offset, int y_offset, int duration, int copy_data);
|
||||
|
||||
// TODO(urvang): Create a struct as follows to reduce argument list size:
|
||||
@ -314,8 +317,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxPushFrame(
|
||||
// WEBP_MUX_BAD_DATA - if nth frame chunk in mux is invalid.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetFrame(
|
||||
const WebPMux* const mux, uint32_t nth, WebPData* const bitstream,
|
||||
int* const x_offset, int* const y_offset, int* const duration);
|
||||
const WebPMux* mux, uint32_t nth, WebPData* bitstream,
|
||||
int* x_offset, int* y_offset, int* duration);
|
||||
|
||||
// Deletes an animation frame from the mux object.
|
||||
// nth=0 has a special meaning - last position.
|
||||
@ -327,7 +330,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetFrame(
|
||||
// WEBP_MUX_NOT_FOUND - If there are less than nth frames in the mux object
|
||||
// before deletion.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteFrame(WebPMux* const mux, uint32_t nth);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteFrame(WebPMux* mux, uint32_t nth);
|
||||
|
||||
// Sets the animation loop count in the mux object. Any existing loop count
|
||||
// value(s) will be removed.
|
||||
@ -339,8 +342,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxDeleteFrame(WebPMux* const mux, uint32_t nth);
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if mux is NULL
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetLoopCount(WebPMux* const mux,
|
||||
int loop_count);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxSetLoopCount(WebPMux* mux, int loop_count);
|
||||
|
||||
// Gets the animation loop count from the mux object.
|
||||
// Parameters:
|
||||
@ -350,8 +352,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxSetLoopCount(WebPMux* const mux,
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either of mux or loop_count is NULL
|
||||
// WEBP_MUX_NOT_FOUND - if loop chunk is not present in mux object.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetLoopCount(const WebPMux* const mux,
|
||||
int* const loop_count);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetLoopCount(const WebPMux* mux,
|
||||
int* loop_count);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Tiling.
|
||||
@ -373,7 +375,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetLoopCount(const WebPMux* const mux,
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxPushTile(
|
||||
WebPMux* const mux, const WebPData* const bitstream,
|
||||
WebPMux* mux, const WebPData* bitstream,
|
||||
int x_offset, int y_offset, int copy_data);
|
||||
|
||||
// Gets the nth tile from the mux object.
|
||||
@ -394,8 +396,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxPushTile(
|
||||
// WEBP_MUX_BAD_DATA - if nth tile chunk in mux is invalid.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetTile(
|
||||
const WebPMux* const mux, uint32_t nth, WebPData* const bitstream,
|
||||
int* const x_offset, int* const y_offset);
|
||||
const WebPMux* mux, uint32_t nth, WebPData* bitstream,
|
||||
int* x_offset, int* y_offset);
|
||||
|
||||
// Deletes a tile from the mux object.
|
||||
// nth=0 has a special meaning - last position
|
||||
@ -407,7 +409,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetTile(
|
||||
// WEBP_MUX_NOT_FOUND - If there are less than nth tiles in the mux object
|
||||
// before deletion.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteTile(WebPMux* const mux, uint32_t nth);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxDeleteTile(WebPMux* mux, uint32_t nth);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Misc Utilities.
|
||||
@ -423,7 +425,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxDeleteTile(WebPMux* const mux, uint32_t nth);
|
||||
// WEBP_MUX_NOT_FOUND - if VP8X chunk is not present in mux object.
|
||||
// WEBP_MUX_BAD_DATA - if VP8X chunk in mux is invalid.
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetFeatures(const WebPMux* const mux,
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxGetFeatures(const WebPMux* mux,
|
||||
uint32_t* flags);
|
||||
|
||||
// Gets number of chunks having tag value tag in the mux object.
|
||||
@ -434,7 +436,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetFeatures(const WebPMux* const mux,
|
||||
// Returns:
|
||||
// WEBP_MUX_INVALID_ARGUMENT - if either mux, or num_elements is NULL
|
||||
// WEBP_MUX_OK - on success.
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxNumChunks(const WebPMux* const mux,
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxNumChunks(const WebPMux* mux,
|
||||
WebPChunkId id, int* num_elements);
|
||||
|
||||
// Assembles all chunks in WebP RIFF format and returns in 'assembled_data'.
|
||||
@ -452,8 +454,8 @@ WEBP_EXTERN(WebPMuxError) WebPMuxNumChunks(const WebPMux* const mux,
|
||||
// NULL.
|
||||
// WEBP_MUX_MEMORY_ERROR - on memory allocation error.
|
||||
// WEBP_MUX_OK - on success
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxAssemble(WebPMux* const mux,
|
||||
WebPData* const assembled_data);
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxAssemble(WebPMux* mux,
|
||||
WebPData* assembled_data);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Demux API.
|
||||
@ -474,12 +476,12 @@ typedef enum {
|
||||
|
||||
// Internal, version-checked, entry point
|
||||
WEBP_EXTERN(WebPDemuxer*) WebPDemuxInternal(
|
||||
const WebPData* const, int, WebPDemuxState* const, int);
|
||||
const WebPData*, int, WebPDemuxState*, int);
|
||||
|
||||
// Parses the WebP file given by 'data'.
|
||||
// A complete WebP file must be present in 'data' for the function to succeed.
|
||||
// Returns a WebPDemuxer object on successful parse, NULL otherwise.
|
||||
static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* const data) {
|
||||
static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* data) {
|
||||
return WebPDemuxInternal(data, 0, NULL, WEBP_DEMUX_ABI_VERSION);
|
||||
}
|
||||
|
||||
@ -487,12 +489,12 @@ static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* const data) {
|
||||
// If 'state' is non-NULL it will be set to indicate the status of the demuxer.
|
||||
// Returns a WebPDemuxer object on successful parse, NULL otherwise.
|
||||
static WEBP_INLINE WebPDemuxer* WebPDemuxPartial(
|
||||
const WebPData* const data, WebPDemuxState* const state) {
|
||||
const WebPData* data, WebPDemuxState* state) {
|
||||
return WebPDemuxInternal(data, 1, state, WEBP_DEMUX_ABI_VERSION);
|
||||
}
|
||||
|
||||
// Frees memory associated with 'dmux'.
|
||||
WEBP_EXTERN(void) WebPDemuxDelete(WebPDemuxer* const dmux);
|
||||
WEBP_EXTERN(void) WebPDemuxDelete(WebPDemuxer* dmux);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Data/information extraction.
|
||||
@ -508,7 +510,7 @@ typedef enum {
|
||||
// NOTE: values are only valid if WebPDemux() was used or WebPDemuxPartial()
|
||||
// returned a state > WEBP_DEMUX_PARSING_HEADER.
|
||||
WEBP_EXTERN(uint32_t) WebPDemuxGetI(
|
||||
const WebPDemuxer* const dmux, WebPFormatFeature feature);
|
||||
const WebPDemuxer* dmux, WebPFormatFeature feature);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Frame iteration.
|
||||
@ -536,22 +538,22 @@ typedef struct {
|
||||
// Call WebPDemuxReleaseIterator() when use of the iterator is complete.
|
||||
// NOTE: 'dmux' must persist for the lifetime of 'iter'.
|
||||
WEBP_EXTERN(int) WebPDemuxGetFrame(
|
||||
const WebPDemuxer* const dmux, int frame_number, WebPIterator* const iter);
|
||||
const WebPDemuxer* dmux, int frame_number, WebPIterator* iter);
|
||||
|
||||
// Sets 'iter->tile_' to point to the next ('iter->frame_num_' + 1) or previous
|
||||
// ('iter->frame_num_' - 1) frame. These functions do not loop.
|
||||
// Returns true on success, false otherwise.
|
||||
WEBP_EXTERN(int) WebPDemuxNextFrame(WebPIterator* const iter);
|
||||
WEBP_EXTERN(int) WebPDemuxPrevFrame(WebPIterator* const iter);
|
||||
WEBP_EXTERN(int) WebPDemuxNextFrame(WebPIterator* iter);
|
||||
WEBP_EXTERN(int) WebPDemuxPrevFrame(WebPIterator* iter);
|
||||
|
||||
// Sets 'iter->tile_' to reflect tile number 'tile_number'.
|
||||
// Returns true if tile 'tile_number' is present, false otherwise.
|
||||
WEBP_EXTERN(int) WebPDemuxSelectTile(WebPIterator* const iter, int tile_number);
|
||||
WEBP_EXTERN(int) WebPDemuxSelectTile(WebPIterator* iter, int tile_number);
|
||||
|
||||
// Releases any memory associated with 'iter'.
|
||||
// Must be called before destroying the associated WebPDemuxer with
|
||||
// WebPDemuxDelete().
|
||||
WEBP_EXTERN(void) WebPDemuxReleaseIterator(WebPIterator* const iter);
|
||||
WEBP_EXTERN(void) WebPDemuxReleaseIterator(WebPIterator* iter);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Chunk iteration.
|
||||
@ -576,20 +578,20 @@ typedef struct {
|
||||
// payloads are accessed through WebPDemuxGetFrame() and related functions.
|
||||
// Call WebPDemuxReleaseChunkIterator() when use of the iterator is complete.
|
||||
// NOTE: 'dmux' must persist for the lifetime of the iterator.
|
||||
WEBP_EXTERN(int) WebPDemuxGetChunk(const WebPDemuxer* const dmux,
|
||||
WEBP_EXTERN(int) WebPDemuxGetChunk(const WebPDemuxer* dmux,
|
||||
const char fourcc[4], int chunk_number,
|
||||
WebPChunkIterator* const iter);
|
||||
WebPChunkIterator* iter);
|
||||
|
||||
// Sets 'iter->chunk_' to point to the next ('iter->chunk_num_' + 1) or previous
|
||||
// ('iter->chunk_num_' - 1) chunk. These functions do not loop.
|
||||
// Returns true on success, false otherwise.
|
||||
WEBP_EXTERN(int) WebPDemuxNextChunk(WebPChunkIterator* const iter);
|
||||
WEBP_EXTERN(int) WebPDemuxPrevChunk(WebPChunkIterator* const iter);
|
||||
WEBP_EXTERN(int) WebPDemuxNextChunk(WebPChunkIterator* iter);
|
||||
WEBP_EXTERN(int) WebPDemuxPrevChunk(WebPChunkIterator* iter);
|
||||
|
||||
// Releases any memory associated with 'iter'.
|
||||
// Must be called before destroying the associated WebPDemuxer with
|
||||
// WebPDemuxDelete().
|
||||
WEBP_EXTERN(void) WebPDemuxReleaseChunkIterator(WebPChunkIterator* const iter);
|
||||
WEBP_EXTERN(void) WebPDemuxReleaseChunkIterator(WebPChunkIterator* iter);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user