1 /*! \file exif-mnote-data.h 2 * \brief Handling EXIF MakerNote tags 3 */ 4 /* 5 * Copyright (c) 2003 Lutz Mueller <lutz@users.sourceforge.net> 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the 19 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * Boston, MA 02110-1301 USA. 21 * 22 * SPDX-License-Identifier: LGPL-2.0-or-later 23 */ 24 25 #ifndef LIBEXIF_EXIF_MNOTE_DATA_H 26 #define LIBEXIF_EXIF_MNOTE_DATA_H 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif /* __cplusplus */ 31 32 #include <libexif/exif-log.h> 33 34 /*! Data found in the MakerNote tag */ 35 typedef struct _ExifMnoteData ExifMnoteData; 36 37 void exif_mnote_data_ref (ExifMnoteData *); 38 void exif_mnote_data_unref (ExifMnoteData *); 39 40 /*! Load the MakerNote data from a memory buffer. 41 * 42 * \param[in] d MakerNote data 43 * \param[in] buf pointer to raw MakerNote tag data 44 * \param[in] buf_size number of bytes of data at buf 45 */ 46 void exif_mnote_data_load (ExifMnoteData *d, const unsigned char *buf, 47 unsigned int buf_size); 48 49 /*! 50 * Save the raw MakerNote data into a memory buffer. The buffer is 51 * allocated by this function and must subsequently be freed by the 52 * caller. 53 * 54 * \param[in,out] d extract the data from this structure 55 * \param[out] buf pointer to buffer pointer containing MakerNote data on return 56 * \param[out] buf_size pointer to the size of the buffer 57 */ 58 void exif_mnote_data_save (ExifMnoteData *d, unsigned char **buf, 59 unsigned int *buf_size); 60 61 /*! Return the number of tags in the MakerNote. 62 * 63 * \param[in] d MakerNote data 64 * \return number of tags, or 0 if no MakerNote or the type is not supported 65 */ 66 unsigned int exif_mnote_data_count (ExifMnoteData *d); 67 68 /*! Return the MakerNote tag number for the tag at the specified index within 69 * the MakerNote. 70 * 71 * \param[in] d MakerNote data 72 * \param[in] n index of the entry within the MakerNote data 73 * \return MakerNote tag number 74 */ 75 unsigned int exif_mnote_data_get_id (ExifMnoteData *d, unsigned int n); 76 77 /*! Returns textual name of the given MakerNote tag. The name is a short, 78 * unique (within this type of MakerNote), non-localized text string 79 * containing only US-ASCII alphanumeric characters. 80 * 81 * \param[in] d MakerNote data 82 * \param[in] n index of the entry within the MakerNote data 83 * \return textual name of the tag or NULL on error 84 */ 85 const char *exif_mnote_data_get_name (ExifMnoteData *d, unsigned int n); 86 87 /*! Returns textual title of the given MakerNote tag. 88 * The title is a short, localized textual description of the tag. 89 * 90 * \param[in] d MakerNote data 91 * \param[in] n index of the entry within the MakerNote data 92 * \return textual name of the tag or NULL on error 93 */ 94 const char *exif_mnote_data_get_title (ExifMnoteData *d, unsigned int n); 95 96 /*! Returns verbose textual description of the given MakerNote tag. 97 * 98 * \param[in] d MakerNote data 99 * \param[in] n index of the entry within the MakerNote data 100 * \return textual description of the tag or NULL on error 101 */ 102 const char *exif_mnote_data_get_description (ExifMnoteData *d, unsigned int n); 103 104 /*! Return a textual representation of the value of the MakerNote entry. 105 * 106 * \warning The character set of the returned string may be in 107 * the encoding of the current locale or the native encoding 108 * of the camera. 109 * 110 * \param[in] d MakerNote data 111 * \param[in] n index of the entry within the MakerNote data 112 * \param[out] val buffer in which to store value 113 * \param[in] maxlen length of the buffer val 114 * \return val pointer, or NULL on error 115 */ 116 char *exif_mnote_data_get_value (ExifMnoteData *d, unsigned int n, char *val, unsigned int maxlen); 117 118 void exif_mnote_data_log (ExifMnoteData *, ExifLog *); 119 120 #ifdef __cplusplus 121 } 122 #endif /* __cplusplus */ 123 124 #endif /* !defined(LIBEXIF_EXIF_MNOTE_DATA_H) */ 125