MDItem Reference

Derived from
Framework
CoreServices/CoreServices.h
Declared in
MDItem.h
Companion guides

Overview

MDItem is a CF-compliant object that represents a file and the metadata associated with the file.

For functions that expect an MDItemRef parameter, if this parameter is not a valid MDItemRef, the behavior is undefined. NULL is not a valid MDItemRef.

Functions by Task

Creating an MDItem

Getting the Type Identifier

Retrieving Metadata Attributes

Functions

MDItemCopyAttribute

Returns the value of the specified attribute in the metadata item.

CFTypeRef MDItemCopyAttribute (
   MDItemRef item,
   CFStringRef name
);
Parameters
item

The item to be queried.

name

The name of the requested attribute.

Return Value

A CFTypeRef, or NULL if there was a failure reading the attribute or the attribute does not exist.

Availability
  • Available in OS X version 10.4 and later.
Declared In
MDItem.h

MDItemCopyAttributeList

Returns the values of the specified attributes in the metadata item.

CFDictionaryRef MDItemCopyAttributeList (
   MDItemRef item,
   ...
);
Parameters
item

The item to be queried.

...

A comma-separated varargs list of the string attribute names..

Return Value

A CFDictionary containing keys for the requested attribute names, and the corresponding values. If an attribute does not exist, or the attribute is unreadable, there will be no key-value pair for it in the dictionary. Returns NULL on failure.

Availability
  • Available in OS X version 10.4 and later.
Declared In
MDItem.h

MDItemCopyAttributeNames

Returns an array containing the attribute names existing in the metadata item.

CFArrayRef MDItemCopyAttributeNames (
   MDItemRef item
);
Parameters
item

The item to be queried.

Return Value

A CFArray of CFString attribute names, or NULL on failure.

Availability
  • Available in OS X version 10.4 and later.
Declared In
MDItem.h

MDItemCopyAttributes

Returns the values of the specified attributes in the metadata item.

CFDictionaryRef MDItemCopyAttributes (
   MDItemRef item,
   CFArrayRef names
);
Parameters
item

The item to be queried.

names

A CFArray containing the names of the requested attributes.

Return Value

A CFDictionary containing keys for the requested attribute names, and the corresponding values. If an attribute does not exist, or the attribute is unreadable, there will be no key-value pair for it in the dictionary. Returns NULL on failure.

Availability
  • Available in OS X version 10.4 and later.
Declared In
MDItem.h

MDItemCreate

Creates an MDItem object for a file at the specified path.

MDItemRef MDItemCreate (
   CFAllocatorRef allocator,
   CFStringRef path
);
Parameters
allocator

The CFAllocator object to be used to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

path

A path to the file from which to create the MDItem. The path must exist.

Return Value

An MDItem object or NULL if there was a problem creating the object.

Discussion

Returns a metadata item for the given URL.

Special Considerations

In OS X v 10.5 and later MDItemRefs may or may not be uniqued. You should always use CFEqual for comparison.

Prior to OS X v 10.5 items were guaranteed to be unique and == could or CFEqual could be used for the comparison.

Availability
  • Available in OS X version 10.4 and later.
Related Sample Code
Declared In
MDItem.h

MDItemCreateWithURL

Creates an MDItem object for a file at the specified file URL.

MDItemRef MDItemCreateWithURL (
   CFAllocatorRef allocator,
   CFURLRef url
);
Parameters
allocator

The CFAllocator object to be used to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

url

A file URL to the file from which to create the MDItem. The file must exist.

Return Value

An MDItem object or NULL if there was a problem creating the object.

Discussion

Returns a metadata item for the given URL.

Special Considerations

In OS X v 10.5 and later MDItemRefs may or may not be uniqued. You should always use CFEqual for comparison.

Prior to OS X v 10.5 items were guaranteed to be unique and == could or CFEqual could be used for the comparison.

Availability
  • Available in OS X version 10.6 and later.
Related Sample Code
Declared In
MDItem.h

MDItemGetTypeID

