Jump to content

mmioQueryHeaderLength

From EDM2

The mmioQueryHeaderLength function determines the size of the header for the opened file. It sends the MMIOM_QUERYHEADERLENGTH message to the I/O procedure. The file must have been previously opened using mmioOpen.

Syntax

#define INCL_MMIOOS2
#include <os2.h>

ULONG mmioQueryHeaderLength(HMMIO hmmio, PLONG plHeaderLength, ULONG ulReserved, ULONG ulFlags);

Parameters

hmmio (HMMIO) - input
The open file handle returned by mmioOpen.
plHeaderLength (PLONG) - output
Pointer to a LONG. The size of the header in bytes is returned. If the `MMIO_TRANSLATEHEADER` flag was set in the ulTranslate field of MMIOINFO on mmioOpen, it is the size of one of the standard headers (see Remarks). Otherwise, it is the size of a native (untranslated) header for this type of file.
ulReserved (ULONG) - input
Reserved for future use and must be set to zero.
ulFlags (ULONG) - input
Reserved for future use and must be set to zero.

Return Value

rc (ULONG) - returns
Return codes indicating success or type of failure:
  • MMIO_SUCCESS: If the function succeeds, 0 is returned.
  • MMIO_ERROR: The specified file is not a media file format type.
  • MMIOERR_INVALID_PARAMETER: An invalid parameter was passed.
  • MMIOERR_INVALID_HANDLE: The handle passed was not valid.
  • MMIOERR_SEEK_FAILED: A seek operation prior to a write- or read-advance operation failed.

Remarks

The application calls **mmioQueryHeaderLength** first to determine the buffer size that is needed by mmioGetHeader to obtain header data. This is required because headers for different formats are variable in length.

The header structure is different for each Media Type. The currently defined standard headers for each ulMediaType (defined in the MMIOINFO structure) are:

  • MMIO_MEDIATYPE_IMAGE: Uses MMIMAGEHEADER as the media structure.
  • MMIO_MEDIATYPE_AUDIO: Uses MMAUDIOHEADER as the media structure.
  • MMIO_MEDIATYPE_MIDI: Uses MMMIDIHEADER as the media structure.
  • MMIO_MEDIATYPE_DIGITALVIDEO: Uses MMVIDEOHEADER as the media structure.
  • MMIO_MEDIATYPE_MOVIE: Uses MMMOVIEHEADER as the media structure.

Example Code

The following code illustrates how to determine the header size.

   HMMIO  hmmio1;
   LONG   lHeaderLength;
   ULONG  ulReserved = 0L;
   ULONG  ulFlags = 0L;
   ULONG  rc;
    ...

   rc = mmioQueryHeaderLength( hmmio1,
                               &lHeaderLength,
                               ulReserved,
                               ulFlags);
   if (rc)
     /* error */
   else
   {
     /* lHeaderLength now contains the size needed for mmioGetHeader */
   }
    ...

Related Functions