mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 12:28:26 +01:00
(de)mux.h: wrap pseudo-code in /* */
easier to copy / read as a block Change-Id: Ia22689a13afd8ea2325dcdf432e35fc802d8177a
This commit is contained in:
parent
733a7faae4
commit
5416aab479
@ -12,37 +12,38 @@
|
|||||||
|
|
||||||
// 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);
|
||||||
//
|
|
||||||
// uint32_t width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH);
|
uint32_t width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH);
|
||||||
// uint32_t height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT);
|
uint32_t height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT);
|
||||||
// // ... (Get information about the features present in the WebP file).
|
// ... (Get information about the features present in the WebP file).
|
||||||
// uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS);
|
uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS);
|
||||||
//
|
|
||||||
// // ... (Iterate over all frames).
|
// ... (Iterate over all frames).
|
||||||
// WebPIterator iter;
|
WebPIterator iter;
|
||||||
// if (WebPDemuxGetFrame(demux, 1, &iter)) {
|
if (WebPDemuxGetFrame(demux, 1, &iter)) {
|
||||||
// do {
|
do {
|
||||||
// // ... (Consume 'iter'; e.g. Decode 'iter.fragment' with WebPDecode(),
|
// ... (Consume 'iter'; e.g. Decode 'iter.fragment' with WebPDecode(),
|
||||||
// // ... and get other frame properties like width, height, offsets etc.
|
// ... and get other frame properties like width, height, offsets etc.
|
||||||
// // ... see 'struct WebPIterator' below for more info).
|
// ... see 'struct WebPIterator' below for more info).
|
||||||
// } while (WebPDemuxNextFrame(&iter));
|
} while (WebPDemuxNextFrame(&iter));
|
||||||
// WebPDemuxReleaseIterator(&iter);
|
WebPDemuxReleaseIterator(&iter);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // ... (Extract metadata).
|
// ... (Extract metadata).
|
||||||
// WebPChunkIterator chunk_iter;
|
WebPChunkIterator chunk_iter;
|
||||||
// if (flags & ICCP_FLAG) WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter);
|
if (flags & ICCP_FLAG) WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter);
|
||||||
// // ... (Consume the ICC profile in 'chunk_iter.chunk').
|
// ... (Consume the ICC profile in 'chunk_iter.chunk').
|
||||||
// WebPDemuxReleaseChunkIterator(&chunk_iter);
|
WebPDemuxReleaseChunkIterator(&chunk_iter);
|
||||||
// if (flags & EXIF_FLAG) WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter);
|
if (flags & EXIF_FLAG) WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter);
|
||||||
// // ... (Consume the EXIF metadata in 'chunk_iter.chunk').
|
// ... (Consume the EXIF metadata in 'chunk_iter.chunk').
|
||||||
// WebPDemuxReleaseChunkIterator(&chunk_iter);
|
WebPDemuxReleaseChunkIterator(&chunk_iter);
|
||||||
// if (flags & XMP_FLAG) WebPDemuxGetChunk(demux, "XMP ", 1, &chunk_iter);
|
if (flags & XMP_FLAG) WebPDemuxGetChunk(demux, "XMP ", 1, &chunk_iter);
|
||||||
// // ... (Consume the XMP metadata in 'chunk_iter.chunk').
|
// ... (Consume the XMP metadata in 'chunk_iter.chunk').
|
||||||
// WebPDemuxReleaseChunkIterator(&chunk_iter);
|
WebPDemuxReleaseChunkIterator(&chunk_iter);
|
||||||
// WebPDemuxDelete(demux);
|
WebPDemuxDelete(demux);
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef WEBP_WEBP_DEMUX_H_
|
#ifndef WEBP_WEBP_DEMUX_H_
|
||||||
#define WEBP_WEBP_DEMUX_H_
|
#define WEBP_WEBP_DEMUX_H_
|
||||||
|
@ -17,32 +17,34 @@
|
|||||||
//
|
//
|
||||||
// Code Example#1: Creating a MUX with image data, color profile and XMP
|
// Code Example#1: Creating a MUX with image data, color profile and XMP
|
||||||
// metadata.
|
// metadata.
|
||||||
//
|
/*
|
||||||
// int copy_data = 0;
|
int copy_data = 0;
|
||||||
// WebPMux* mux = WebPMuxNew();
|
WebPMux* mux = WebPMuxNew();
|
||||||
// // ... (Prepare image data).
|
// ... (Prepare image data).
|
||||||
// WebPMuxSetImage(mux, &image, copy_data);
|
WebPMuxSetImage(mux, &image, copy_data);
|
||||||
// // ... (Prepare ICCP color profile data).
|
// ... (Prepare ICCP color profile data).
|
||||||
// WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data);
|
WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data);
|
||||||
// // ... (Prepare XMP metadata).
|
// ... (Prepare XMP metadata).
|
||||||
// WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data);
|
WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data);
|
||||||
// // Get data from mux in WebP RIFF format.
|
// Get data from mux in WebP RIFF format.
|
||||||
// WebPMuxAssemble(mux, &output_data);
|
WebPMuxAssemble(mux, &output_data);
|
||||||
// WebPMuxDelete(mux);
|
WebPMuxDelete(mux);
|
||||||
// // ... (Consume output_data; e.g. write output_data.bytes to file).
|
// ... (Consume output_data; e.g. write output_data.bytes to file).
|
||||||
// WebPDataClear(&output_data);
|
WebPDataClear(&output_data);
|
||||||
//
|
*/
|
||||||
|
|
||||||
// Code Example#2: Get image and color profile data from a WebP file.
|
// Code Example#2: Get image and color profile data from a WebP file.
|
||||||
//
|
/*
|
||||||
// int copy_data = 0;
|
int copy_data = 0;
|
||||||
// // ... (Read data from file).
|
// ... (Read data from file).
|
||||||
// WebPMux* mux = WebPMuxCreate(&data, copy_data);
|
WebPMux* mux = WebPMuxCreate(&data, copy_data);
|
||||||
// WebPMuxGetFrame(mux, 1, &image);
|
WebPMuxGetFrame(mux, 1, &image);
|
||||||
// // ... (Consume image; e.g. call WebPDecode() to decode the data).
|
// ... (Consume image; e.g. call WebPDecode() to decode the data).
|
||||||
// WebPMuxGetChunk(mux, "ICCP", &icc_profile);
|
WebPMuxGetChunk(mux, "ICCP", &icc_profile);
|
||||||
// // ... (Consume icc_data).
|
// ... (Consume icc_data).
|
||||||
// WebPMuxDelete(mux);
|
WebPMuxDelete(mux);
|
||||||
// free(data);
|
free(data);
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef WEBP_WEBP_MUX_H_
|
#ifndef WEBP_WEBP_MUX_H_
|
||||||
#define WEBP_WEBP_MUX_H_
|
#define WEBP_WEBP_MUX_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user