WARNING: The online documentation has moved to https://docs.pjsip.org.

Visit the new documentation at https://docs.pjsip.org:

BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJSIP Reference

pj::VidDevManager Class Reference

#include <media.hpp>

Public Member Functions

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

Friends

class Endpoint
 

Detailed Description

Video device manager.

Member Function Documentation

◆ initSubsys()

void pj::VidDevManager::initSubsys ( )
throw (Error
)

Initialize the video device subsystem. This will register all supported video device factories to the video device subsystem.

By default, library will initialize video device subsystem automatically on library initialization, so application will never need to invoke this function. However, when PJSUA_DONT_INIT_VID_DEV_SUBSYS is set to non-zero, application should invoke this function before accessing video device.

◆ refreshDevs()

void pj::VidDevManager::refreshDevs ( )
throw (Error
)

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
throw (Error
)

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 ( )
throw (Error
)

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
throw (Error
)

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
throw (Error
)

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 
)
throw (Error
)

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
throw (Error
)

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 
)
throw (Error
)

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
throw (Error
)

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 
)
throw (Error
)

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)
throw (Error
)

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 
)
throw (Error
)

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 
)
throw (Error
)

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.