Returns the type identifier of all MDItem instances.

CFTypeID MDItemGetTypeID (
   void
);
Return Value

The type identifier for the MDItem opaque type.

Availability
  • Available in OS X version 10.4 and later.
Declared In
MDItem.h

Data Types

MDItemRef

A reference to a MDItem object.

typedef struct __MDItem *MDItemRef;
Availability
  • Available in OS X v10.4 and later.
Declared In
MDItem.h

Constants

Common Metadata Attribute Keys

Metadata attribute keys that are common to many file types.

const CFStringRef kMDItemAttributeChangeDate;
const CFStringRef kMDItemAudiences;
const CFStringRef kMDItemAuthors;
const CFStringRef kMDItemAuthorAddresses;
const CFStringRef kMDItemCity;
const CFStringRef kMDItemComment;
const CFStringRef kMDItemContactKeywords;
const CFStringRef kMDItemContentCreationDate;
const CFStringRef kMDItemContentModificationDate;
const CFStringRef kMDItemContentType;
const CFStringRef kMDItemContributors;
const CFStringRef kMDItemCopyright;
const CFStringRef kMDItemCountry;
const CFStringRef kMDItemCoverage;
const CFStringRef kMDItemCreator;
const CFStringRef kMDItemDescription;
const CFStringRef kMDItemDueDate;
const CFStringRef kMDItemDurationSeconds;
const CFStringRef kMDItemEmailAddresses;
const CFStringRef kMDItemEncodingApplications;
const CFStringRef kMDItemFinderComment;
const CFStringRef kMDItemFonts;
const CFStringRef kMDItemHeadline;
const CFStringRef kMDItemIdentifier;
const CFStringRef kMDItemInstantMessageAddresses;
const CFStringRef kMDItemInstructions;
const CFStringRef kMDItemKeywords;
const CFStringRef kMDItemKind;
const CFStringRef kMDItemLanguages;
const CFStringRef kMDItemLastUsedDate;
const CFStringRef kMDItemNumberOfPages;
const CFStringRef kMDItemOrganizations;
const CFStringRef kMDItemPageHeight;
const CFStringRef kMDItemPageWidth;
const CFStringRef kMDItemParticipants;
const CFStringRef kMDItemPhoneNumbers;
const CFStringRef kMDItemProjects;
const CFStringRef kMDItemPublishers;
const CFStringRef kMDItemRecipients;
const CFStringRef kMDItemRecipientAddresses;
const CFStringRef kMDItemRights;
const CFStringRef kMDItemSecurityMethod;
const CFStringRef kMDItemStarRating;
const CFStringRef kMDItemStateOrProvince;
const CFStringRef kMDItemTextContent;
const CFStringRef kMDItemTitle;
const CFStringRef kMDItemVersion;
const CFStringRef kMDItemWhereFroms;
const CFStringRef kMDItemSupportFileType;
const CFStringRef kMDItemAuthorEmailAddresses;
const CFStringRef kMDItemRecipientEmailAddresses;
const CFStringRef kMDItemTheme;
const CFStringRef kMDItemSubject;
const CFStringRef kMDItemCFBundleIdentifier;
const CFStringRef kMDItemFSHasCustomIcon;
const CFStringRef kMDItemFSIsStationery;
const CFStringRef kMDItemInformation;
const CFStringRef kMDItemURL;
Constants
kMDItemAttributeChangeDate

The date and time of the last change made to a metadata attribute. A CFDate.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAudiences

The audience for which the file is intended. The audience may be determined by the creator or the publisher or by a third party. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAuthors

The author, or authors, of the contents of the file. A CFArray of CFStrings.

The order of the authors is preserved, but does not represent the main author or relative importance of the authors.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAuthorAddresses

This attribute indicates the author addresses of the document. A CFArray of CFStrings.

Available in OS X v10.6 and later.

Declared in MDItem.h.

kMDItemCity

Identifies city of origin according to guidelines established by the provider. A CFString.

For example, "New York", "Cupertino", or "Toronto".

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemComment

