BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJSIP Reference

pj::VidDevManager Class Reference

#include <media.hpp>

Public Member Functions

void refreshDevs () PJSUA2_THROW(Error)
 
unsigned getDevCount ()
 
VideoDevInfo getDevInfo (int dev_id) const PJSUA2_THROW(Error)
 
const VideoDevInfoVectorenumDev () PJSUA2_THROW(Error)
 
VideoDevInfoVector2 enumDev2 () const PJSUA2_THROW(Error)
 
int lookupDev (const string &drv_name, const string &dev_name) const PJSUA2_THROW(Error)
 
string capName (pjmedia_vid_dev_cap cap) const
 
void setFormat (int dev_id, const MediaFormatVideo &format, bool keep) PJSUA2_THROW(Error)
 
MediaFormatVideo getFormat (int dev_id) const PJSUA2_THROW(Error)
 
void setInputScale (int dev_id, const MediaSize &scale, bool keep) PJSUA2_THROW(Error)
 
MediaSize getInputScale (int dev_id) const PJSUA2_THROW(Error)
 
void setOutputWindowFlags (int dev_id, int flags, bool keep) PJSUA2_THROW(Error)
 
int getOutputWindowFlags (int dev_id) PJSUA2_THROW(Error)
 
void switchDev (int dev_id, const VideoSwitchParam &param) PJSUA2_THROW(Error)
 
bool isCaptureActive (int dev_id) const
 
void setCaptureOrient (pjmedia_vid_dev_index dev_id, pjmedia_orient orient, bool keep=true) PJSUA2_THROW(Error)
 

Friends

class Endpoint
 

Detailed Description

Video device manager.

Member Function Documentation

◆ refreshDevs()

void pj::VidDevManager::refreshDevs ( )

Refresh the list of video devices installed in the system. This function will only refresh the list of video device so all active video streams will be unaffected. After refreshing the device list, application MUST make sure to update all index references to video devices (i.e. all variables of type pjmedia_vid_dev_index) before calling any function that accepts video device index as its parameter.

◆ getDevCount()

unsigned pj::VidDevManager::getDevCount ( )

Get the number of video devices installed in the system.

Returns
The number of devices.

◆ getDevInfo()

VideoDevInfo pj::VidDevManager::getDevInfo ( int  dev_id) const

Retrieve the video device info for the specified device index.

Parameters
dev_idThe video device id
Returns
The list of video device info

◆ enumDev()

const VideoDevInfoVector& pj::VidDevManager::enumDev ( )

Warning: deprecated, use enumDev2() instead. This function is not safe in multithreaded environment.

Enum all video devices installed in the system.

Returns
The list of video device info

◆ enumDev2()

VideoDevInfoVector2 pj::VidDevManager::enumDev2 ( ) const

Enum all video devices installed in the system.

Returns
The list of video device info

◆ lookupDev()

int pj::VidDevManager::lookupDev ( const string &  drv_name,
const string &  dev_name 
) const

Lookup device index based on the driver and device name.

Parameters
drv_nameThe driver name.
dev_nameThe device name.
Returns
The device ID. If the device is not found, Error will be thrown.

◆ capName()

string pj::VidDevManager::capName ( pjmedia_vid_dev_cap  cap) const

Get string info for the specified capability.

Parameters
capThe capability ID.
Returns
Capability name.

◆ setFormat()

void pj::VidDevManager::setFormat ( int  dev_id,
const MediaFormatVideo format,
bool  keep 
)

This will configure video format capability to the video device. If video device is currently active, the method will forward the setting to the video device instance to be applied immediately, if it supports it.

This method is only valid if the device has PJMEDIA_VID_DEV_CAP_FORMAT capability in VideoDevInfo.caps flags, otherwise Error will be thrown.

Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the video device to be used.

Parameters
dev_idThe video device id.
formatThe video format.
keepSpecify whether the setting is to be kept for future use.

◆ getFormat()

MediaFormatVideo pj::VidDevManager::getFormat ( int  dev_id) const

