mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
libwebp: add WebPDemux stub functions
beginning of a separate interface to demux webp files. Change-Id: If8bf9c43defe5f6c8678afd03541f7cd8261c99a
This commit is contained in:
parent
fb47bb5cf4
commit
f8f94081be
33
src/mux/demux.c
Normal file
33
src/mux/demux.c
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright 2012 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// This code is licensed under the same terms as WebM:
|
||||
// Software License Agreement: http://www.webmproject.org/license/software/
|
||||
// Additional IP Rights Grant: http://www.webmproject.org/license/additional/
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// WebP container demux.
|
||||
//
|
||||
|
||||
#include "../webp/mux.h"
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WebPDemuxer* WebPDemuxInternal(
|
||||
const WebPData* const data, int allow_partial,
|
||||
WebPDemuxState* const state, int version) {
|
||||
(void)data;
|
||||
(void)allow_partial;
|
||||
(void)state;
|
||||
(void)version;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void WebPDemuxDelete(WebPDemuxer* const dmux) {
|
||||
(void)dmux;
|
||||
}
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
} // extern "C"
|
||||
#endif
|
@ -463,6 +463,45 @@ WEBP_EXTERN(WebPMuxError) WebPMuxNumChunks(const WebPMux* const mux,
|
||||
WEBP_EXTERN(WebPMuxError) WebPMuxAssemble(WebPMux* const mux,
|
||||
WebPData* const assembled_data);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Demux API.
|
||||
// Enables extraction of image and extended format data from WebP files.
|
||||
|
||||
#define WEBP_DEMUX_ABI_VERSION 0x0000
|
||||
|
||||
typedef struct WebPDemuxer WebPDemuxer;
|
||||
|
||||
typedef enum {
|
||||
WEBP_DEMUX_PARSING_HEADER, // Not enough data to parse full header.
|
||||
WEBP_DEMUX_PARSED_HEADER, // Header parsing complete, data may be available.
|
||||
WEBP_DEMUX_DONE // Entire file has been parsed.
|
||||
} WebPDemuxState;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Life of a Demux object
|
||||
|
||||
// Internal, version-checked, entry point
|
||||
WEBP_EXTERN(WebPDemuxer*) WebPDemuxInternal(
|
||||
const WebPData* const, int, WebPDemuxState* const, int);
|
||||
|
||||
// Parses the WebP file given by 'data'.
|
||||
// A complete WebP file must be present in 'data' for the function to succeed.
|
||||
// Returns a WebPDemuxer object on successful parse, NULL otherwise.
|
||||
static WEBP_INLINE WebPDemuxer* WebPDemux(const WebPData* const data) {
|
||||
return WebPDemuxInternal(data, 0, NULL, WEBP_DEMUX_ABI_VERSION);
|
||||
}
|
||||
|
||||
// Parses the WebP file given by 'data'.
|
||||
// If 'state' is non-NULL it will be set to indicate the status of the demuxer.
|
||||
// Returns a WebPDemuxer object on successful parse, NULL otherwise.
|
||||
static WEBP_INLINE WebPDemuxer* WebPDemuxPartial(
|
||||
const WebPData* const data, WebPDemuxState* const state) {
|
||||
return WebPDemuxInternal(data, 1, state, WEBP_DEMUX_ABI_VERSION);
|
||||
}
|
||||
|
||||
// Frees memory associated with 'dmux'.
|
||||
WEBP_EXTERN(void) WebPDemuxDelete(WebPDemuxer* const dmux);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
|
Loading…
Reference in New Issue
Block a user