Jump to content

mmioSet

From EDM2

The mmioSet function can be used to set or query various extended information. It can associate a CODEC with an I/O procedure, set the current track for multiple track files, set the playing speed of a digital video, and so forth.

Syntax

#define INCL_MMIOOS2
#include <os2.h>

ULONG mmioSet(HMMIO hmmio, PMMEXTENDINFO pUserExtendmminfo, ULONG ulFlags);

Parameters

hmmio (HMMIO) - input
The MMIO file handle returned by mmioOpen.
pUserExtendmminfo (PMMEXTENDINFO) - input
Pointer to the MMEXTENDINFO structure.
ulFlags (ULONG) - input
This parameter contains one of the following flags:
> Note: To reference a track other than the default track with the QUERY and SET calls, the `MMIO_TRACK` and `MMIO_CODEC_ASSOC` flags must be set at the same time the QUERY or SET is performed.
  • MMIO_SET_EXTENDEDINFO: Set the extended information.
  • MMIO_QUERY_EXTENDEDINFO_BASE: Query only the information of the MMEXTENDINFO structure.
  • MMIO_QUERY_EXTENDEDINFO_ALL: Query all extended information including the CODEC associated information.

Return Value

rc (ULONG) - returns
Return codes indicating success or type of failure:
  • MMIO_SUCCESS: If the function succeeds, 0 is returned.
  • MMIOERR_INVALID_HANDLE: Invalid MMIO handle was passed.
  • MMIOERR_INVALID_PARAMETER: An invalid parameter was passed.

Remarks

If `MMIO_SET_EXTENDEDINFO` is set to associate a CODEC procedure with an open file, the pCODECIniFileInfo field of the CODECASSOC structure is used to identify each CODEC procedure installed in the initialization file. As a result of the set, the CODEC procedures are opened and each pCodecOpen structure is passed to its corresponding CODEC procedure.

On query, two levels of information can be returned. If `MMIO_QUERY_EXTENDEDINFO_BASE` is set, only the MMEXTENDINFO structure is returned. The ulNumCODECs is the number of currently associated CODEC procedures. The ulBufSize field is the buffer size for the second level information. If the application decides to query the second level information, the `MMIO_QUERY_EXTENDEDINFO_ALL` flag must be set and the pUserExtendmminfo parameter must point to a buffer with the size equal to the ulBufSize field of the MMEXTENDINFO structure.

This function associates a CODEC procedure with an MMIO handle. Typically, this function is used to provide CODEC information for a new file being created. When an existing movie file is opened, any necessary CODEC procedures are loaded by the I/O procedure automatically based on the compression type and subtype specified in the file's header. However, there might be a need to change the output format (for example, color depth) of a CODEC and this function can be used for that. The default color depth is set to the display mode color depth for files opened for reading (that is, playback of a movie file).

If this function is not issued, no data compression and decompression will be performed for mmioRead and mmioWrite.

> Note: For digital video files, all reads and writes are `MULTITRACK_READ` and `MULTITRACK_WRITE`.

Example Code

The following code illustrates how to set CODEC information for an opened file.

   HMMIO            hmmio1;
   MMEXTENDINFO     mmExtendInfo;
   CODECASSOC       codecAssoc;
   CODECINIFILEINFO codecIniFileInfo;
   ULONG            ulFlags;
   ULONG            rc;
    ...

   hmmio1 = mmioOpen("MYFILE.SMV", &mmioInfo, MMIO_CREATE);
   
   /* Initialize extended info */
   mmExtendInfo.ulStructLen = sizeof(MMEXTENDINFO);
   mmExtendInfo.ulFlags     = MMIO_CODEC_ASSOC;
   mmExtendInfo.ulNumCODECs = 1;
   mmExtendInfo.pCODECAssoc = &codecAssoc;

   /* Initialize CODEC INI info */
   codecIniFileInfo.ulStructLen       = sizeof(CODECINIFILEINFO);
   codecIniFileInfo.fcc               = FOURCC_MYPROC;
   codecIniFileInfo.ulCompressType    = COMPRESSTYPE_MYPROC;
   codecIniFileInfo.ulCompressSubType = COMPRESSSUBTYPE_MYPROC;
   codecIniFileInfo.ulMediaType       = MEDIATYPE_MYPROC;
   codecIniFileInfo.ulCapsFlags       = CODEC_DECOMPRESS;
   codecIniFileInfo.szHWID            = HWID_MYPROC;

   /* Associate INI info with the CODEC handle */
   codecAssoc.pCODECIniFileInfo = &codecIniFileInfo;
   codecAssoc.pCodecOpen        = NULL;

   ulFlags = MMIO_SET_EXTENDEDINFO;
   rc = mmioSet(hmmio1, &mmExtendInfo, ulFlags);

   if (rc)
   {
      /* error */
   }
   else
   {
      /* Success */
   }