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
23#ifndef __EXIF_MNOTE_DATA_H__
24#define __EXIF_MNOTE_DATA_H__
25
26#ifdef __cplusplus
27extern "C" {
28#endif /* __cplusplus */
29
30#include <libexif/exif-log.h>
31
32/*! Data found in the MakerNote tag */
33typedef struct _ExifMnoteData ExifMnoteData;
34
35void exif_mnote_data_ref   (ExifMnoteData *);
36void exif_mnote_data_unref (ExifMnoteData *);
37
38/*! Load the MakerNote data from a memory buffer.
39 *
40 * \param[in] d MakerNote data
41 * \param[in] buf pointer to raw MakerNote tag data
42 * \param[in] buf_siz number of bytes of data at buf
43 */
44void exif_mnote_data_load (ExifMnoteData *d, const unsigned char *buf,
45			   unsigned int buf_siz);
46
47/*!
48 * Save the raw MakerNote data into a memory buffer.  The buffer is
49 * allocated by this function and must subsequently be freed by the
50 * caller.
51 *
52 * \param[in,out] d extract the data from this structure
53 * \param[out] buf pointer to buffer pointer containing MakerNote data on return
54 * \param[out] buf_siz pointer to the size of the buffer
55 */
56void exif_mnote_data_save (ExifMnoteData *d, unsigned char **buf,
57			   unsigned int *buf_siz);
58
59/*! Return the number of tags in the MakerNote.
60 *
61 * \param[in] d MakerNote data
62 * \return number of tags, or 0 if no MakerNote or the type is not supported
63 */
64unsigned int exif_mnote_data_count           (ExifMnoteData *d);
65
66/*! Return the MakerNote tag number for the tag at the specified index within
67 * the MakerNote.
68 *
69 * \param[in] d MakerNote data
70 * \param[in] n index of the entry within the MakerNote data
71 * \return MakerNote tag number
72 */
73unsigned int exif_mnote_data_get_id          (ExifMnoteData *d, unsigned int n);
74
75/*! Returns textual name of the given MakerNote tag. The name is a short,
76 * unique (within this type of MakerNote), non-localized text string
77 * containing only US-ASCII alphanumeric characters.
78 *
79 * \param[in] d MakerNote data
80 * \param[in] n index of the entry within the MakerNote data
81 * \return textual name of the tag
82 */
83const char  *exif_mnote_data_get_name        (ExifMnoteData *d, unsigned int n);
84
85/*! Returns textual title of the given MakerNote tag.
86 * The title is a short, localized textual description of the tag.
87 *
88 * \param[in] d MakerNote data
89 * \param[in] n index of the entry within the MakerNote data
90 * \return textual name of the tag
91 */
92const char  *exif_mnote_data_get_title       (ExifMnoteData *d, unsigned int n);
93
94/*! Returns verbose textual description of the given MakerNote tag.
95 *
96 * \param[in] d MakerNote data
97 * \param[in] n index of the entry within the MakerNote data
98 * \return textual description of the tag
99 */
100const char  *exif_mnote_data_get_description (ExifMnoteData *d, unsigned int n);
101
102/*! Return a textual representation of the value of the MakerNote entry.
103 *
104 * \warning The character set of the returned string may be in
105 *          the encoding of the current locale or the native encoding
106 *          of the camera.
107 *
108 * \param[in] d MakerNote data
109 * \param[in] n index of the entry within the MakerNote data
110 * \param[out] val buffer in which to store value
111 * \param[in] maxlen length of the buffer val
112 * \return val pointer, or NULL on error
113 */
114char  *exif_mnote_data_get_value (ExifMnoteData *d, unsigned int n, char *val, unsigned int maxlen);
115
116void exif_mnote_data_log (ExifMnoteData *, ExifLog *);
117
118#ifdef __cplusplus
119}
120#endif /* __cplusplus */
121
122#endif /* __EXIF_MNOTE_DATA_H__ */
123