A comment related to the file. This differs from the Finder comment, kMDItemFinderComment. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemContactKeywords

A list of contacts that are associated with this document, not including the authors. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemContentCreationDate

The date that the contents of the file were created. A CFDate.

This is different than the file creation date. Its can be used to store when the file contents were first created, or first modified.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemContentModificationDate

The date and time that the contents of the file were last modified. A CFDate.

This is not necessarily the file modification date.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemContentType

The UTI pedigree of a file. A CFString.

For example, a jpeg image file will have a value of public.jpeg/public.image/public.data. The value of this attribute is set by the MDImporter. Changes to this value are lost when the file attributes are next imported.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemContributors

The entities responsible for making contributions to the content of the resource. A CFArray of CFStrings.

Examples of a contributor include a person, an organization or a service.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemCopyright

The copyright owner of the file contents. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemCountry

The full, publishable name of the country or primary location where the intellectual property of the item was created, according to guidelines of the provider. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemCoverage

The extent or scope of the content of the resource. A CFString.

Coverage will typically include spatial location (a place name or geographic co-ordinates), temporal period (a period label, date, or date range) or jurisdiction (such as a named administrative entity).

Recommended best practice is to select a value from a controlled vocabulary, and that, where appropriate, named places or time periods be used in preference to numeric identifiers such as sets of co-ordinates or date ranges.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemCreator

Application used to create the document content (e.g. "Word", "AppleWorks", etc.). A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemDescription

A description of the content of the resource. The description may include an abstract, table of contents, reference to a graphical representation of content or a free-text account of the content. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemDueDate

Date this item is due. A CFDate.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemDurationSeconds

The duration, in seconds, of the content of file. A value of 10.5 represents media that is 10 and 1/2 seconds long. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemEmailAddresses

Email addresses related to this item. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemEncodingApplications

Application used to convert the original content into it's current form. For example, a PDF file might have an encoding application set to "Distiller". A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFinderComment

Finder comments for this file. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFonts

Fonts used in this item. You should store the font's full name, the postscript name, or the font family name, based on the available information. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemHeadline

A publishable entry providing a synopsis of the contents of the file. For example, "Apple Introduces the iPod Photo". A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemIdentifier

A formal identifier used to reference the resource within a given context. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemInstantMessageAddresses

Instant message addresses related to this item. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemInstructions

Editorial instructions concerning the use of the item, such as embargoes and warnings. For example, "Second of four stories". A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemKeywords

Keywords associated with this file. For example, “Birthday”, “Important”, etc. An CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemKind

A description of the kind of item this file represents. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemLanguages

Indicates the languages of the intellectual content of the resource. Recommended best practice for the values of the Language element is defined by RFC 3066. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemLastUsedDate

The date and time that the file was last used. This value is updated automatically by LaunchServices everytime a file is opened by double clicking, or by asking LaunchServices to open a file. A CFDate.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemNumberOfPages

Number of pages in the document. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemOrganizations

The company or organization that created the document. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemPageHeight

Height of the document page, in points (72 points per inch). For PDF files this indicates the height of the first page only. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemPageWidth

Width of the document page, in points (72 points per inch). For PDF files this indicates the width of the first page only. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemParticipants

The list of people who are visible in an image or movie or written about in a document. A CFArray of CFStrings.

Available in OS X v10.6 and later.

Declared in MDItem.h.

kMDItemPhoneNumbers

Phone numbers related to this item. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemProjects

The list of projects that this file is part of. For example, if you were working on a movie all of the files could be marked as belonging to the project “My Movie”. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemPublishers

The entity responsible for making the resource available. For example, a person, an organization, or a service. Typically, the name of a publisher should be used to indicate the entity. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemRecipients

Recipients of this item. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemRecipientAddresses

This attribute indicates the recipient addresses of the document. A CFArray of CFStrings.

Available in OS X v10.6 and later.

Declared in MDItem.h.

kMDItemRights

Provides a link to information about rights held in and over the resource. A CFString.

