압축기 출력 형식 확인
[이 페이지와 연결된 기능인 Video Compression Manager는 레거시 기능입니다. 새 코드는 이 기능을 사용하지 않는 것이 좋습니다.]
다음 예제에서는 ICCompressGetFormat 크기 매크로를 사용하여 압축 형식을 지정하는 데이터에 필요한 버퍼 크기를 확인하고, GlobalAlloc 함수를 사용하여 적절한 크기의 버퍼를 할당하고, ICCompressGetFormat 매크로를 사용하여 압축 형식 정보를 검색합니다.
LPBITMAPINFOHEADER lpbiIn, lpbiOut;
// *lpbiIn must be initialized to the input format.
dwFormatSize = ICCompressGetFormatSize(hIC, lpbiIn);
h = GlobalAlloc(GHND, dwFormatSize);
lpbiOut = (LPBITMAPINFOHEADER)GlobalLock(h);
ICCompressGetFormat(hIC, lpbiIn, lpbiOut);
다음 예제에서는 ICCompressQuery 매크로를 사용하여 압축기가 입력 및 출력 형식을 처리할 수 있는지 여부를 확인합니다.
LPBITMAPINFOHEADER lpbiIn, lpbiOut;
// Both *lpbiIn and *lpbiOut must be initialized to the respective
// formats.
if (ICCompressQuery(hIC, lpbiIn, lpbiOut) == ICERR_OK)
{
// Format is supported; use the compressor.
}
다음 예제에서는 ICCompressGetSize 매크로를 사용하여 버퍼 크기를 확인하고 GlobalAlloc을 사용하여 해당 크기의 버퍼를 할당합니다.
// Find the worst-case buffer size.
dwCompressBufferSize = ICCompressGetSize(hIC, lpbiIn, lpbiOut);
// Allocate a buffer and get lpOutput to point to it.
h = GlobalAlloc(GHND, dwCompressBufferSize);
lpOutput = (LPVOID)GlobalLock(h);