demux: add {Next,Prev}Frame

Replaces WebPDemuxSetFrame().

Change-Id: I38cef0ebeabb5c2f164322502abe1780f7a65e06
This commit is contained in:
James Zern 2012-06-14 16:59:58 -07:00
parent f180df2afd
commit 02dd37a2a3
2 changed files with 12 additions and 4 deletions

View File

@ -768,9 +768,15 @@ int WebPDemuxGetFrame(const WebPDemuxer* const dmux,
return SetFrame(frame, iter); return SetFrame(frame, iter);
} }
int WebPDemuxSetFrame(WebPIterator* const iter, int frame) { int WebPDemuxNextFrame(WebPIterator* const iter) {
if (iter == NULL) return 0; if (iter == NULL) return 0;
return SetFrame(frame, iter); return SetFrame(iter->frame_num_ + 1, iter);
}
int WebPDemuxPrevFrame(WebPIterator* const iter) {
if (iter == NULL) return 0;
if (iter->frame_num_ <= 1) return 0;
return SetFrame(iter->frame_num_ - 1, iter);
} }
int WebPDemuxSetTile(WebPIterator* const iter, int tile) { int WebPDemuxSetTile(WebPIterator* const iter, int tile) {

View File

@ -546,9 +546,11 @@ typedef struct {
WEBP_EXTERN(int) WebPDemuxGetFrame( WEBP_EXTERN(int) WebPDemuxGetFrame(
const WebPDemuxer* const dmux, int frame_number, WebPIterator* const iter); const WebPDemuxer* const dmux, int frame_number, WebPIterator* const iter);
// Sets 'iter->tile_' to point to frame number 'frame_number'. // 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. // Returns true on success, false otherwise.
WEBP_EXTERN(int) WebPDemuxSetFrame(WebPIterator* const iter, int frame_number); WEBP_EXTERN(int) WebPDemuxNextFrame(WebPIterator* const iter);
WEBP_EXTERN(int) WebPDemuxPrevFrame(WebPIterator* const iter);
// Sets 'iter->tile_' to reflect tile number 'tile_number'. // Sets 'iter->tile_' to reflect tile number 'tile_number'.
// Returns true if tile 'tile_number' is present, false otherwise. // Returns true if tile 'tile_number' is present, false otherwise.