Nota
L-aċċess għal din il-paġna jeħtieġ l-awtorizzazzjoni. Tista’ tipprova tidħol jew tibdel id-direttorji.
L-aċċess għal din il-paġna jeħtieġ l-awtorizzazzjoni. Tista’ tipprova tibdel id-direttorji.
Starting in Windows 7, Microsoft Media Foundation exposes metadata through the IPropertyStore interface.
Metadata obtained using the process defined in this topic should only be used for read-only access. Writing data using this process is not supported. You can create an IPropertyStore object for writing purposes using a class identifier (CLSID) obtained from PSLookupPropertyHandlerCLSID.
Reading Metadata
To read metadata from a media source, perform the following steps:
- Get a pointer to the IMFMediaSource interface of the media source. You can use the IMFSourceResolver interface to get an IMFMediaSource pointer.
- Call MFGetService on the media source to get a pointer to the IPropertyStore interface. In the guidService parameter of MFGetService, specify the value MF_PROPERTY_HANDLER_SERVICE. If the source does not support the IPropertyStore interface, MFGetService returns MF_E_UNSUPPORTED_SERVICE.
- Call IPropertyStore methods to enumerate the metadata properties.
The following code shows these steps. Assume that DisplayProperty is a function that displays a PROPVARIANT value.
HRESULT EnumerateMetadata(IMFMediaSource *pSource)
{
IPropertyStore *pProps = NULL;
HRESULT hr = MFGetService(
pSource, MF_PROPERTY_HANDLER_SERVICE, IID_PPV_ARGS(&pProps));
if (FAILED(hr))
{
goto done;
}
DWORD cProps;
hr = pProps->GetCount(&cProps);
if (FAILED(hr))
{
goto done;
}
for (DWORD i = 0; i < cProps; i++)
{
PROPERTYKEY key;
hr = pProps->GetAt(i, &key);
if (FAILED(hr))
{
goto done;
}
PROPVARIANT pv;
hr = pProps->GetValue(key, &pv);
if (FAILED(hr))
{
goto done;
}
DisplayProperty(key, pv);
PropVariantClear(&pv);
}
done:
SafeRelease(&pProps);
return hr;
}
For a list of metadata property keys, see Metadata Properties for Media Files.
Related topics