> - hr = IWICImagingFactory_CreateStream(factory, &stream); > + hr = IWICImagingFactory_CreateStream(factory, &wic_stream); > IWICImagingFactory_Release(factory); > if (FAILED(hr)) goto cleanup_err; > > - hr = IWICStream_InitializeFromFilename(stream, dst_filename, > GENERIC_WRITE); > + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); > if (FAILED(hr)) goto cleanup_err; > > + hr = IWICStream_InitializeFromIStream(wic_stream, stream);
Why bother creating an IWICStream here? Just use your HGLOBAL stream to initialize the encoder.
