MWCapture SDK Linux  3.3.1.LAST_SVN_COMMIT_NUM
Functions
Pro/Eco Capture Family Universal Functions

Functions

HCHANNEL LIBMWCAPTURE_API MWOpenChannel (int nBoardValue, int nChannelIndex)
 Opens capture channel by the rotary number and channel number. More...
 
MW_RESULT LIBMWCAPTURE_API MWGetDeviceTime (HCHANNEL hChannel, LONGLONG *pllTime)
 Gets time value of capture device. More...
 
MW_RESULT LIBMWCAPTURE_API MWSetDeviceTime (HCHANNEL hChannel, LONGLONG llTime)
 Sets time of capture device. More...
 
MW_RESULT LIBMWCAPTURE_API MWRegulateDeviceTime (HCHANNEL hChannel, LONGLONG llTime)
 Adjusts time of capture device. More...
 
HTIMER LIBMWCAPTURE_API MWRegisterTimer (HCHANNEL hChannel, MWHANDLE hEvent)
 Registers a timer event object. More...
 
MW_RESULT LIBMWCAPTURE_API MWUnregisterTimer (HCHANNEL hChannel, HTIMER hTimer)
 Unregisters a timer event object. More...
 
MW_RESULT LIBMWCAPTURE_API MWScheduleTimer (HCHANNEL hChannel, HTIMER hTimer, LONGLONG llExpireTime)
 Schedules timer event objects. More...
 
HNOTIFY LIBMWCAPTURE_API MWRegisterNotify (HCHANNEL hChannel, MWHANDLE hEvent, DWORD dwEnableBits)
 Registers an event notification. More...
 
MW_RESULT LIBMWCAPTURE_API MWUnregisterNotify (HCHANNEL hChannel, HNOTIFY hNotify)
 Unregisters an event notification object. More...
 
MW_RESULT LIBMWCAPTURE_API MWGetNotifyStatus (HCHANNEL hChannel, HNOTIFY hNotify, ULONGLONG *pullStatus)
 Gets current notification status. More...
 
MW_RESULT LIBMWCAPTURE_API MWStartAudioCapture (HCHANNEL hChannel)
 Starts audio capturing of specified channel. More...
 
MW_RESULT LIBMWCAPTURE_API MWStopAudioCapture (HCHANNEL hChannel)
 Stops audio capturing of specified channel. More...
 
MW_RESULT LIBMWCAPTURE_API MWCaptureAudioFrame (HCHANNEL hChannel, MWCAP_AUDIO_CAPTURE_FRAME *pAudioCaptureFrame)
 Captures an audio frame. More...
 
MW_RESULT LIBMWCAPTURE_API MWGetTemperature (HCHANNEL hChannel, unsigned int *pnTemp)
 Gets the temperature of capture card. More...
 

Detailed Description

Function Documentation

MW_RESULT LIBMWCAPTURE_API MWCaptureAudioFrame ( HCHANNEL  hChannel,
MWCAP_AUDIO_CAPTURE_FRAME pAudioCaptureFrame 
)

Captures an audio frame.

Parameters
[in]hChannelChannel handle of opened audio capture
[out]pAudioCaptureFrameReturns an audio frame
Returns
Function return values are as follows
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).

Usage:
Captures audio frames.
Related function(s): MWStartAudioCapture
For LPCM to capture up to 8 channel data, the channel correspondence are 0L, 1L, 2L, 3L, 0R, 1R, 2R, 3R.

MW_RESULT LIBMWCAPTURE_API MWGetDeviceTime ( HCHANNEL  hChannel,
LONGLONG *  pllTime 
)

Gets time value of capture device.

Parameters
[in]hChannelOpened channel handle
[out]pllTimeReturns time value of capture device in 100ns
Returns
Returns MW_RESULT values as follows:
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).
Note
Use the same clock for different channels on the same capture device, which plays an important role in audio and video data synchronization and multichannel data synchronization.

Usage:
Gets device time, uses the same clock for different channels on the same capture device.

1 char path[128];
2 MWGetDevicePath(k,path);
3 HCHANNEL t_channel=MWOpenChannelByPath(path);
4 ...
5 LONGLONG t_time = 0;
6 MWGetDeviceTime(t_channel, &t_time);
7 ...
8 MWCloseChannel(t_channel);
MW_RESULT LIBMWCAPTURE_API MWGetNotifyStatus ( HCHANNEL  hChannel,
HNOTIFY  hNotify,
ULONGLONG *  pullStatus 
)

Gets current notification status.

Parameters
[in]hChannelOpened channel handle
[in]hNotifyHandle of registerred notification event object
[out]pullStatusReturns notification status. The value refers to the note of MWRegisterNotify
Returns
Function return values are as follows
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).

Usage:
The function is used for Pro capture cards to get notification status.
Related function(s): MWRegisterNotify

