Merge "AnimEncoder API: Add info in README.mux"

This commit is contained in:
Pascal Massimino 2015-01-13 14:14:38 -08:00 committed by Gerrit Code Review
commit 07c39559ea
2 changed files with 29 additions and 1 deletions

View File

@ -133,7 +133,7 @@ WebP files. This API currently supports reading of XMP/EXIF metadata, ICC
profile and animated images. Other features may be added in subsequent profile and animated images. Other features may be added in subsequent
releases. releases.
Code Example: Demuxing WebP data to extract all the frames, ICC profile Code example: Demuxing WebP data to extract all the frames, ICC profile
and EXIF/XMP metadata. and EXIF/XMP metadata.
WebPDemuxer* demux = WebPDemux(&webp_data); WebPDemuxer* demux = WebPDemux(&webp_data);
@ -170,6 +170,30 @@ and EXIF/XMP metadata.
For a detailed Demux API reference, please refer to the header file For a detailed Demux API reference, please refer to the header file
(src/webp/demux.h). (src/webp/demux.h).
AnimEncoder API:
================
The AnimEncoder API can be used to create animated WebP images.
Code example:
WebPAnimEncoderOptions enc_options;
WebPAnimEncoderOptionsInit(&enc_options);
// ... (Tune 'enc_options' as needed).
WebPAnimEncoder* enc = WebPAnimEncoderNew(width, height, &enc_options);
while(<there are more frames>) {
WebPConfig config;
WebPConfigInit(&config);
// ... (Tune 'config' as needed).
WebPAnimEncoderAdd(enc, frame, duration, &config);
}
WebPAnimEncoderAssemble(enc, webp_data);
WebPAnimEncoderDelete(enc);
// ... (Write the 'webp_data' to a file, or re-mux it further).
For a detailed AnimEncoder API reference, please refer to the header file
(src/webp/mux.h).
Bugs: Bugs:
===== =====

View File

@ -401,8 +401,12 @@ WEBP_EXTERN(WebPMuxError) WebPMuxAssemble(WebPMux* mux,
/* /*
WebPAnimEncoderOptions enc_options; WebPAnimEncoderOptions enc_options;
WebPAnimEncoderOptionsInit(&enc_options); WebPAnimEncoderOptionsInit(&enc_options);
// Tune 'enc_options' as needed.
WebPAnimEncoder* enc = WebPAnimEncoderNew(width, height, &enc_options); WebPAnimEncoder* enc = WebPAnimEncoderNew(width, height, &enc_options);
while(<there are more frames>) { while(<there are more frames>) {
WebPConfig config;
WebPConfigInit(&config);
// Tune 'config' as needed.
WebPAnimEncoderAdd(enc, frame, duration, &config); WebPAnimEncoderAdd(enc, frame, duration, &config);
} }
WebPAnimEncoderAssemble(enc, webp_data); WebPAnimEncoderAssemble(enc, webp_data);