mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-13 07:22:52 +01:00
Merge "demux: add {Next,Prev}Chunk"
This commit is contained in:
commit
da47b5bda7
@ -853,10 +853,20 @@ int WebPDemuxGetChunk(const WebPDemuxer* const dmux,
|
|||||||
return SetChunk(fourcc, chunk_num, iter);
|
return SetChunk(fourcc, chunk_num, iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
int WebPDemuxSetChunk(WebPChunkIterator* const iter, int chunk) {
|
int WebPDemuxNextChunk(WebPChunkIterator* const iter) {
|
||||||
if (iter != NULL) {
|
if (iter != NULL) {
|
||||||
const uint8_t* const header = iter->chunk_.bytes_ - CHUNK_HEADER_SIZE;
|
const char* const fourcc =
|
||||||
return SetChunk((const char*)header, chunk, iter);
|
(const char*)iter->chunk_.bytes_ - CHUNK_HEADER_SIZE;
|
||||||
|
return SetChunk(fourcc, iter->chunk_num_ + 1, iter);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int WebPDemuxPrevChunk(WebPChunkIterator* const iter) {
|
||||||
|
if (iter != NULL && iter->chunk_num_ > 1) {
|
||||||
|
const char* const fourcc =
|
||||||
|
(const char*)iter->chunk_.bytes_ - CHUNK_HEADER_SIZE;
|
||||||
|
return SetChunk(fourcc, iter->chunk_num_ - 1, iter);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -585,10 +585,11 @@ WEBP_EXTERN(int) WebPDemuxGetChunk(const WebPDemuxer* const dmux,
|
|||||||
const char fourcc[4], int chunk_number,
|
const char fourcc[4], int chunk_number,
|
||||||
WebPChunkIterator* const iter);
|
WebPChunkIterator* const iter);
|
||||||
|
|
||||||
// Sets 'iter->chunk_' to point to chunk 'chunk_number'.
|
// 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.
|
// Returns true on success, false otherwise.
|
||||||
WEBP_EXTERN(int) WebPDemuxSetChunk(WebPChunkIterator* const iter,
|
WEBP_EXTERN(int) WebPDemuxNextChunk(WebPChunkIterator* const iter);
|
||||||
int chunk_number);
|
WEBP_EXTERN(int) WebPDemuxPrevChunk(WebPChunkIterator* const iter);
|
||||||
|
|
||||||
// Releases any memory associated with 'iter'.
|
// Releases any memory associated with 'iter'.
|
||||||
// Must be called before destroying the associated WebPDemuxer with
|
// Must be called before destroying the associated WebPDemuxer with
|
||||||
|
Loading…
x
Reference in New Issue
Block a user