Grabber::openDev Method

Opens a video capture device for grabbing.
Syntax:
bool openDev( const VideoCaptureDeviceItem& dev );
bool openDev( const char* dev );
bool openDev( const std::string& devstring );
bool openDev( const std::wstring& devstring );
bool openDev( const int64_t& serial );

Parameter Description
VideoCaptureDeviceItem& dev

Specifies the video device to be opened.

char* dev

Specifies the name of the video capture device to be opened.

devstring

Specifies the name of the video capture device to be opened.

serial

Specifies the serial number of the video capture device to be opened.

Return value:

true, if the device was opened successfully, false, otherwise.

Remarks:

An already opened device will be closed before opening a new one.

openDev is usually one of the first actions on the Grabber. Querying for device capabilities such as the available video formats (Grabber::getAvailableVideoFormats ) is only possible, if a device is open. You can get a VideoCaptureDeviceItem by iterating the list generated by Grabber::getAvailableVideoCaptureDevices.

After opening the device, a video format has to be set to a valid one, using Grabber::setVideoFormat.

Please note that even if you have a device opened with Grabber::openDev, it may become invalid at any time (e.g. if the device is unplugged). A device which has become invalid will not automatically be reopened, if it gets plugged in again. You should rather check whether the device is still valid using Grabber::isDevValid by time and react accordingly.

See also: Grabber, Grabber::closeDev, Grabber::getAvailableVideoCaptureDevices, Grabber::isDevOpen

<< Grabber