Contains a rights management statement for the resource, or reference a service providing such information. Rights information often encompasses Intellectual Property Rights (IPR), Copyright, and various Property Rights.

If this attribute is absent, no assumptions can be made about the status of these and other rights with respect to the resource.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemSecurityMethod

The security or encryption method used for the file. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemStarRating

User rating of this item. For example, the stars rating of an iTunes track. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemStateOrProvince

Identifies the province or state of origin according to guidelines established by the provider. For example, "CA", "Ontario", or "Sussex". A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemTextContent

Contains a text representation of the content of the document. Data in multiple fields should be combined using a whitespace character as a separator. A CFString.

An application's Spotlight importer provides the content of this attribute. Applications can search for values in this attribute, but are not able to read the content of this attribute directly.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemTitle

The title of the file. For example, this could be the title of a document, the name of an song, or the subject of an email message. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemVersion

The version number of this file. A CFString

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemWhereFroms

Describes where the file was obtained from. A CFArray of CFStrings.

For example, a downloaded file may refer to the URL, files received by email may indicate the sender’s email address, message subject, etc.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemSupportFileType

A CFArray of CFStrings.

Available in OS X v10.5 and later.

Deprecated in OS X v10.5.

Declared in MDItem.h.

kMDItemAuthorEmailAddresses

This attribute indicates the author of the emails message addresses. (This is always the email address, and not the human readable version). A CFArray of CFStrings.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemRecipientEmailAddresses

This attribute indicates the recipients email addresses. (This is always the email address, and not the human readable version). A CFArray of CFStrings.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemTheme

Theme of the this item. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemSubject

Subject of the this item. Type is a CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemCFBundleIdentifier

If this item is a bundle, then this is the CFBundleIdentifier. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemFSHasCustomIcon

Boolean indicating if this file has a custom icon. Type is a CFBoolean.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSIsStationery

Boolean indicating if this file is stationery. Type is a CFBoolean.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemInformation

Information about the item. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemURL

Url of the item. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

Image Metadata Attribute Keys

Metadata attribute keys that are common to image files.

const CFStringRef kMDItemPixelHeight;
const CFStringRef kMDItemPixelWidth;
const CFStringRef kMDItemPixelCount;
const CFStringRef kMDItemColorSpace;
const CFStringRef kMDItemBitsPerSample;
const CFStringRef kMDItemFlashOnOff;
const CFStringRef kMDItemFocalLength;
const CFStringRef kMDItemAcquisitionMake;
const CFStringRef kMDItemAcquisitionModel;
const CFStringRef kMDItemISOSpeed;
const CFStringRef kMDItemOrientation;
const CFStringRef kMDItemLayerNames;
const CFStringRef kMDItemWhiteBalance;
const CFStringRef kMDItemAperture;
const CFStringRef kMDItemProfileName;
const CFStringRef kMDItemResolutionWidthDPI;
const CFStringRef kMDItemResolutionHeightDPI;
const CFStringRef kMDItemExposureMode;
const CFStringRef kMDItemExposureTimeSeconds;
const CFStringRef kMDItemEXIFVersion;
const CFStringRef kMDItemAlbum;
const CFStringRef kMDItemHasAlphaChannel;
const CFStringRef kMDItemRedEyeOnOff;
const CFStringRef kMDItemMeteringMode;
const CFStringRef kMDItemMaxAperture;
const CFStringRef kMDItemFNumber;
const CFStringRef kMDItemExposureProgram;
const CFStringRef kMDItemExposureTimeString;
const CFStringRef kMDItemEXIFGPSVersion;
const CFStringRef kMDItemAltitude;
const CFStringRef kMDItemLatitude;
const CFStringRef kMDItemLongitude;
const CFStringRef kMDItemTimestamp;
const CFStringRef kMDItemSpeed;
const CFStringRef kMDItemGPSTrack;
const CFStringRef kMDItemImageDirection;
const CFStringRef kMDItemNamedLocation;
Constants
kMDItemPixelHeight

The height, in pixels, of the contents. For example, the image height or the video frame height. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemPixelWidth

