MMIOM_SEEK
Appearance
The MMIOM_SEEK message is sent to a Multimedia I/O (MMIO) procedure by the mmioSeek function to request that the current file position pointer be relocated within an open media file stream.
Syntax
newPosition = mmioSendMessage(hmmio, MMIOM_SEEK, offset, seekMode);
Parameters
- pmmioinfo (PMMIOINFO)
- A pointer to an MMIOINFO data structure maintaining the runtime state of the open file channel. The I/O procedure updates the internal tracking position marker (`lDiskOffset`) upon completing the operation.
- usMsg (USHORT)
- The message identifier, set to `MMIOM_SEEK`.
- lParam1 (LONG)
- A signed distance integer specifying the target movement offset, calculated in bytes. Depending on the flags passed in lParam2, this value can be positive or negative.
- lParam2 (LONG)
- A flag specifying the origin location or structural constraints for the seek calculation:
- SEEK_SET: Relocates the file pointer exactly lParam1 bytes relative to the absolute beginning of the file.
- SEEK_CUR: Shifts the file pointer relative to its current active position by the number of bytes specified in lParam1 (positive values advance downstream, negative values retreat upstream).
- SEEK_END: Shifts the file pointer relative to the absolute end-of-file boundary by the number of bytes specified in lParam1.
- MMIO_SEEK_IFRAME: A multimedia-specific modifier flag. When combined or evaluated, it forces the I/O procedure to align the final seek target with the nearest preceding keyframe (I-frame) to ensure digital video decompression pipelines can resume rendering cleanly without artifact distortion.
Return Value
- rc (ULONG)
- Returns structural positioning or error states:
- Greater than or equal to 0: Successful completion; returns the brand-new absolute byte position offset calculated from the beginning of the file.
- MMIO_ERROR: The seek request failed (e.g., trying to seek beyond physical file system bounds or hardware limits).
Remarks
- **Seek Pointer Maintenance**: The I/O procedure must strictly record the resolved absolute offset inside the `lDiskOffset` field of the MMIOINFO structure. This alignment ensures that subsequent automated calls to sequential streams (such as MMIOM_READ or MMIOM_WRITE) execute from the intended media coordinates.
- **Keyframe Constraints**: In compressed motion video codecs (such as MPEG or early AVI variants), random byte seeking can cause rendering issues if it lands on a predicted delta-frame (P-frame or B-frame). The inclusion of `MMIO_SEEK_IFRAME` delegates the responsibility to the I/O procedure to calculate the backward temporal boundary jump to the closest valid reference keyframe.