Freigeben über


Bestimmen des Ausgabeformats eines Kompressors

[Das feature, das dieser Seite zugeordnet ist, der Videokomprimierungs-Manager, ist ein Legacyfeature. Microsoft empfiehlt dringend, dass neuer Code dieses Feature nicht verwendet.]

Im folgenden Beispiel wird das IcCompressGetFormat-Größenmakro verwendet, um die für die Daten erforderliche Puffergröße zu bestimmen, die das Komprimierungsformat angeben, einen Puffer der entsprechenden Größe mithilfe der GlobalAlloc-Funktion zuordnet und die Komprimierungsformatinformationen mithilfe des ICCompressGetFormat-Makros abzurufen.

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); 
 

Im folgenden Beispiel wird das ICCompressQuery-Makro verwendet, um zu bestimmen, ob ein Kompressor die Eingabe- und Ausgabeformate verarbeiten kann.

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. 
 
}
 
 

Im folgenden Beispiel wird das ICCompressGetSize-Makro verwendet, um die Puffergröße zu bestimmen, und es wird ein Puffer dieser Größe mithilfe von GlobalAlloc zugeordnet.

// 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);