The width, in pixels, of the contents. For example, the image width or the video frame width. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemPixelCount

The total number of pixels in the contents. Same as kMDItemPixelWidth x kMDItemPixelHeight. A CFNumber.

Available in OS X v10.6 and later.

Declared in MDItem.h.

kMDItemColorSpace

The color space model used by the document contents. For example, “RGB”, “CMYK”, “YUV”, or “YCbCr”. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemBitsPerSample

The number of bits per sample. For example, the bit depth of an image (8-bit, 16-bit etc...) or the bit depth per audio sample of uncompressed audio data (8, 16, 24, 32, 64, etc..). A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFlashOnOff

Indicates if a camera flash was used. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFocalLength

The actual focal length of the lens, in millimeters. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAcquisitionMake

The manufacturer of the device used to aquire the document contents. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAcquisitionModel

The model of the device used to aquire the document contents. For example, 100, 200, 400, etc. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemISOSpeed

The ISO speed used to acquire the document contents. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemOrientation

The orientation of the document contents. Possible values are 0 (landscape) and 1 (portrait). A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemLayerNames

The names of the layers in the file. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemWhiteBalance

The white balance setting used to acquire the document contents. Possible values are 0 (auto white balance) and 1 (manual). A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAperture

The aperture setting used to acquire the document contents. This unit is the APEX value. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemProfileName

The name of the color profile used by the document contents. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemResolutionWidthDPI

Resolution width, in DPI, of this image. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemResolutionHeightDPI

Resolution height, in DPI, of this image. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemExposureMode

The exposure mode used to acquire the document contents. A CFNumber.

Possible values are 0 (auto exposure), 1 (manual exposure) and 2 (auto bracket).

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemExposureTimeSeconds

The exposure time, in seconds, used to acquire the document contents. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemEXIFVersion

The version of the EXIF header used to generate the metadata. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAlbum

The title for a collection of media. This is analagous to a record album, or photo album. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemHasAlphaChannel

Indicates if this image file has an alpha channel. A CFBoolean.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemRedEyeOnOff

Indicates if red-eye reduction was used to take the picture. A CFBoolean.

Possible values are 0 (no red-eye reduction mode or unknown) and 1 (red-eye reduction used).

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemMeteringMode

The metering mode used to take the image. A CFString.

Possible values are: Unknown, Average, CenterWeightedAverage, Spot, MultiSpot, Pattern, and Partial.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemMaxAperture

The smallest f-number of the lens. Ordinarily it is given in the range of 00.00 to 99.99. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFNumber

The diameter of the diaphragm aperture in terms of the effective focal length of the lens.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemExposureProgram

The class of the exposure program used by the camera to set exposure when the image is taken. Possible values include: Manual, Normal, and Aperture priority. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemExposureTimeString

The time of the exposure. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemEXIFGPSVersion

The version of GPSInfoIFD in EXIF used to generate the metadata. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemAltitude

The altitude of the item in meters above sea level, expressed using the WGS84 datum. Negative values lie below sea level. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemLatitude

The latitude of the item in degrees north of the equator, expressed using the WGS84 datum. Negative values lie south of the equator. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemLongitude

The longitude of the item in degrees east of the prime meridian, expressed using the WGS84 datum. Negative values lie west of the prime meridian. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemTimestamp

The timestamp on the item. This generally is used to indicate the time at which the event captured by the item took place. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemSpeed

The speed of the item, in kilometers per hour. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemGPSTrack

The direction of travel of the item, in degrees from true north. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemImageDirection

The direction of the item's image, in degrees from true north. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemNamedLocation

The name of the location or point of interest associated with the item. The name may be user provided. A CFString.

Available in OS X v10.6 and later.

Declared in MDItem.h.

Video Metadata Attribute Keys

Metadata attribute keys that are common to video files.

