1
     Kˆåäî526ãÀì     K‹      Å•_oÚ0Åßû)<?ì�\TS['SG�†FÑLÛ4M•b-Ä‘})tŸ~†¤-C°bì)‰}rîù][6{�ºñ§q�¼�odüþÍ ß%´ð¡Ýˆâ¨šèxM 7¤„fˆå%Àr¹ô–mO›ÄÈpžwÀ¢Q)zÏØz,<#,“\¸'a¨0—a¿rEô”€^ UBv 4:ÌŒ6¬Ì§`´FXXªHó…��hm¸UJmÕŠAeæì¡ög‰ë²þ±J8§Mlžl*­_MÈ0#÷<W³" ¨K25ŸkÒ€‚Jua!ÉyñÕ›©)%<Ç€~îwG_œÎ•_ÿ2N\Ži@_wƒáÕ(ˆh8äsÉ€ï×Ü8Í5Ü"™k¡¦JŠƒâÛJ|«¾6Œ*M$mjT‰JÏRpˆÛ¨©ÎmÉë¹#ÈÌ¶ª’ˆ_uƒ§?4c|=éã¨?©Z"ÖÏéþrÁh8æFH"edŠÚ<ÔD•ýË"±åÕã'©ó5Ë�†„4È^å@¢\á6dü1Þ‹—¸´é�¨¯�—•Înßèvþ�À­f«Ýhž7üÒ¼¸lu9DÖj¿;-™; $Ÿ Ü;yNÿÕÉ8wÑŽOã{Íÿ@sçÖHî"=ƒ«å�n7Ø‡ÿlúžÿ¶ß<N¡¾hln2ÕúÕÕìæ£    8   Mˆl–ß=¿JÕ!®Å	@ãb¸&ÔÅ£�þZ+’,Ü„ei‘4Ó@þð„ ë¿ïëÁí ?÷     M/*
** SPDX-License-Identifier: BSD-3-Clause
** Copyright Contributors to the OpenEXR Project.
*/

#ifndef OPENEXR_CONTEXT_H
#define OPENEXR_CONTEXT_H

#include "openexr_errors.h"

#include "openexr_base.h"

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

/** @file */

/** 
 * @defgroup Context Context related definitions
 *
 * A context is a single instance of an OpenEXR file or stream. Beyond
 * a particular file or stream handle, it also has separate controls
 * for error handling and memory allocation. This is done to enable
 * encoding or decoding on mixed hardware.
 *
 * @{
 */

/** Opaque context handle
 *
 * The implementation of this is partly opaque to provide better
 * version portability, and all accesses to relevant data should
 * happen using provided functions. This handle serves as a container
 * and identifier for all the metadata and parts associated with a
 * file and/or stream.
 */

typedef struct _priv_exr_context_t*       exr_context_t;
typedef const struct _priv_exr_context_t* exr_const_context_t;

/** 
 * @defgroup ContextFunctions OpenEXR Context Stream/File Functions
 *
 * @brief These are a group of function interfaces used to customize
 * the error handling, memory allocations, or I/O behavior of an
 * OpenEXR context.
 *
 * @{
 */

/** @brief Stream error notifier
 *
 *  This function pointer is provided to the stream functions by the
 *  library such that they can provide a nice error message to the
 *  user during stream operations.
 */
typedef exr_result_t (*exr_stream_error_func_ptr_t) (
    exr_const_context_t ctxt, exr_result_t code, const char* fmt, ...)
    EXR_PRINTF_FUNC_ATTRIBUTE;

/** @brief Error callback function
 *
 *  Because a file can be read from using many threads at once, it is
 *  difficult to store an error message for later retrieval. As such,
 *  when a file is constructed, a callback function can be provided
 *  which delivers an error message for the calling application to
 *  handle. This will then be delivered on the same thread causing the
 *  error.
 */
typedef void (*exr_error_handler_cb_t) (
    exr_const_context_t ctxt, exr_result_t code, const char* msg);

/** Destroy custom stream function pointer
 *
 *  Generic callback to clean up user data for custom streams.
 *  This is called when the file is closed and expected not to
 *  error.
 *
 *  @param failed Indicates the write operation failed, the
 *                implementor may wish to cleanup temporary files
 */
typedef void (*exr_destroy_stream_func_ptr_t) (
    exr_const_context_t ctxt, void* userdata, int failed);

/** Query stream size function pointer
 *
 * Used to query the size of the file, or amount of data representing
 * the openexr file in the data stream.
 *
 * This is used to validate requests against the file. If the size is
 * unavailable, return -1, which will disable these validation steps
 * for this file, although appropriate memory safeguards must be in
 * place in the calling application.
 */
typedef int64_t (*exr_query_size_func_ptr_t) (
    exr_const_context_t ctxt, void* userdata);

/** @brief Read custom function pointer
 *
 * Used to read data from a custom output. Expects similar semantics to
 * pread or ReadFile with overlapped data under win32.
 *
 * It is required that this provides thread-safe concurrent access to
 * the same file. If the stream/input layer you are providing does
 * not have this guarantee, your are respo