Merge "demux: add {Next,Prev}Frame"

This commit is contained in:
pascal massimino 2012-06-18 13:41:42 -07:00 committed by Gerrit Code Review
commit 81ebd37505
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.