'Media Foundation cant get thumbnail
I am trying to get a thumbnail from two mp3 files and save them to a file
For both of them i am able to get the thumbnail stream but for one of them i cant create a decoder with windows imaging componet and other works fine
I also tried gdi+ but the result was the same
Here is the file where i can get the decoder
Thumbnail stream for the mp3
Here is the file where i cant get the decoder
Thumbnail stream for the mp3
// How i get the thumbnail stream
comptr<IPropertyStore> properityStore;
hr = MFGetService(mediaSource.get(), MF_PROPERTY_HANDLER_SERVICE, IID_PPV_ARGS(properityStore.put()));
PROPVARIANT thumbnail;
PropVariantInit(&thumbnail);
IStream* thumbnailStream;
properityStore->GetValue(PKEY_ThumbnailStream, &thumbnail);
thumbnailStream = thumbnail.pStream;
PropVariantClear(&thumbnail);
Tried creating decoder in two ways
// Hresult is WINCODEC_ERR_BADHEADER
comptr<IWICBitmapDecoder> decoder;
factory->CreateDecoder(GUID_ContainerFormatPng, nullptr, decoder.put());
hr = decoder->Initialize(thumbnailStream, WICDecodeMetadataCacheOnLoad);
// Hresult is WINCODEC_ERR_COMPONENTNOTFOUND
comptr<IWICBitmapDecoder> decoder;
hr = factory->CreateDecoderFromStream(stream.get(), nullptr, WICDecodeMetadataCacheOnLoad, decoder.put());
Is there any way to fix that or another api to use?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