Get the video format capability to the video device. If video device is currently active, the method will forward the request to the video device. If video device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.

This method is only valid if the device has PJMEDIA_VID_DEV_CAP_FORMAT capability in VideoDevInfo.caps flags, otherwise Error will be thrown.

Parameters
dev_idThe video device id.
Returns
keep The video format.

◆ setInputScale()

void pj::VidDevManager::setInputScale ( int  dev_id,
const MediaSize scale,
bool  keep 
)

This will configure video format capability to the video device. If video device is currently active, the method will forward the setting to the video device instance to be applied immediately, if it supports it.

This method is only valid if the device has PJMEDIA_VID_DEV_CAP_INPUT_SCALE capability in VideoDevInfo.caps flags, otherwise Error will be thrown.

Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the video device to be used.

Parameters
dev_idThe video device id.
scaleThe video scale.
keepSpecify whether the setting is to be kept for future use.

◆ getInputScale()

MediaSize pj::VidDevManager::getInputScale ( int  dev_id) const

Get the video input scale capability to the video device. If video device is currently active, the method will forward the request to the video device. If video device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.

This method is only valid if the device has PJMEDIA_VID_DEV_CAP_FORMAT capability in VideoDevInfo.caps flags, otherwise Error will be thrown.

Parameters
dev_idThe video device id.
Returns
keep The video format.

◆ setOutputWindowFlags()

void pj::VidDevManager::setOutputWindowFlags ( int  dev_id,
int  flags,
bool  keep 
)

This will configure fast switching to another video device. If video device is currently active, the method will forward the setting to the video device instance to be applied immediately, if it supports it.

This method is only valid if the device has PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS capability in VideoDevInfo.caps flags, otherwise Error will be thrown.

Note that in case the setting is kept for future use, it will be applied to any devices, even when application has changed the video device to be used.

Parameters
dev_idThe video device id.
flagsThe video window flag.
keepSpecify whether the setting is to be kept for future use.

◆ getOutputWindowFlags()

int pj::VidDevManager::getOutputWindowFlags ( int  dev_id)

Get the window output flags capability to the video device. If video device is currently active, the method will forward the request to the video device. If video device is currently inactive, and if application had previously set the setting and mark the setting as kept, then that setting will be returned. Otherwise, this method will raise error.

This method is only valid if the device has PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS capability in VideoDevInfo.caps flags, otherwise Error will be thrown.

Parameters
dev_idThe video device id.
Returns
keep The video format.

◆ switchDev()

void pj::VidDevManager::switchDev ( int  dev_id,
const VideoSwitchParam param 
)

This will configure fast switching to another video device. If video device is currently active, the method will forward the setting to the video device instance to be applied immediately, if it supports it.

This method is only valid if the device has PJMEDIA_VID_DEV_CAP_SWITCH capability in VideoDevInfo.caps flags, otherwise Error will be thrown.

Parameters
dev_idThe video device id.
paramThe video switch param.

◆ isCaptureActive()

bool pj::VidDevManager::isCaptureActive ( int  dev_id) const

Check whether the video capture device is currently active, i.e. if a video preview has been started or there is a video call using the device.

Parameters
dev_idThe video device id
Returns
True if it's active.

◆ setCaptureOrient()

void pj::VidDevManager::setCaptureOrient ( pjmedia_vid_dev_index  dev_id,
pjmedia_orient  orient,
bool  keep = true 
)

This will configure video orientation of the video capture device. If the device is currently active (i.e. if there is a video call using the device or a video preview has been started), the method will forward the setting to the video device instance to be applied immediately, if it supports it.

The setting will be saved for future opening of the video device, if the "keep" argument is set to true. If the video device is currently inactive, and the "keep" argument is false, this method will throw Error.

Parameters
dev_idThe video device id
orientThe video orientation.
keepSpecify whether the setting is to be kept for future use.

The documentation for this class was generated from the following file:

 


PJSIP Open Source, high performance, small footprint, and very very portable SIP stack
Copyright (C) 2006-2008 Teluu Inc.