MW_RESULT LIBMWCAPTURE_API MWGetTemperature ( HCHANNEL  hChannel,
unsigned int *  pnTemp 
)

Gets the temperature of capture card.

Parameters
[in]hChannelOpened channel handle
[out]pnTempCapture card temperature
Returns
Function return values are as follows
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).

Usage:

1 char pDevicePath[128] = {0};
2 mr = MWGetDevicePath(i, pDevicePath);
3 ...
4 HCHANNEL hChannel = MWOpenChannelByPath(pDevicePath);
5 ...
6 Unsigned int t_temp;
7 MWGetTemperature(hChannel ,&t_temp);
8 ...
9 MWCloseChannel(hChannel);
HCHANNEL LIBMWCAPTURE_API MWOpenChannel ( int  nBoardValue,
int  nChannelIndex 
)

Opens capture channel by the rotary number and channel number.

Parameters
[in]nBoardValueRotary number on the capture device, 0 to f
[in]nChannelIndexChannel index, starts from 0
Returns
If the call succeeds, which returns the channel handle; the call fails, which returns the empty value.
Note
If there are 2 devices with the same rotary number, the one with a smaller PCI-e number will be opened.
The same channel can be opened multiple times at the same time, and the handles that open the same channel are independent of each other and do not affect each other.

Usage:

1 MWCAP_CHANNEL_INFO info;
2 MWGetChannelInfoByIndex(0,&info);
3 HCHANNEL t_channel=MWOpenChannel(info.byBoardIndex,info.byChannelIndex);
4 ...
5 MWCloseChannel(t_channel);
HNOTIFY LIBMWCAPTURE_API MWRegisterNotify ( HCHANNEL  hChannel,
MWHANDLE  hEvent,
DWORD  dwEnableBits 
)

Registers an event notification.

Parameters
[in]hChannelOpened channel handle
[in]hEventAn event handle
[in]dwEnableBitsType mask for notifications
Returns
Returns the handle of the notification event object if succeeded, otherwise returns NULL.
Note
dwEnableBits can be set to one or more of the following notification types.
MWCAP_NOTIFY_xx
When the notification type you set occurs, the event associated with the notification event object will be set to the signaled state.

Usage:
The API is used to trigger Pro capture cards to capture video clips by notification type.

1 char path[128];
2 MWGetDevicePath(k,path);
3 HCHANNEL t_channel=MWOpenChannelByPath(path);
4 ...
5 MWCAP_PTR hNotifyEvent = MWCreateEvent();
6 MWCAP_PTR hCaptureEvent = MWCreateEvent();
7 MW_RESULT xr;
8 xr = MWStartVideoCapture(t_channel, hCaptureEvent);
9 ...
10 HNOTIFY hNotify = MWRegisterNotify(t_channel, hNotifyEvent, MWCAP_NOTIFY_VIDEO_FRAME_BUFFERED);
11 ...
12 MWWaitEvent(hNotifyEvent, INFINITE);
13 xr = MWGetNotifyStatus(t_channel, hNotify, &ullStatusBits);
14 MWCAP_VIDEO_BUFFER_INFO videoBufferInfo;
15 xr = MWGetVideoBufferInfo(t_channel, &videoBufferInfo);
16 MWCAP_VIDEO_FRAME_INFO videoFrameInfo;
17 xr = MWGetVideoFrameInfo(t_channel, videoBufferInfo.iNewestBufferedFullFrame, &videoFrameInfo);
18 xr = MWCaptureVideoFrameToVirtualAddress(t_channel, -1, (LPBYTE)bitmapData.Scan0, bitmapData.Stride * cy, bitmapData.Stride, bBottomUp, NULL, MWFOURCC_BGRA, cx, cy);
19 MWWaitEvent(hCaptureEvent, INFINITE);
20 MWCAP_VIDEO_CAPTURE_STATUS captureStatus;
21 xr = MWGetVideoCaptureStatus(t_channel, &captureStatus);
22 ...
23 xr = MWUnregisterNotify(t_channel, hNotify);
24 xr = MWStopVideoCapture(t_channel);
25 ...
26 MWCloseChannel(t_channel);
HTIMER LIBMWCAPTURE_API MWRegisterTimer ( HCHANNEL  hChannel,
MWHANDLE  hEvent 
)

Registers a timer event object.

Parameters
[in]hChannelOpened channel handle
[in]hEventEvent handle
Returns
Returns timer handle if succeeded, otherwise returns 0
MW_RESULT LIBMWCAPTURE_API MWRegulateDeviceTime ( HCHANNEL  hChannel,
LONGLONG  llTime 
)

Adjusts time of capture device.

Parameters
[in]hChannelOpened channel handle
[in]llTimeAdjusted time in 100ns.
Returns
Function return values are as follows
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).
Note
Synchronizes clocks of different devices.
The difference between this API and MWSetDeviceTime is that the clock value of the capture device will calibrate to the set value in a gradual manner instead of a sudden change for this API. The clock value of the capture device becomes the set time value immediately after MWSetDeviceTime.

