IWICMetadataQueryReader interface (wincodec.h)

Exposes methods for retrieving metadata blocks and items from a decoder or its image frames using a metadata query expression.

Inheritance

The IWICMetadataQueryReader interface inherits from the IUnknown interface. IWICMetadataQueryReader also has these types of members:

Methods

The IWICMetadataQueryReader interface has these methods.

 
IWICMetadataQueryReader::GetContainerFormat

Gets the metadata query readers container format.
IWICMetadataQueryReader::GetEnumerator

Gets an enumerator of all metadata items at the current relative location within the metadata hierarchy.
IWICMetadataQueryReader::GetLocation

Retrieves the current path relative to the root metadata block.
IWICMetadataQueryReader::GetMetadataByName

Retrieves the metadata block or item identified by a metadata query expression.

Remarks

A metadata query reader uses metadata query expressions to access embedded metadata. For more information on the metadata query language, see the Metadata Query Language Overview.

The benefit of the query reader is the ability to access a metadata item in a single step.

The query reader also provides the way to traverse the whole set of metadata hierarchy with the help of the GetEnumerator method. However, it is not recommended to use this method since IWICMetadataBlockReader and IWICMetadataReader provide a more convenient and cheaper way.

Examples

The following code demonstrates how to obtain a query reader and use it to retrieve a metadata item.

// Get the query reader
if (SUCCEEDED(hr))
{
    hr = pFrameDecode->GetMetadataQueryReader(&pQueryReader);
}

if (SUCCEEDED(hr))
{
    hr = pQueryReader->GetMetadataByName(L"/app1/ifd/{ushort=18249}", &value);
    PropVariantClear(&value);
}

The following code demonstrates how to obtain query reader and use it to retrieve a nested metadata block.

// Get the query reader
if (SUCCEEDED(hr))
{
    hr = pFrameDecode->GetMetadataQueryReader(&pQueryReader);
}

if (SUCCEEDED(hr))
{
    // Get the embedded IFD reader
    hr = pQueryReader->GetMetadataByName(L"/app1/ifd", &value);
    if (value.vt == VT_UNKNOWN)
    {
        hr = value.punkVal->QueryInterface(IID_IWICMetadataQueryReader, (void **)&pEmbedReader);
    }
    PropVariantClear(&value); // Clear value for new query
}

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header wincodec.h

See also

Conceptual

Metadata Query Language Overview

Overview of Reading and Writing Image Metadata

WIC Metadata Overview