IWICMetadataQueryReader interface

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

Methods

The IWICMetadataQueryReader interface has these methods.

Method Description
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

   
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