const CFStringRef kMDItemAudioBitRate;
const CFStringRef kMDItemCodecs;
const CFStringRef kMDItemDeliveryType;
const CFStringRef kMDItemMediaTypes;
const CFStringRef kMDItemStreamable;
const CFStringRef kMDItemTotalBitRate;
const CFStringRef kMDItemVideoBitRate;
const CFStringRef kMDItemDirector;
const CFStringRef kMDItemProducer;
const CFStringRef kMDItemGenre;
const CFStringRef kMDItemPerformers;
const CFStringRef kMDItemOriginalFormat;
const CFStringRef kMDItemOriginalSource;
Constants
kMDItemAudioBitRate

The audio bit rate. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemCodecs

The codecs used to encode/decode the media. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemDeliveryType

The delivery type. Values are “Fast start” or “RTSP”. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemMediaTypes

The media types present in the content. A CFArray of CFStrings.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemStreamable

Whether the content is prepared for streaming. A CFBoolean.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemTotalBitRate

The total bit rate, audio and video combined, of the media. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemVideoBitRate

The video bit rate. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemDirector

Directory of the movie. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemProducer

Producer of the content. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemGenre

Genre of the movie. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemPerformers

Performers in the movie. A CFArray of CFStrings.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemOriginalFormat

Original format of the movie. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

kMDItemOriginalSource

Original source of the movie. A CFString.

Available in OS X v10.5 and later.

Declared in MDItem.h.

Audio Metadata Attribute Keys

Metadata attribute keys that describe an audio file.

const CFStringRef kMDItemAppleLoopDescriptors;
const CFStringRef kMDItemAppleLoopsKeyFilterType;
const CFStringRef kMDItemAppleLoopsLoopMode;
const CFStringRef kMDItemAppleLoopsRootKey;
const CFStringRef kMDItemAudioChannelCount;
const CFStringRef kMDItemAudioEncodingApplication;
const CFStringRef kMDItemAudioSampleRate;
const CFStringRef kMDItemAudioTrackNumber;
const CFStringRef kMDItemComposer;
const CFStringRef kMDItemIsGeneralMIDISequence;
const CFStringRef kMDItemKeySignature;
const CFStringRef kMDItemLyricist;
const CFStringRef kMDItemMusicalGenre;
const CFStringRef kMDItemMusicalInstrumentCategory;
const CFStringRef kMDItemMusicalInstrumentName;
const CFStringRef kMDItemRecordingDate;
const CFStringRef kMDItemRecordingYear;
const CFStringRef kMDItemTempo;
const CFStringRef kMDItemTimeSignature;
Constants
kMDItemAppleLoopDescriptors

Specifies multiple pieces of descriptive information about a loop. A CFArray of CFStrings.

Besides genre and instrument, files can contain descriptive information that help users in refining searches.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAppleLoopsKeyFilterType

Specifies key filtering information about a loop. Loops are matched against projects that often in a major or minor key. A CFString.

To assist users in identifying loops that will "fit" with their compositions, loops can be tagged with one of the following key filters: "AnyKey" "Minor" "Major" "NeitherKey" "BothKeys". "AnyKey" means that it fits with anything (whether in a major key, minor key or neither). "Minor" fits with compositions in a minor key. "NeitherKey" doesn't work well with compositions that are in major or minor key. "BothKeys" means it fits with major or minor key.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAppleLoopsLoopMode

Specifies how a file should be played. A CFString.

Tagged files can either be loops or non-loops (e.g., a cymbal crash). "Looping" indicates if the file should be treated as a loop. "Non-looping" indicates the file should not be treated as a loop.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAppleLoopsRootKey

Specifies the loop's original key. The key is the root note or tonic for the loop, and does not include the scale type. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAudioChannelCount

Number of channels in the audio data contained in the file. A CFNumber.

This integer value only represents the number of discreet channels of audio data found in the file. It does not indicate any configuration of the data in regards to a user's speaker setup.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAudioEncodingApplication

The name of the application that encoded the data contained in the audio file. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAudioSampleRate

Sample rate of the audio data contained in the file. The sample rate is a float value representing hz (audio_frames/second). For example: 44100.0, 22254.54. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemAudioTrackNumber

The track number of a song or composition when it is part of an album. A CFNumber (integer).

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemComposer

The composer of the music contained in the audio file. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemIsGeneralMIDISequence

Indicates whether the MIDI sequence contained in the file is setup for use with a General MIDI device. A CFBoolean.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemKeySignature

The key of the music contained in the audio file. For example: C, Dm, F#m, Bb. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemLyricist

The lyricist, or text writer, of the music contained in the audio file. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemMusicalGenre

The musical genre of the song or composition contained in the audio file. For example: Jazz, Pop, Rock, Classical. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemMusicalInstrumentCategory

Specifies the category of an instrument. A CFString.

Files should have an instrument associated with them ("Other Instrument" is provided as a catch-all). For some categories, such as "Keyboards", there are instrument names which provide a more detailed instrument definition, for example "Piano" or "Organ".

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemMusicalInstrumentName

Specifies the name of instrument relative to the instrument category. A CFString.

Files can have an instrument name associated with them if they have certain instrument categories. For example, the "Percussion" category has multiple instruments, including "Conga" and "Bongo".

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemRecordingDate

The recording date of the song or composition. A CFDate.

This is in contrast to kMDItemContentCreationDate which, could indicate the creation date of an edited or 'mastered' version of the original art.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemRecordingYear

Indicates the year the item was recorded. For example, 1964, 2003, etc. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemTempo

A float value that specifies the beats per minute of the music contained in the audio file. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemTimeSignature

The time signature of the musical composition contained in the audio/MIDI file. For example: "4/4", "7/8". A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

Availability
  • Available in OS X version 10.4 and later.
Declared In
MDItem.h

File System Metadata Attribute Keys

Metadata attribute keys that describe the file system attributes for a file.

const CFStringRef kMDItemDisplayName;
const CFStringRef kMDItemFSContentChangeDate;
const CFStringRef kMDItemFSCreationDate;
const CFStringRef kMDItemFSExists;
const CFStringRef kMDItemFSInvisible;
const CFStringRef kMDItemFSIsExtensionHidden;
const CFStringRef kMDItemFSIsReadable;
const CFStringRef kMDItemFSIsWriteable;
const CFStringRef kMDItemFSLabel;
const CFStringRef kMDItemFSName;
const CFStringRef kMDItemFSNodeCount;
const CFStringRef kMDItemFSOwnerGroupID;
const CFStringRef kMDItemFSOwnerUserID;
const CFStringRef kMDItemFSSize;
const CFStringRef kMDItemPath;
Constants
kMDItemDisplayName

The localized version of the file name. A CFString.

This is the localized version of the LaunchServices call LSCopyDisplayNameForURL/LSCopyDisplayNameForRef.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSContentChangeDate

The date the file contents last changed. A CFDate.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSCreationDate

The date and time that the file was created. A CFDate.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSExists

This attribute is deprecated and was never implemented.

Deprecated in OS X v10.4.

Declared in MDItem.h.

kMDItemFSInvisible

Indicates whether the file is invisible. A CFBoolean.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSIsExtensionHidden

Indicates whether the file extension of the file is hidden. A CFBoolean.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSIsReadable

This attribute is deprecated and was never implemented.

Deprecated in OS X v10.4.

Declared in MDItem.h.

kMDItemFSIsWriteable

This attribute is deprecated and was never implemented.

Deprecated in OS X v10.4.

Declared in MDItem.h.

kMDItemFSLabel

Index of the Finder label of the file. Possible values are 0 through 7. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSName

The file name of the item. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSNodeCount

Number of files in a directory. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSOwnerGroupID

The group ID of the owner of the file. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSOwnerUserID

The user ID of the owner of the file. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemFSSize

The size, in bytes, of the file on disk. A CFNumber.

Available in OS X v10.4 and later.

Declared in MDItem.h.

kMDItemPath

The complete path to the file. A CFString.

Available in OS X v10.4 and later.

Declared in MDItem.h.

Availability
  • Available in OS X version 10.4 and later.
Declared In
MDItem.h