annotate DEPENDENCIES/mingw32/include/FLAC/callback.h @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 5fdf0c0f9433
children
rev   line source
Chris@17 1 /* libFLAC - Free Lossless Audio Codec library
Chris@17 2 * Copyright (C) 2004,2005,2006,2007 Josh Coalson
Chris@17 3 *
Chris@17 4 * Redistribution and use in source and binary forms, with or without
Chris@17 5 * modification, are permitted provided that the following conditions
Chris@17 6 * are met:
Chris@17 7 *
Chris@17 8 * - Redistributions of source code must retain the above copyright
Chris@17 9 * notice, this list of conditions and the following disclaimer.
Chris@17 10 *
Chris@17 11 * - Redistributions in binary form must reproduce the above copyright
Chris@17 12 * notice, this list of conditions and the following disclaimer in the
Chris@17 13 * documentation and/or other materials provided with the distribution.
Chris@17 14 *
Chris@17 15 * - Neither the name of the Xiph.org Foundation nor the names of its
Chris@17 16 * contributors may be used to endorse or promote products derived from
Chris@17 17 * this software without specific prior written permission.
Chris@17 18 *
Chris@17 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Chris@17 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Chris@17 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Chris@17 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
Chris@17 23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
Chris@17 24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
Chris@17 25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Chris@17 26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
Chris@17 27 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Chris@17 28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Chris@17 29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Chris@17 30 */
Chris@17 31
Chris@17 32 #ifndef FLAC__CALLBACK_H
Chris@17 33 #define FLAC__CALLBACK_H
Chris@17 34
Chris@17 35 #include "ordinals.h"
Chris@17 36 #include <stdlib.h> /* for size_t */
Chris@17 37
Chris@17 38 /** \file include/FLAC/callback.h
Chris@17 39 *
Chris@17 40 * \brief
Chris@17 41 * This module defines the structures for describing I/O callbacks
Chris@17 42 * to the other FLAC interfaces.
Chris@17 43 *
Chris@17 44 * See the detailed documentation for callbacks in the
Chris@17 45 * \link flac_callbacks callbacks \endlink module.
Chris@17 46 */
Chris@17 47
Chris@17 48 /** \defgroup flac_callbacks FLAC/callback.h: I/O callback structures
Chris@17 49 * \ingroup flac
Chris@17 50 *
Chris@17 51 * \brief
Chris@17 52 * This module defines the structures for describing I/O callbacks
Chris@17 53 * to the other FLAC interfaces.
Chris@17 54 *
Chris@17 55 * The purpose of the I/O callback functions is to create a common way
Chris@17 56 * for the metadata interfaces to handle I/O.
Chris@17 57 *
Chris@17 58 * Originally the metadata interfaces required filenames as the way of
Chris@17 59 * specifying FLAC files to operate on. This is problematic in some
Chris@17 60 * environments so there is an additional option to specify a set of
Chris@17 61 * callbacks for doing I/O on the FLAC file, instead of the filename.
Chris@17 62 *
Chris@17 63 * In addition to the callbacks, a FLAC__IOHandle type is defined as an
Chris@17 64 * opaque structure for a data source.
Chris@17 65 *
Chris@17 66 * The callback function prototypes are similar (but not identical) to the
Chris@17 67 * stdio functions fread, fwrite, fseek, ftell, feof, and fclose. If you use
Chris@17 68 * stdio streams to implement the callbacks, you can pass fread, fwrite, and
Chris@17 69 * fclose anywhere a FLAC__IOCallback_Read, FLAC__IOCallback_Write, or
Chris@17 70 * FLAC__IOCallback_Close is required, and a FILE* anywhere a FLAC__IOHandle
Chris@17 71 * is required. \warning You generally CANNOT directly use fseek or ftell
Chris@17 72 * for FLAC__IOCallback_Seek or FLAC__IOCallback_Tell since on most systems
Chris@17 73 * these use 32-bit offsets and FLAC requires 64-bit offsets to deal with
Chris@17 74 * large files. You will have to find an equivalent function (e.g. ftello),
Chris@17 75 * or write a wrapper. The same is true for feof() since this is usually
Chris@17 76 * implemented as a macro, not as a function whose address can be taken.
Chris@17 77 *
Chris@17 78 * \{
Chris@17 79 */
Chris@17 80
Chris@17 81 #ifdef __cplusplus
Chris@17 82 extern "C" {
Chris@17 83 #endif
Chris@17 84
Chris@17 85 /** This is the opaque handle type used by the callbacks. Typically
Chris@17 86 * this is a \c FILE* or address of a file descriptor.
Chris@17 87 */
Chris@17 88 typedef void* FLAC__IOHandle;
Chris@17 89
Chris@17 90 /** Signature for the read callback.
Chris@17 91 * The signature and semantics match POSIX fread() implementations
Chris@17 92 * and can generally be used interchangeably.
Chris@17 93 *
Chris@17 94 * \param ptr The address of the read buffer.
Chris@17 95 * \param size The size of the records to be read.
Chris@17 96 * \param nmemb The number of records to be read.
Chris@17 97 * \param handle The handle to the data source.
Chris@17 98 * \retval size_t
Chris@17 99 * The number of records read.
Chris@17 100 */
Chris@17 101 typedef size_t (*FLAC__IOCallback_Read) (void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
Chris@17 102
Chris@17 103 /** Signature for the write callback.
Chris@17 104 * The signature and semantics match POSIX fwrite() implementations
Chris@17 105 * and can generally be used interchangeably.
Chris@17 106 *
Chris@17 107 * \param ptr The address of the write buffer.
Chris@17 108 * \param size The size of the records to be written.
Chris@17 109 * \param nmemb The number of records to be written.
Chris@17 110 * \param handle The handle to the data source.
Chris@17 111 * \retval size_t
Chris@17 112 * The number of records written.
Chris@17 113 */
Chris@17 114 typedef size_t (*FLAC__IOCallback_Write) (const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
Chris@17 115
Chris@17 116 /** Signature for the seek callback.
Chris@17 117 * The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT
Chris@17 118 * EXCEPTION: the offset is a 64-bit type whereas fseek() is generally 'long'
Chris@17 119 * and 32-bits wide.
Chris@17 120 *
Chris@17 121 * \param handle The handle to the data source.
Chris@17 122 * \param offset The new position, relative to \a whence
Chris@17 123 * \param whence \c SEEK_SET, \c SEEK_CUR, or \c SEEK_END
Chris@17 124 * \retval int
Chris@17 125 * \c 0 on success, \c -1 on error.
Chris@17 126 */
Chris@17 127 typedef int (*FLAC__IOCallback_Seek) (FLAC__IOHandle handle, FLAC__int64 offset, int whence);
Chris@17 128
Chris@17 129 /** Signature for the tell callback.
Chris@17 130 * The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT
Chris@17 131 * EXCEPTION: the offset is a 64-bit type whereas ftell() is generally 'long'
Chris@17 132 * and 32-bits wide.
Chris@17 133 *
Chris@17 134 * \param handle The handle to the data source.
Chris@17 135 * \retval FLAC__int64
Chris@17 136 * The current position on success, \c -1 on error.
Chris@17 137 */
Chris@17 138 typedef FLAC__int64 (*FLAC__IOCallback_Tell) (FLAC__IOHandle handle);
Chris@17 139
Chris@17 140 /** Signature for the EOF callback.
Chris@17 141 * The signature and semantics mostly match POSIX feof() but WATCHOUT:
Chris@17 142 * on many systems, feof() is a macro, so in this case a wrapper function
Chris@17 143 * must be provided instead.
Chris@17 144 *
Chris@17 145 * \param handle The handle to the data source.
Chris@17 146 * \retval int
Chris@17 147 * \c 0 if not at end of file, nonzero if at end of file.
Chris@17 148 */
Chris@17 149 typedef int (*FLAC__IOCallback_Eof) (FLAC__IOHandle handle);
Chris@17 150
Chris@17 151 /** Signature for the close callback.
Chris@17 152 * The signature and semantics match POSIX fclose() implementations
Chris@17 153 * and can generally be used interchangeably.
Chris@17 154 *
Chris@17 155 * \param handle The handle to the data source.
Chris@17 156 * \retval int
Chris@17 157 * \c 0 on success, \c EOF on error.
Chris@17 158 */
Chris@17 159 typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle);
Chris@17 160
Chris@17 161 /** A structure for holding a set of callbacks.
Chris@17 162 * Each FLAC interface that requires a FLAC__IOCallbacks structure will
Chris@17 163 * describe which of the callbacks are required. The ones that are not
Chris@17 164 * required may be set to NULL.
Chris@17 165 *
Chris@17 166 * If the seek requirement for an interface is optional, you can signify that
Chris@17 167 * a data sorce is not seekable by setting the \a seek field to \c NULL.
Chris@17 168 */
Chris@17 169 typedef struct {
Chris@17 170 FLAC__IOCallback_Read read;
Chris@17 171 FLAC__IOCallback_Write write;
Chris@17 172 FLAC__IOCallback_Seek seek;
Chris@17 173 FLAC__IOCallback_Tell tell;
Chris@17 174 FLAC__IOCallback_Eof eof;
Chris@17 175 FLAC__IOCallback_Close close;
Chris@17 176 } FLAC__IOCallbacks;
Chris@17 177
Chris@17 178 /* \} */
Chris@17 179
Chris@17 180 #ifdef __cplusplus
Chris@17 181 }
Chris@17 182 #endif
Chris@17 183
Chris@17 184 #endif