mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
demux: add {Next,Prev}Chunk
replaces WebPDemuxSetChunk(). makes this consistent with the Frame interface. Change-Id: Ia2b1b98cc290f35b41fd14ee35a2a17cecac7ba8
This commit is contained in:
parent
31b68fe639
commit
4708393c3b
@ -853,10 +853,20 @@ int WebPDemuxGetChunk(const WebPDemuxer* const dmux,
|
||||
return SetChunk(fourcc, chunk_num, iter);
|
||||
}
|
||||
|
||||
int WebPDemuxSetChunk(WebPChunkIterator* const iter, int chunk) {
|
||||
int WebPDemuxNextChunk(WebPChunkIterator* const iter) {
|
||||
if (iter != NULL) {
|
||||
const uint8_t* const header = iter->chunk_.bytes_ - CHUNK_HEADER_SIZE;
|
||||
return SetChunk((const char*)header, chunk, iter);
|
||||
const char* const fourcc =
|
||||
(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;
|
||||
}
|
||||
|
@ -585,10 +585,11 @@ WEBP_EXTERN(int) WebPDemuxGetChunk(const WebPDemuxer* const dmux,
|
||||
const char fourcc[4], int chunk_number,
|
||||
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.
|
||||
WEBP_EXTERN(int) WebPDemuxSetChunk(WebPChunkIterator* const iter,
|
||||
int chunk_number);
|
||||
WEBP_EXTERN(int) WebPDemuxNextChunk(WebPChunkIterator* const iter);
|
||||
WEBP_EXTERN(int) WebPDemuxPrevChunk(WebPChunkIterator* const iter);
|
||||
|
||||
// Releases any memory associated with 'iter'.
|
||||
// Must be called before destroying the associated WebPDemuxer with
|
||||
|
Loading…
Reference in New Issue
Block a user