X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=libexif%2Fexif-entry.h;h=1dcdc7364e5e2b34b218c7256d17cfdbe80deecc;hb=827c74e6ecc24f749b25aad85080d6c06a3391bd;hp=f25be04aabf7aff89880f6f47bf92d0afeee8d3c;hpb=f54549d01a64875ee367150ec9793539f000c0b3;p=platform%2Fupstream%2Flibexif.git diff --git a/libexif/exif-entry.h b/libexif/exif-entry.h index f25be04..1dcdc73 100644 --- a/libexif/exif-entry.h +++ b/libexif/exif-entry.h @@ -16,8 +16,8 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. */ #ifndef __EXIF_ENTRY_H__ @@ -27,7 +27,11 @@ extern "C" { #endif /* __cplusplus */ -/*! Data found in one EXIF tag */ +/*! Data found in one EXIF tag. + * The #exif_entry_get_value function can provide access to the + * formatted contents, or the struct members can be used directly to + * access the raw contents. + */ typedef struct _ExifEntry ExifEntry; typedef struct _ExifEntryPrivate ExifEntryPrivate; @@ -35,63 +39,121 @@ typedef struct _ExifEntryPrivate ExifEntryPrivate; #include #include -/*! */ +/*! Data found in one EXIF tag */ struct _ExifEntry { + /*! EXIF tag for this entry */ ExifTag tag; + + /*! Type of data in this entry */ ExifFormat format; + + /*! Number of elements in the array, if this is an array entry. + * Contains 1 for non-array data types. */ unsigned long components; + /*! Pointer to the raw EXIF data for this entry. It is allocated + * by #exif_entry_initialize and is NULL beforehand. Data contained + * here may be manipulated using the functions in exif-utils.h */ unsigned char *data; + + /*! Number of bytes in the buffer at \c data. This must be no less + * than exif_format_get_size(format)*components */ unsigned int size; - /* Content containing this entry */ + /*! #ExifContent containing this entry. + * \see exif_entry_get_ifd */ ExifContent *parent; + /*! Internal data to be used by libexif itself */ ExifEntryPrivate *priv; }; /* Lifecycle */ -/*! Reserve memory for and initialize new #ExifEntry* */ +/*! Reserve memory for and initialize a new #ExifEntry. + * No memory is allocated for the \c data element of the returned #ExifEntry. + * + * \return new allocated #ExifEntry, or NULL on error + * + * \see exif_entry_new_mem, exif_entry_unref + */ ExifEntry *exif_entry_new (void); +/*! Reserve memory for and initialize new #ExifEntry using the specified + * memory allocator. + * No memory is allocated for the \c data element of the returned #ExifEntry. + * + * \return new allocated #ExifEntry, or NULL on error + * + * \see exif_entry_new, exif_entry_unref + */ ExifEntry *exif_entry_new_mem (ExifMem *); -/*! Increase reference counter for #ExifEntry* +/*! Increase reference counter for #ExifEntry. + * * \param[in] entry #ExifEntry + * + * \see exif_entry_unref */ void exif_entry_ref (ExifEntry *entry); -/*! Decrease reference counter for #ExifEntry* +/*! Decrease reference counter for #ExifEntry. + * When the reference count drops to zero, free the entry. + * * \param[in] entry #ExifEntry */ void exif_entry_unref (ExifEntry *entry); -/*! Actually free the #ExifEntry* +/*! Actually free the #ExifEntry. * - * \deprecated Should not be called directly. Use exif_entry_ref() and - * exif_entry_unref() instead. + * \deprecated Should not be called directly. Use #exif_entry_ref and + * #exif_entry_unref instead. * * \param[in] entry EXIF entry */ void exif_entry_free (ExifEntry *entry); -/*! Initialize an empty #ExifEntry with default data for the given tag. - * If the entry is already initialized, this function does nothing. +/*! Initialize an empty #ExifEntry with default data in the correct format + * for the given tag. If the entry is already initialized, this function + * does nothing. + * This call allocates memory for the \c data element of the given #ExifEntry. + * That memory is freed at the same time as the #ExifEntry. + * * \param[out] e entry to initialize * \param[in] tag tag number to initialize as */ void exif_entry_initialize (ExifEntry *e, ExifTag tag); +/*! Fix the type or format of the given EXIF entry to bring it into spec. + * If the data for this EXIF tag is in of the wrong type or is in an invalid + * format according to the EXIF specification, then it is converted to make it + * valid. This may involve, for example, converting an EXIF_FORMAT_LONG into a + * EXIF_FORMAT_SHORT. If the tag is unknown, its value is untouched. + * + * \note Unfortunately, some conversions are to a type with a more restricted + * range, which could have the side effect that the converted data becomes + * invalid. This is unlikely as the range of each tag in the standard is + * designed to encompass all likely data. + * + * \param[in,out] entry EXIF entry + */ void exif_entry_fix (ExifEntry *entry); + /* For your convenience */ -/*! Return a textual representation of the value of the EXIF entry. +/*! Return a localized textual representation of the value of the EXIF entry. + * This is meant for display to the user. The format of each tag is subject + * to change between locales and in newer versions of libexif. Users who + * require the tag data in an unambiguous form should access the data members + * of the #ExifEntry structure directly. * - * CAUTION: The character set of the returned string may be in + * \warning The character set of the returned string may be in * the encoding of the current locale or the native encoding * of the camera. + * \bug The EXIF_TAG_XP_* tags are currently always returned in UTF-8, + * regardless of locale, and code points above U+FFFF are not + * supported. * * \param[in] entry EXIF entry * \param[out] val buffer in which to store value @@ -103,14 +165,16 @@ const char *exif_entry_get_value (ExifEntry *entry, char *val, /*! Dump text representation of #ExifEntry to stdout. * This is intended for diagnostic purposes only. + * * \param[in] entry EXIF tag data * \param[in] indent how many levels deep to indent the data */ void exif_entry_dump (ExifEntry *entry, unsigned int indent); -/*! Returns the IFD number of the given #ExifEntry +/*! Return the IFD number of the given #ExifEntry + * * \param[in] e an #ExifEntry* - * \return IFD number, or EXIF_IFD_COUNT on error + * \return #ExifIfd, or #EXIF_IFD_COUNT on error */ #define exif_entry_get_ifd(e) ((e)?exif_content_get_ifd((e)->parent):EXIF_IFD_COUNT)