Usage:
Adjusts device time.

1 char path[128];
2 MWGetDevicePath(k,path);
3 HCHANNEL t_channel=MWOpenChannelByPath(path);
4 ...
5 LONGLONG llStandardTime = 0LL;
6 xr = MWRegulateDeviceTime(t_channel, llStandardTime);
7 ...
8 MWCloseChannel(t_channel);
MW_RESULT LIBMWCAPTURE_API MWScheduleTimer ( HCHANNEL  hChannel,
HTIMER  hTimer,
LONGLONG  llExpireTime 
)

Schedules timer event objects.

Parameters
[in]hChannelOpened channel handle
[in]hTimerScheduled timer event objects
[in]llExpireTimeSets the time value of the scheduled timer event, which is the absolute value of the capture device's clock.
Returns
Function return values are as follows
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).
Note
When the scheduled time is reached, the event associated with the timer event object will be set to be the signaled state.

Usage:
The API is used for pro capture cards to set the time when the timer event object is triggered.
Related function(s): MWRegisterTimer

MW_RESULT LIBMWCAPTURE_API MWSetDeviceTime ( HCHANNEL  hChannel,
LONGLONG  llTime 
)

Sets time of capture device.

Parameters
[in]hChannelOpened channel handle
[in]llTimeSets the time value of the capture device clock, which is in 100 nanoseconds
Returns
Function return values are as follows
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).
Note
Synchronizes clocks of different devices.

Usage:
Sets the clock of capture device.

1 char path[128];
2 MWGetDevicePath(k,path);
3 HCHANNEL t_channel=MWOpenChannelByPath(path);
4 ...
5 LONGLONG t_time = 0;
6 t_time=...;
7 ...
8 MWSetDeviceTime(t_channel, t_time);
9 ...
10 MWCloseChannel(t_channel);
MW_RESULT LIBMWCAPTURE_API MWStartAudioCapture ( HCHANNEL  hChannel)

Starts audio capturing of specified channel.

Parameters
[in]hChannelOpened channel handle
Returns
Function return values are as follows
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).

Usage:
Starts audio capturing of specified channel.

1 char path[128];
2 MWGetDevicePath(k,path);
3 HCHANNEL t_channel=MWOpenChannelByPath(path);
4 ...
5 MWCAP_PTR hEvent = MWCreateEvent();
6 HNOTIFY hNotify=MWRegisterNotify(t_channel, hEvent, MWCAP_NOTIFY_AUDIO_SIGNAL_CHANGE | MWCAP_NOTIFY_AUDIO_FRAME_BUFFERED);
7 ...
8 xr = MWStartAudioCapture(t_channel);
9 ...
10 MWWaitEvent(hEvent, INFINITE);
11 ULONGLONG ullStatusBits = 0LL;
12 MWGetNotifyStatus(t_channel, hNotify, &ullStatusBits);
13 if (ullStatusBits & MWCAP_NOTIFY_AUDIO_FRAME_BUFFERED) {
14  MWCAP_AUDIO_CAPTURE_FRAME audioFrame;
15  xr = MWCaptureAudioFrame(t_channel, &audioFrame);
16  ...
17 }
18 ...
19 xr = MWUnregisterNotify(t_channel, hNotify);
20 xr = MWStopVideoCapture(t_channel);
21 ...
22 MWCloseChannel(t_channel);
MW_RESULT LIBMWCAPTURE_API MWStopAudioCapture ( HCHANNEL  hChannel)

Stops audio capturing of specified channel.

Parameters
[in]hChannelchannel handle of opened audio capture
Returns
Function return values are as follows
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).

Usage:
Stops audio capturing of specified channel.
The API is used together with MWStartAudioCapture.

MW_RESULT LIBMWCAPTURE_API MWUnregisterNotify ( HCHANNEL  hChannel,
HNOTIFY  hNotify 
)

Unregisters an event notification object.

Parameters
[in]hChannelChannel handle
[in]hNotifyEvent notification handle
Returns
Function return values are as follows
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).

Usage:
The API is used for Pro capture cards to unregister event.
Related function(s): MWRegisterNotify

MW_RESULT LIBMWCAPTURE_API MWUnregisterTimer ( HCHANNEL  hChannel,
HTIMER  hTimer 
)

Unregisters a timer event object.

Parameters
[in]hChannelOpened channel handle
[in]hTimerHandle of timer event object that has been registered
Returns
Returns MW_RESULT, the values are as follows
MW_SUCCEEDED Function call succeeded.
MW_FAILED Function call failed.
MW_INVALID_PARAMS Input invalid value(s).

Usage:
The API is used for pro capture cards that specify the capture interval between adjacent video frames.
Related function(s): MWRegisterTimer(HCHANNEL hChannel, HANDLE hEvent)