Vincent Povirk : windowscodecs: Implement IWICImagingFactory:: CreateDecoderFromStream.
Alexandre Julliard
julliard at winehq.org
Wed Aug 5 09:48:23 CDT 2009
Module: wine
Branch: master
Commit: 219b8c64ac92b08fb3ffb5d226812d6640f90975
URL: http://source.winehq.org/git/wine.git/?a=commit;h=219b8c64ac92b08fb3ffb5d226812d6640f90975
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Tue Aug 4 17:31:15 2009 -0500
windowscodecs: Implement IWICImagingFactory::CreateDecoderFromStream.
---
dlls/windowscodecs/imgfactory.c | 70 +++++++++++++++++++++++++++++++++++++-
1 files changed, 68 insertions(+), 2 deletions(-)
diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c
index e7bca4c..ab85bca 100644
--- a/dlls/windowscodecs/imgfactory.c
+++ b/dlls/windowscodecs/imgfactory.c
@@ -98,9 +98,75 @@ static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream(
IWICImagingFactory *iface, IStream *pIStream, const GUID *pguidVendor,
WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
{
- FIXME("(%p,%p,%s,%u,%p): stub\n", iface, pIStream, debugstr_guid(pguidVendor),
+ static int fixme=0;
+ IEnumUnknown *enumdecoders;
+ IUnknown *unkdecoderinfo;
+ IWICBitmapDecoderInfo *decoderinfo;
+ IWICBitmapDecoder *decoder=NULL;
+ HRESULT res=S_OK;
+ ULONG num_fetched;
+ BOOL matches;
+
+ TRACE("(%p,%p,%s,%u,%p)\n", iface, pIStream, debugstr_guid(pguidVendor),
metadataOptions, ppIDecoder);
- return E_NOTIMPL;
+
+ if (pguidVendor && !fixme++)
+ FIXME("ignoring vendor GUID\n");
+
+ res = CreateComponentEnumerator(WICDecoder, WICComponentEnumerateDefault, &enumdecoders);
+ if (FAILED(res)) return res;
+
+ while (!decoder)
+ {
+ res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
+
+ if (res == S_OK)
+ {
+ res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void**)&decoderinfo);
+
+ if (SUCCEEDED(res))
+ {
+ res = IWICBitmapDecoderInfo_MatchesPattern(decoderinfo, pIStream, &matches);
+
+ if (SUCCEEDED(res) && matches)
+ {
+ res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &decoder);
+
+ /* FIXME: should use QueryCapability to choose a decoder */
+
+ if (SUCCEEDED(res))
+ {
+ res = IWICBitmapDecoder_Initialize(decoder, pIStream, metadataOptions);
+
+ if (FAILED(res))
+ {
+ IWICBitmapDecoder_Release(decoder);
+ decoder = NULL;
+ }
+ }
+ }
+
+ IWICBitmapDecoderInfo_Release(decoderinfo);
+ }
+
+ IUnknown_Release(unkdecoderinfo);
+ }
+ else
+ break;
+ }
+
+ IEnumUnknown_Release(enumdecoders);
+
+ if (decoder)
+ {
+ *ppIDecoder = decoder;
+ return S_OK;
+ }
+ else
+ {
+ *ppIDecoder = NULL;
+ return WINCODEC_ERR_COMPONENTNOTFOUND;
+ }
}
static HRESULT WINAPI ImagingFactory_CreateDecoderFromFileHandle(
More information about the wine-cvs
mailing list