static ERR GetTestInfo(const char* szExt, const PKIIDInfo** ppInfo) { ERR err = WMP_errSuccess; static PKIIDInfo iidInfo[] = { {".bmp", &IID_PKImageBmpEncode, &IID_PKImageBmpDecode}, {".ppm", &IID_PKImagePnmEncode, &IID_PKImagePnmDecode}, {".pgm", &IID_PKImagePnmEncode, &IID_PKImagePnmDecode}, {".pnm", &IID_PKImagePnmEncode, &IID_PKImagePnmDecode}, {".pfm", &IID_PKImagePnmEncode, &IID_PKImagePnmDecode}, {".tif", &IID_PKImageTifEncode, &IID_PKImageTifDecode}, {".hdr", &IID_PKImageHdrEncode, &IID_PKImageHdrDecode}, {".iyuv", &IID_PKImageIyuvEncode, &IID_PKImageIyuvDecode}, {".yuv422", &IID_PKImageYuv422Encode, &IID_PKImageYuv422Decode}, {".yuv444", &IID_PKImageYuv444Encode, &IID_PKImageYuv444Decode}, }; size_t i = 0; *ppInfo = NULL; for (i = 0; i < sizeof2(iidInfo); ++i) { if (0 == PKStrnicmp(szExt, iidInfo[i].szExt, strlen(iidInfo[i].szExt))) { *ppInfo = &iidInfo[i]; goto Cleanup; } } Call(WMP_errUnsupportedFormat); Cleanup: return err; }
ERR WmpDecAppCreateEncoderFromExt(PKCodecFactory *pCFactory, const char *szExt, PKImageEncode **ppIE) { ERR err = WMP_errSuccess; const PKIID *pIID = NULL; UNREFERENCED_PARAMETER( pCFactory ); if (0 == PKStrnicmp(szExt, ".jxr", strlen(szExt))) Call(PKImageEncode_Create_WMP(ppIE)); else { // get encod PKIID Call(GetTestEncodeIID(szExt, &pIID)); // Create encoder Call(PKTestFactory_CreateCodec(pIID, (void **)ppIE)); } Cleanup: return err; }