videoStreamInit(3mms) — Subroutines
Name
videoStreamInit --- Initialize a video device channel for streaming
Syntax
#include <mme/mme_api.h>
MMRESULT videoStreamInit(HVIDEO hVideo,
DWORD dwMicroSecPerFrame,
void (∗dwCallback) (),
DWORD dwCallbackInstance,
DWORD dwFlags);
Arguments
HVIDEO hVideo
Specifies a handle to a video device channel.
DWORD dwMicroSecPerFrame
Specifies the number of microseconds between frames.
void (∗dwCallback) ()
Specifies the address of a callback function called during video streaming. The callback function processes messages related to the progress of video streaming.
DWORD dwCallbackInstance
Specifies user instance data passed to the callback function.
DWORD dwFlags
Specifies flags for opening the device channel. The dwCallback function is required for the VIDEO_IN and VIDEO_OUT channels. Thus, dwFlags is required to contain CALLBACK_FUNCTION. The following flag is defined:
CALLBACK_FUNCTION
If this flag is specified, the dwCallback argument is a callback procedure address.
Description
The videoStreamInit function initializes a video device channel for streaming. An application must specify a callback function in a call to the videoStreamInit function in order to be notified about the state of the video capture or playback buffers. The dwFlags field in the VIDEOHDR data structure is not dynamically updated as the buffer is processed.
Callback
void CALLBACK videoCallbackFunction(HVIDEO hVideo,
DWORD wMsg,
DWORD dwInstance,
LPARAM lParam1,
LPARAM lParam2);
The videoCallbackFunction function is a placeholder for the function name supplied by the application.
Callback Arguments
HVIDEO hVideo
Specifies a handle to a video device channel associated with the callback function.
DWORD wMsg
Specifies the video streaming message. The following messages are defined:
MM_DRVM_OPEN
Sent when the device channel is initialized using the videoStreamInit function.
MM_DRVM_CLOSE
Sent when streaming is terminated using the videoStreamFini function.
MM_DRVM_DATA
Sent when a buffer of image data is available.
MM_DRVM_ERROR
Sent when an error occurs.
DWORD dwInstance
Specifies the user instance data specified with the videoStreamInit function.
LPARAM lParam1
Specifies an argument for the message and is only valid while the callback function is executing.
For the MM_DRVM_OPEN, MM_DRVM_CLOSE, and MM_DRVM_ERROR messages, this argument is not used. For the MM_DRVM_DATA message, this argument specifies a pointer to a VIDEOHDR data structure identifying the completed data block. The VIDEOHDR data structure address is only valid while the callback function is executing; the address of the VIDEOHDR data structure will not be the same as the address of the VIDEOHDR data structure passed into the videoStreamAddBuffer function. The contents of the VIDEOHDR data structure will be modified to reflect the result of the operation.
LPARAM lParam2
Specifies an argument for the message. This argument is not used.
Extensions
None.
Return Values
Returns DV_ERR_OK if the function is successful; otherwise, it returns one of the following error codes:
DV_ERR_ALLOCATED@T{ The specified resource is already allocated. T} DV_ERR_INVALHANDLE@T{ The specified device handle is invalid. T} DV_ERR_NOMEM@T{ Unable to allocate or lock memory. T} DV_ERR_PARAM1@T{ The specified callback function is invalid. Callbacks are required. T}