diff options
author | George Hazan <ghazan@miranda.im> | 2020-08-17 16:04:59 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-08-17 16:04:59 +0300 |
commit | 52be24181ca0847ab6e868da65cdbcaec82322cf (patch) | |
tree | 5d66332cbb4ddd6c7df8f0ee5d33d61c23ee61ff /src | |
parent | c57cd15287e9edc2e0ba51a77df4a2eede2fb22e (diff) |
WEBP support added to avatar support routines
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/proto_utils.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 771ebc9cff..98b55fcdf8 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -209,6 +209,8 @@ MIR_APP_DLL(LPCTSTR) ProtoGetAvatarExtension(int format) return L".swf";
if (format == PA_FORMAT_XML)
return L".xml";
+ if (format == PA_FORMAT_WEBP)
+ return L".webp";
return L"";
}
@@ -243,6 +245,9 @@ MIR_APP_DLL(int) ProtoGetAvatarFormat(const wchar_t *ptszFileName) if (!wcsicmp(ptszExt, L".xml"))
return PA_FORMAT_XML;
+ if (!wcsicmp(ptszExt, L".webp"))
+ return PA_FORMAT_WEBP;
+
return PA_FORMAT_UNKNOWN;
}
@@ -273,6 +278,11 @@ MIR_APP_DLL(int) ProtoGetBufferFormat(const void *pBuffer, const wchar_t **ptszE if (ptszExtension) *ptszExtension = L".bmp";
return PA_FORMAT_BMP;
}
+
+ if (!memcmp(pBuffer, "RIFF", 4) && !memcmp((char*)pBuffer+8, "WEBP", 4)) {
+ if (ptszExtension) *ptszExtension = L".webp";
+ return PA_FORMAT_WEBP;
+ }
}
if (ptszExtension) *ptszExtension = L"";
@@ -305,7 +315,8 @@ static char *wszMimeTypes[] = "image/bmp", // PA_FORMAT_BMP
"image/gif", // PA_FORMAT_GIF
"image/swf", // PA_FORMAT_SWF
- "application/xml" // PA_FORMAT_XML
+ "application/xml", // PA_FORMAT_XML
+ "image/webp", // PA_FORMAT_WEBP
};
MIR_APP_DLL(const char*) ProtoGetAvatarMimeType(int iFileType)
|