Group PJSUA2_MED
- group PJSUA2_MED
Typedefs
-
typedef std::vector<MediaFormatAudio> MediaFormatAudioVector
Array of MediaFormatAudio
-
typedef std::vector<MediaFormatVideo> MediaFormatVideoVector
Array of MediaFormatVideo
-
typedef void *MediaPort
Media port, corresponds to pjmedia_port
-
typedef std::vector<AudioMedia*> AudioMediaVector
Warning: deprecated, use AudioMediaVector2 instead.
Array of Audio Media.
-
typedef std::vector<ToneDesc> ToneDescVector
Array of tone descriptor.
-
typedef std::vector<ToneDigit> ToneDigitVector
Array of tone digits.
-
typedef std::vector<ToneDigitMapDigit> ToneDigitMapVector
Tone digit map
-
typedef std::vector<AudioDevInfo*> AudioDevInfoVector
Warning: deprecated, use AudioDevInfoVector2 instead.
Array of audio device info.
-
typedef std::vector<AudioDevInfo> AudioDevInfoVector2
Array of audio device info
-
typedef std::vector<VideoDevInfo*> VideoDevInfoVector
Warning: deprecated, use VideoDevInfoVector2 instead.
Array of video device info.
-
typedef std::vector<VideoDevInfo> VideoDevInfoVector2
Array of video device info
-
typedef std::vector<CodecInfo*> CodecInfoVector
Warning: deprecated, use CodecInfoVector2 instead.
Array of codec info.
-
typedef std::vector<CodecInfo> CodecInfoVector2
Array of codec info
-
struct MediaFormat
- #include <media.hpp>
This structure contains all the information needed to completely describe a media.
Subclassed by pj::MediaFormatAudio, pj::MediaFormatVideo
Public Functions
-
inline MediaFormat()
Default constructor
Public Members
-
pj_uint32_t id
The format id that specifies the audio sample or video pixel format. Some well known formats ids are declared in pjmedia_format_id enumeration.
See also
-
pjmedia_type type
The top-most type of the media, as an information.
-
inline MediaFormat()
-
struct MediaFormatAudio : public pj::MediaFormat
- #include <media.hpp>
This structure describe detail information about an audio media.
Public Functions
-
void fromPj(const pjmedia_format &format)
Construct from pjmedia_format.
-
pjmedia_format toPj() const
Export to pjmedia_format.
-
inline MediaFormatAudio()
Default constructor
-
void init(pj_uint32_t formatId, unsigned clockRate, unsigned channelCount, int frameTimeUsec, int bitsPerSample, pj_uint32_t avgBps = 0, pj_uint32_t maxBps = 0)
Initialization
Public Members
-
unsigned clockRate
Audio clock rate in samples or Hz.
-
unsigned channelCount
Number of channels.
-
unsigned frameTimeUsec
Frame interval, in microseconds.
-
unsigned bitsPerSample
Number of bits per sample.
-
pj_uint32_t avgBps
Average bitrate
-
pj_uint32_t maxBps
Maximum bitrate
-
void fromPj(const pjmedia_format &format)
-
struct MediaFormatVideo : public pj::MediaFormat
- #include <media.hpp>
This structure describe detail information about an video media.
Public Functions
-
void fromPj(const pjmedia_format &format)
Construct from pjmedia_format.
-
pjmedia_format toPj() const
Export to pjmedia_format.
-
inline MediaFormatVideo()
Default constructor
-
void init(pj_uint32_t formatId, unsigned width, unsigned height, int fpsNum, int fpsDenum = 1, pj_uint32_t avgBps = 0, pj_uint32_t maxBps = 0)
Initialization
Public Members
-
unsigned width
Video width.
-
unsigned height
Video height.
-
int fpsNum
Frames per second numerator.
-
int fpsDenum
Frames per second denumerator.
-
pj_uint32_t avgBps
Average bitrate.
-
pj_uint32_t maxBps
Maximum bitrate.
-
void fromPj(const pjmedia_format &format)
-
struct ConfPortInfo
- #include <media.hpp>
This structure descibes information about a particular media port that has been registered into the conference bridge.
Public Functions
-
void fromPj(const pjsua_conf_port_info &port_info)
Construct from pjsua_conf_port_info.
Public Members
-
int portId
Conference port number.
-
string name
Port name.
-
MediaFormatAudio format
Media audio format information
-
float txLevelAdj
Tx level adjustment. Value 1.0 means no adjustment, value 0 means the port is muted, value 2.0 means the level is amplified two times.
-
float rxLevelAdj
Rx level adjustment. Value 1.0 means no adjustment, value 0 means the port is muted, value 2.0 means the level is amplified two times.
-
void fromPj(const pjsua_conf_port_info &port_info)
-
class Media
- #include <media.hpp>
Subclassed by pj::AudioMedia, pj::VideoMedia
Public Functions
-
virtual ~Media()
Virtual destructor.
-
pjmedia_type getType() const
Get type of the media.
- Returns:
The media type.
-
virtual ~Media()
-
struct AudioMediaTransmitParam
- #include <media.hpp>
Parameters for AudioMedia::startTransmit2() method.
Public Functions
-
AudioMediaTransmitParam()
Default constructor
Public Members
-
float level
Signal level adjustment. Value 1.0 means no level adjustment, while value 0 means to mute the port.
Default: 1.0
-
AudioMediaTransmitParam()
-
class AudioMedia : public pj::Media
- #include <media.hpp>
Audio Media. This is a lite wrapper class for audio conference bridge port, i.e: this class only maintains one data member, conference slot ID, and the methods are simply proxies for conference bridge operations.
Application can create a derived class and use registerMediaPort2()/ unregisterMediaPort() to register/unregister a media port to/from the conference bridge.
The library will not keep a list of AudioMedia instances, so any AudioMedia (descendant) instances instantiated by application must be maintained and destroyed by the application itself.
Note that any PJSUA2 APIs that return AudioMedia instance(s) such as Endpoint::mediaEnumPorts2() or Call::getAudioMedia() will just return generated copy. All AudioMedia methods should work normally on this generated copy instance.
Subclassed by pj::AudioMediaPlayer, pj::AudioMediaPort, pj::AudioMediaRecorder, pj::ExtraAudioDevice, pj::ToneGenerator
Public Functions
-
ConfPortInfo getPortInfo() const
Get information about the specified conference port.
-
int getPortId() const
Get port Id.
-
void startTransmit(const AudioMedia &sink) const
Establish unidirectional media flow to sink. This media port will act as a source, and it may transmit to multiple destinations/sink. And if multiple sources are transmitting to the same sink, the media will be mixed together. Source and sink may refer to the same Media, effectively looping the media.
If bidirectional media flow is desired, application needs to call this method twice, with the second one called from the opposite source media.
- Parameters:
sink – The destination Media.
-
void startTransmit2(const AudioMedia &sink, const AudioMediaTransmitParam ¶m) const
Establish unidirectional media flow to sink. This media port will act as a source, and it may transmit to multiple destinations/sink. And if multiple sources are transmitting to the same sink, the media will be mixed together. Source and sink may refer to the same Media, effectively looping the media.
Signal level from this source to the sink can be adjusted by making it louder or quieter via the parameter param. The level adjustment will apply to a specific connection only (i.e. only for signal from this source to the sink), as compared to adjustTxLevel()/adjustRxLevel() which applies to all signals from/to this media port. The signal adjustment will be cumulative, in this following order: signal from this source will be adjusted with the level specified in adjustTxLevel(), then with the level specified via this API, and finally with the level specified to the sink’s adjustRxLevel().
If bidirectional media flow is desired, application needs to call this method twice, with the second one called from the opposite source media.
- Parameters:
sink – The destination Media.
param – The parameter.
-
void stopTransmit(const AudioMedia &sink) const
Stop media flow to destination/sink port.
- Parameters:
sink – The destination media.
-
void adjustRxLevel(float level)
Adjust the signal level to be transmitted from the bridge to this media port by making it louder or quieter.
- Parameters:
level – Signal level adjustment. Value 1.0 means no level adjustment, while value 0 means to mute the port.
-
void adjustTxLevel(float level)
Adjust the signal level to be received from this media port (to the bridge) by making it louder or quieter.
- Parameters:
level – Signal level adjustment. Value 1.0 means no level adjustment, while value 0 means to mute the port.
-
unsigned getRxLevel() const
Get the last received signal level.
- Returns:
Signal level in percent.
-
unsigned getTxLevel() const
Get the last transmitted signal level.
- Returns:
Signal level in percent.
-
AudioMedia()
Default Constructor.
Normally application will not create AudioMedia object directly, but it instantiates an AudioMedia derived class. This is set as public because some STL vector implementations require it.
-
virtual ~AudioMedia()
Virtual Destructor.
Public Static Functions
-
static ConfPortInfo getPortInfoFromId(int port_id)
Get information from specific port id.
-
static AudioMedia *typecastFromMedia(Media *media)
Warning: deprecated and will be removed in future release.
Typecast from base class Media. This is useful for application written in language that does not support downcasting such as Python.
- Parameters:
media – The object to be downcasted
- Returns:
The object as AudioMedia instance
-
ConfPortInfo getPortInfo() const
-
struct MediaFrame
- #include <media.hpp>
This structure describes a media frame.
Public Functions
-
inline MediaFrame()
Default constructor
Public Members
-
pjmedia_frame_type type
Frame type.
-
ByteVector buf
Frame buffer content.
-
unsigned size
Frame size in bytes.
-
inline MediaFrame()
-
class AudioMediaPort : public pj::AudioMedia
- #include <media.hpp>
Audio Media Port.
Public Functions
-
AudioMediaPort()
Constructor.
-
virtual ~AudioMediaPort()
Destructor. This will unregister the audio media port from the conference bridge.
-
void createPort(const string &name, MediaFormatAudio &fmt)
Create an audio media port and register it to the conference bridge.
- Parameters:
name – The port name.
fmt – The audio format.
-
inline virtual void onFrameRequested(MediaFrame &frame)
This callback is called to request a frame from this port. On input, frame.size indicates the capacity of the frame buffer and frame.buf will initially be an empty vector. Application can then set the frame type and fill the vector.
- Parameters:
frame – The frame.
-
inline virtual void onFrameReceived(MediaFrame &frame)
This callback is called when this port receives a frame. The frame content will be provided in frame.buf vector, and the frame size can be found in either frame.size or the vector’s size (both have the same value).
- Parameters:
frame – The frame.
-
AudioMediaPort()
-
struct AudioMediaPlayerInfo
- #include <media.hpp>
This structure contains additional info about AudioMediaPlayer.
Public Functions
-
inline AudioMediaPlayerInfo()
Default constructor
Public Members
-
pjmedia_format_id formatId
Format ID of the payload.
-
unsigned payloadBitsPerSample
The number of bits per sample of the file payload. For example, the value is 16 for PCM WAV and 8 for Alaw/Ulas WAV files.
-
pj_uint32_t sizeBytes
The WAV payload size in bytes.
-
pj_uint32_t sizeSamples
The WAV payload size in samples.
-
inline AudioMediaPlayerInfo()
-
class AudioMediaPlayer : public pj::AudioMedia
- #include <media.hpp>
Audio Media Player.
Public Functions
-
AudioMediaPlayer()
Constructor.
-
void createPlayer(const string &file_name, unsigned options = 0)
Create a file player, and automatically add this player to the conference bridge.
- Parameters:
file_name – The filename to be played. Currently only WAV files are supported, and the WAV file MUST be formatted as 16bit PCM mono/single channel (any clock rate is supported).
options – Optional option flag. Application may specify PJMEDIA_FILE_NO_LOOP to prevent playback loop.
-
void createPlaylist(const StringVector &file_names, const string &label = "", unsigned options = 0)
Create a file playlist media port, and automatically add the port to the conference bridge.
- Parameters:
file_names – Array of file names to be added to the play list. Note that the files must have the same clock rate, number of channels, and number of bits per sample.
label – Optional label to be set for the media port.
options – Optional option flag. Application may specify PJMEDIA_FILE_NO_LOOP to prevent looping.
-
AudioMediaPlayerInfo getInfo() const
Get additional info about the player. This operation is only valid for player. For playlist, Error will be thrown.
- Returns:
the info.
-
pj_uint32_t getPos() const
Get current playback position in samples. This operation is not valid for playlist.
- Returns:
Current playback position, in samples.
-
void setPos(pj_uint32_t samples)
Set playback position in samples. This operation is not valid for playlist.
- Parameters:
samples – The desired playback position, in samples.
-
virtual ~AudioMediaPlayer()
Destructor. This will unregister the player port from the conference bridge.
-
inline virtual void onEof2()
Register a callback to be called when the file player reading has reached the end of file, or when the file reading has reached the end of file of the last file for a playlist. If the file or playlist is set to play repeatedly, then the callback will be called multiple times.
If application wishes to stop the playback, it can stop the media transmission in the callback, and only after all transmissions have been stopped, could the application safely destroy the player.
Public Static Functions
-
static AudioMediaPlayer *typecastFromAudioMedia(AudioMedia *media)
Warning: deprecated and will be removed in future release.
Typecast from base class AudioMedia. This is useful for application written in language that does not support downcasting such as Python.
- Parameters:
media – The object to be downcasted
- Returns:
The object as AudioMediaPlayer instance
-
AudioMediaPlayer()
-
class AudioMediaRecorder : public pj::AudioMedia
- #include <media.hpp>
Audio Media Recorder.
Public Functions
-
AudioMediaRecorder()
Constructor.
-
void createRecorder(const string &file_name, unsigned enc_type = 0, long max_size = 0, unsigned options = 0)
Create a file recorder, and automatically connect this recorder to the conference bridge. The recorder currently supports recording WAV file. The type of the recorder to use is determined by the extension of the file (e.g. “.wav”).
- Parameters:
file_name – Output file name. The function will determine the default format to be used based on the file extension. Currently “.wav” is supported on all platforms.
enc_type – Optionally specify the type of encoder to be used to compress the media, if the file can support different encodings. This value must be zero for now.
max_size – Maximum file size. Specify zero or -1 to remove size limitation. This value must be zero or -1 for now.
options – Optional options, which can be used to specify the recording file format. Supported options are PJMEDIA_FILE_WRITE_PCM, PJMEDIA_FILE_WRITE_ALAW, and PJMEDIA_FILE_WRITE_ULAW. Default is zero or PJMEDIA_FILE_WRITE_PCM.
-
virtual ~AudioMediaRecorder()
Destructor. This will unregister the recorder port from the conference bridge.
Public Static Functions
-
static AudioMediaRecorder *typecastFromAudioMedia(AudioMedia *media)
Warning: deprecated and will be removed in future release.
Typecast from base class AudioMedia. This is useful for application written in language that does not support downcasting such as Python.
- Parameters:
media – The object to be downcasted
- Returns:
The object as AudioMediaRecorder instance
-
AudioMediaRecorder()
-
class ToneDesc : public pjmedia_tone_desc
- #include <media.hpp>
Tone descriptor (abstraction for pjmedia_tone_desc)
-
class ToneDigit : public pjmedia_tone_digit
- #include <media.hpp>
Tone digit (abstraction for pjmedia_tone_digit)
-
struct ToneDigitMapDigit
- #include <media.hpp>
A digit in tone digit map
-
class ToneGenerator : public pj::AudioMedia
- #include <media.hpp>
Tone generator.
Public Functions
-
ToneGenerator()
Constructor.
-
~ToneGenerator()
Destructor. This will unregister the tone generator port from the conference bridge.
-
void createToneGenerator(unsigned clock_rate = 16000, unsigned channel_count = 1)
Create tone generator and register the port to the conference bridge.
-
bool isBusy() const
Check if the tone generator is still busy producing some tones.
- Returns:
Non-zero if busy.
-
void stop()
Instruct the tone generator to stop current processing.
-
void rewind()
Rewind the playback. This will start the playback to the first tone in the playback list.
-
void play(const ToneDescVector &tones, bool loop = false)
Instruct the tone generator to play single or dual frequency tones with the specified duration. The new tones will be appended to currently playing tones, unless stop() is called before calling this function. The playback will begin as soon as the tone generator is connected to other media.
- Parameters:
tones – Array of tones to be played.
loop – Play the tone in a loop.
-
void playDigits(const ToneDigitVector &digits, bool loop = false)
Instruct the tone generator to play multiple MF digits with each of the digits having individual ON/OFF duration. Each of the digit in the digit array must have the corresponding descriptor in the digit map. The new tones will be appended to currently playing tones, unless stop() is called before calling this function. The playback will begin as soon as the tone generator is connected to a sink media.
- Parameters:
digits – Array of MF digits.
loop – Play the tone in a loop.
-
ToneDigitMapVector getDigitMap() const
Get the digit-map currently used by this tone generator.
- Returns:
The digitmap currently used by the tone generator
-
void setDigitMap(const ToneDigitMapVector &digit_map)
Set digit map to be used by the tone generator.
- Parameters:
digit_map – Digitmap to be used by the tone generator.
-
ToneGenerator()
-
struct AudioDevInfo
- #include <media.hpp>
Audio device information structure.
Public Functions
-
void fromPj(const pjmedia_aud_dev_info &dev_info)
Construct from pjmedia_aud_dev_info.
-
~AudioDevInfo()
Destructor.
Public Members
-
pjmedia_aud_dev_index id
The device ID
-
string name
The device name
-
unsigned inputCount
Maximum number of input channels supported by this device. If the value is zero, the device does not support input operation (i.e. it is a playback only device).
-
unsigned outputCount
Maximum number of output channels supported by this device. If the value is zero, the device does not support output operation (i.e. it is an input only device).
-
unsigned defaultSamplesPerSec
Default sampling rate.
-
string driver
The underlying driver name
-
unsigned caps
Device capabilities, as bitmask combination of pjmedia_aud_dev_cap.
-
unsigned routes
Supported audio device routes, as bitmask combination of pjmedia_aud_dev_route. The value may be zero if the device does not support audio routing.
-
MediaFormatAudioVector extFmt
Array of supported extended audio formats
-
void fromPj(const pjmedia_aud_dev_info &dev_info)
-
class AudDevManager
- #include <media.hpp>
Audio device manager.
Public Functions
-
int getCaptureDev() const
Get currently active capture sound devices. If sound devices has not been created, it is possible that the function returns -1 as device IDs.
- Returns:
Device ID of the capture device.
-
AudioMedia &getCaptureDevMedia()
Get the AudioMedia of the capture audio device.
- Returns:
Audio media for the capture device.
-
int getPlaybackDev() const
Get currently active playback sound devices. If sound devices has not been created, it is possible that the function returns -1 as device IDs.
- Returns:
Device ID of the playback device.
-
AudioMedia &getPlaybackDevMedia()
Get the AudioMedia of the speaker/playback audio device.
- Returns:
Audio media for the speaker/playback device.
-
void setCaptureDev(int capture_dev) const
Select or change capture sound device. Application may call this function at any time to replace current sound device. Calling this method will not change the state of the sound device (opened/closed).
- Parameters:
capture_dev – Device ID of the capture device.
-
void setPlaybackDev(int playback_dev) const
Select or change playback sound device. Application may call this function at any time to replace current sound device. Calling this method will not change the state of the sound device (opened/closed).
- Parameters:
playback_dev – Device ID of the playback device.
-
const AudioDevInfoVector &enumDev()
Warning: deprecated, use enumDev2 instead. This function is not safe in multithreaded environment.
Enum all audio devices installed in the system. This function is not safe in multithreaded environment.
- Returns:
The list of audio device info.
-
AudioDevInfoVector2 enumDev2() const
Enum all audio devices installed in the system.
- Returns:
The list of audio device info.
-
void setNullDev()
Set pjsua to use null sound device. The null sound device only provides the timing needed by the conference bridge, and will not interract with any hardware.
-
MediaPort *setNoDev()
Disconnect the main conference bridge from any sound devices, and let application connect the bridge to it’s own sound device/master port.
- Returns:
The port interface of the conference bridge, so that application can connect this to it’s own sound device or master port.
-
void setSndDevMode(unsigned mode) const
Set sound device mode.
Note that this method will open the sound device, using current active IDs set via setCaptureDev() or setPlaybackDev(), if the flag PJSUA_SND_DEV_NO_IMMEDIATE_OPEN is not specified.
- Parameters:
mode – The sound device mode, as bitmask combination of pjsua_snd_dev_mode
-
void setEcOptions(unsigned tail_msec, unsigned options)
Change the echo cancellation settings.
The behavior of this function depends on whether the sound device is currently active, and if it is, whether device or software AEC is being used.
If the sound device is currently active, and if the device supports AEC, this function will forward the change request to the device and it will be up to the device on whether support the request. If software AEC is being used (the software EC will be used if the device does not support AEC), this function will change the software EC settings. In all cases, the setting will be saved for future opening of the sound device.
If the sound device is not currently active, this will only change the default AEC settings and the setting will be applied next time the sound device is opened.
- Parameters:
tail_msec – The tail length, in miliseconds. Set to zero to disable AEC.
options – Options to be passed to pjmedia_echo_create(). Normally the value should be zero.
-
unsigned getEcTail() const
Get current echo canceller tail length.
- Returns:
The EC tail length in milliseconds, If AEC is disabled, the value will be zero.
-
bool sndIsActive() const
Check whether the sound device is currently active. The sound device may be inactive if the application has set the auto close feature to non-zero (the sndAutoCloseTime setting in MediaConfig), or if null sound device or no sound device has been configured via the setNoDev() function.
-
void refreshDevs()
Refresh the list of sound devices installed in the system. This method will only refresh the list of audio device so all active audio streams will be unaffected. After refreshing the device list, application MUST make sure to update all index references to audio devices before calling any method that accepts audio device index as its parameter.
-
unsigned getDevCount() const
Get the number of sound devices installed in the system.
- Returns:
The number of sound devices installed in the system.
-
AudioDevInfo getDevInfo(int id) const
Get device information.
- Parameters:
id – The audio device ID.
- Returns:
The device information which will be filled in by this method once it returns successfully.
-
int lookupDev(const string &drv_name, const string &dev_name) const
Lookup device index based on the driver and device name.
- Parameters:
drv_name – The driver name.
dev_name – The device name.
- Returns:
The device ID. If the device is not found, Error will be thrown.
-
string capName(pjmedia_aud_dev_cap cap) const
Get string info for the specified capability.
- Parameters:
cap – The capability ID.
- Returns:
Capability name.
-
void setExtFormat(const MediaFormatAudio &format, bool keep = true)
This will configure audio format capability (other than PCM) to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_EXT_FORMAT capability in AudioDevInfo.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 sound device to be used.
- Parameters:
format – The audio format.
keep – Specify whether the setting is to be kept for future use.
-
MediaFormatAudio getExtFormat() const
Get the audio format capability (other than PCM) of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_EXT_FORMAT capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio format.
-
void setInputLatency(unsigned latency_msec, bool keep = true)
This will configure audio input latency control or query capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY capability in AudioDevInfo.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 sound device to be used.
- Parameters:
latency_msec – The input latency.
keep – Specify whether the setting is to be kept for future use.
-
unsigned getInputLatency() const
Get the audio input latency control or query capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_INPUT_LATENCY capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio input latency.
-
void setOutputLatency(unsigned latency_msec, bool keep = true)
This will configure audio output latency control or query capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY capability in AudioDevInfo.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 sound device to be used.
- Parameters:
latency_msec – The output latency.
keep – Specify whether the setting is to be kept for future use.
-
unsigned getOutputLatency() const
Get the audio output latency control or query capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_OUTPUT_LATENCY capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio output latency.
-
void setInputVolume(unsigned volume, bool keep = true)
This will configure audio input volume level capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_INPUT_VOLUME_SETTING capability in AudioDevInfo.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 sound device to be used.
- Parameters:
volume – The input volume level, in percent.
keep – Specify whether the setting is to be kept for future use.
-
unsigned getInputVolume() const
Get the audio input volume level capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_INPUT_VOLUME_SETTING capability in AudioDevInfo.caps flags, otherwise Error will be thrown. *
- Returns:
The audio input volume level, in percent.
-
void setOutputVolume(unsigned volume, bool keep = true)
This will configure audio output volume level capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING capability in AudioDevInfo.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 sound device to be used.
- Parameters:
volume – The output volume level, in percent.
keep – Specify whether the setting is to be kept for future use.
-
unsigned getOutputVolume() const
Get the audio output volume level capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_OUTPUT_VOLUME_SETTING capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio output volume level, in percent.
-
unsigned getInputSignal() const
Get the audio input signal level capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_INPUT_SIGNAL_METER capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio input signal level, in percent.
-
unsigned getOutputSignal() const
Get the audio output signal level capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_OUTPUT_SIGNAL_METER capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio output signal level, in percent.
-
void setInputRoute(pjmedia_aud_dev_route route, bool keep = true)
This will configure audio input route capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE capability in AudioDevInfo.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 sound device to be used.
- Parameters:
route – The audio input route.
keep – Specify whether the setting is to be kept for future use.
-
pjmedia_aud_dev_route getInputRoute() const
Get the audio input route capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_INPUT_ROUTE capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio input route.
-
void setOutputRoute(pjmedia_aud_dev_route route, bool keep = true)
This will configure audio output route capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_OUTPUT_ROUTE capability in AudioDevInfo.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 sound device to be used.
- Parameters:
route – The audio output route.
keep – Specify whether the setting is to be kept for future use.
-
pjmedia_aud_dev_route getOutputRoute() const
Get the audio output route capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_OUTPUT_ROUTE capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio output route.
-
void setVad(bool enable, bool keep = true)
This will configure audio voice activity detection capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_VAD capability in AudioDevInfo.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 sound device to be used.
- Parameters:
enable – Enable/disable voice activity detection feature. Set true to enable.
keep – Specify whether the setting is to be kept for future use.
-
bool getVad() const
Get the audio voice activity detection capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_VAD capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio voice activity detection feature.
-
void setCng(bool enable, bool keep = true)
This will configure audio comfort noise generation capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_CNG capability in AudioDevInfo.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 sound device to be used.
- Parameters:
enable – Enable/disable comfort noise generation feature. Set true to enable.
keep – Specify whether the setting is to be kept for future use.
-
bool getCng() const
Get the audio comfort noise generation capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_CNG capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio comfort noise generation feature.
-
void setPlc(bool enable, bool keep = true)
This will configure audio packet loss concealment capability to the sound device being used. If sound device is currently active, the method will forward the setting to the sound device instance to be applied immediately, if it supports it.
This method is only valid if the device has PJMEDIA_AUD_DEV_CAP_PLC capability in AudioDevInfo.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 sound device to be used.
- Parameters:
enable – Enable/disable packet loss concealment feature. Set true to enable.
keep – Specify whether the setting is to be kept for future use.
-
bool getPlc() const
Get the audio packet loss concealment capability of the sound device being used. If sound device is currently active, the method will forward the request to the sound device. If sound 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_AUD_DEV_CAP_PLC capability in AudioDevInfo.caps flags, otherwise Error will be thrown.
- Returns:
The audio packet loss concealment feature.
-
int getCaptureDev() const
-
class ExtraAudioDevice : public pj::AudioMedia
- #include <media.hpp>
Extra audio device. This class allows application to have multiple sound device instances active concurrently.
Application may also use this class to improve media clock. Normally media clock is driven by sound device in master port, but unfortunately some sound devices may produce jittery clock. To improve media clock, application can install Null Sound Device (i.e: using AudDevManager::setNullDev()), which will act as a master port, and install the sound device as extra sound device.
Note that extra sound device will not have auto-close upon idle feature. Also note that the extra sound device only supports mono channel.
Public Functions
-
ExtraAudioDevice(int playdev, int recdev)
Constructor.
- Parameters:
playdev – Playback device ID.
recdev – Record device ID.
-
virtual ~ExtraAudioDevice()
Destructor.
-
void open()
Open the audio device using format (e.g.: clock rate, bit per sample, samples per frame) matched to the conference bridge’s format, except the channel count, which will be set to one (mono channel). This will also register the audio device port to conference bridge.
-
void close()
Close the audio device and unregister the audio device port from the conference bridge.
-
bool isOpened()
Is the extra audio device opened?
- Returns:
‘true’ if it is opened.
-
ExtraAudioDevice(int playdev, int recdev)
-
struct MediaCoordinate
- #include <media.hpp>
Representation of media coordinate.
-
struct MediaSize
- #include <media.hpp>
Representation of media size.
-
struct VidConfPortInfo
- #include <media.hpp>
This structure descibes information about a particular media port that has been registered into the conference bridge.
Public Functions
-
void fromPj(const pjsua_vid_conf_port_info &port_info)
Construct from pjsua_conf_port_info.
Public Members
-
int portId
Conference port number.
-
string name
Port name.
-
MediaFormatVideo format
Media audio format information
-
void fromPj(const pjsua_vid_conf_port_info &port_info)
-
struct VideoMediaTransmitParam
- #include <media.hpp>
Parameters for VideoMedia::startTransmit() method.
-
class VideoMedia : public pj::Media
- #include <media.hpp>
Video Media.
Public Functions
-
VidConfPortInfo getPortInfo() const
Get information about the specified conference port.
-
int getPortId() const
Get port Id.
-
void startTransmit(const VideoMedia &sink, const VideoMediaTransmitParam ¶m) const
Establish unidirectional media flow to sink. This media port will act as a source, and it may transmit to multiple destinations/sink. And if multiple sources are transmitting to the same sink, the media will be mixed together. Source and sink may refer to the same Media, effectively looping the media.
If bidirectional media flow is desired, application needs to call this method twice, with the second one called from the opposite source media.
- Parameters:
sink – The destination Media.
param – The parameter.
-
void stopTransmit(const VideoMedia &sink) const
Stop media flow to destination/sink port.
- Parameters:
sink – The destination media.
-
void update() const
Update or refresh port states from video port info. Some port may change its port info in the middle of a session, for example when a video stream decoder learns that incoming video size or frame rate has changed, video conference needs to be informed to update its internal states.
-
VideoMedia()
Default Constructor.
Normally application will not create VideoMedia object directly, but it instantiates a VideoMedia derived class. This is set as public because some STL vector implementations require it.
-
virtual ~VideoMedia()
Virtual Destructor
Public Static Functions
-
static VidConfPortInfo getPortInfoFromId(int port_id)
Get information from specific port id.
-
VidConfPortInfo getPortInfo() const
-
struct WindowHandle
- #include <media.hpp>
Window handle.
-
struct VideoWindowHandle
- #include <media.hpp>
Video window handle.
Public Members
-
pjmedia_vid_dev_hwnd_type type
The window handle type.
-
WindowHandle handle
The window handle.
-
pjmedia_vid_dev_hwnd_type type
-
struct VideoWindowInfo
- #include <media.hpp>
This structure describes video window info.
Public Members
-
bool isNative
Flag to indicate whether this window is a native window, such as created by built-in preview device. If this field is true, only the video window handle field of this structure is valid.
-
VideoWindowHandle winHandle
Video window handle.
-
int renderDeviceId
Renderer device ID.
-
bool show
Window show status. The window is hidden if false.
-
MediaCoordinate pos
Window position.
-
MediaSize size
Window size.
-
bool isNative
-
class VideoWindow
- #include <media.hpp>
Video window.
Public Functions
-
VideoWindow(int win_id)
Constructor
-
VideoWindowInfo getInfo() const
Get window info.
- Returns:
video window info.
-
VideoMedia getVideoMedia()
Get video media or conference bridge port of the renderer of this video window.
- Returns:
Video media of this renderer window.
-
void Show(bool show)
Show or hide window. This operation is not valid for native windows (VideoWindowInfo.isNative=true), on which native windowing API must be used instead.
- Parameters:
show – Set to true to show the window, false to hide the window.
-
void setPos(const MediaCoordinate &pos)
Set video window position. This operation is not valid for native windows (VideoWindowInfo.isNative=true), on which native windowing API must be used instead.
- Parameters:
pos – The window position.
-
void setSize(const MediaSize &size)
Resize window. This operation is not valid for native windows (VideoWindowInfo.isNative=true), on which native windowing API must be used instead.
- Parameters:
size – The new window size.
-
void rotate(int angle)
Rotate the video window. This function will change the video orientation and also possibly the video window size (width and height get swapped). This operation is not valid for native windows (VideoWindowInfo.isNative =true), on which native windowing API must be used instead.
- Parameters:
angle – The rotation angle in degrees, must be multiple of 90. Specify positive value for clockwise rotation or negative value for counter-clockwise rotation.
-
void setWindow(const VideoWindowHandle &win)
Set output window. This operation is valid only when the underlying video device supports PJMEDIA_VIDEO_DEV_CAP_OUTPUT_WINDOW capability AND allows the output window to be changed on-the-fly, otherwise Error will be thrown. Currently it is only supported on Android.
- Parameters:
win – The new output window.
-
void setFullScreen(bool enabled)
Set video window full-screen. This operation is valid only when the underlying video device supports PJMEDIA_VID_DEV_CAP_OUTPUT_FULLSCREEN capability. Currently it is only supported on SDL backend.
- Parameters:
enabled – Set to true if full screen is desired, false otherwise.
-
void setFullScreen2(pjmedia_vid_dev_fullscreen_flag mode)
Set video window full-screen. This operation is valid only when the underlying video device supports PJMEDIA_VID_DEV_CAP_OUTPUT_FULLSCREEN capability. Currently it is only supported on SDL backend.
- Parameters:
mode – Fullscreen mode, see pjmedia_vid_dev_fullscreen_flag.
-
VideoWindow(int win_id)
-
struct VideoPreviewOpParam
- #include <media.hpp>
This structure contains parameters for VideoPreview::start()
Public Functions
-
VideoPreviewOpParam()
Default constructor initializes with default values.
-
void fromPj(const pjsua_vid_preview_param &prm)
Convert from pjsip
-
pjsua_vid_preview_param toPj() const
Convert to pjsip
Public Members
-
pjmedia_vid_dev_index rendId
Device ID for the video renderer to be used for rendering the capture stream for preview. This parameter is ignored if native preview is being used.
Default: PJMEDIA_VID_DEFAULT_RENDER_DEV
-
bool show
Show window initially.
Default: PJ_TRUE.
-
unsigned windowFlags
Window flags. The value is a bitmask combination of pjmedia_vid_dev_wnd_flag.
Default: 0.
-
MediaFormatVideo format
Media format video. By default, this parameter is uninitialized and will not be used.
To initialize it, use MediaFormatVideo::init(). If left uninitialized, the capture device will be opened using PJMEDIA wrapper default format, e.g:
Android : PJMEDIA_FORMAT_I420 using the first supported size and 15fps
iOS : PJMEDIA_FORMAT_BGRA using size 352x288 and 15fps Note that when the preview is already opened, this setting will be ignored.
-
VideoWindowHandle window
Optional output window to be used to display the video preview. This parameter will only be used if the video device supports PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW capability and the capability is not read-only.
-
VideoPreviewOpParam()
-
class VideoPreview
- #include <media.hpp>
Video Preview
Public Functions
-
VideoPreview(int dev_id)
Constructor
-
bool hasNative()
Determine if the specified video input device has built-in native preview capability. This is a convenience function that is equal to querying device’s capability for PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW capability.
- Returns:
true if it has.
-
void start(const VideoPreviewOpParam ¶m)
Start video preview window for the specified capture device.
- Parameters:
param – Video preview parameters.
-
void stop()
Stop video preview.
-
VideoWindow getVideoWindow()
Get the preview window handle associated with the capture device,if any.
-
VideoMedia getVideoMedia()
Get video media or conference bridge port of the video capture device.
- Returns:
Video media of the video capture device.
-
VideoPreview(int dev_id)
-
struct VideoDevInfo
- #include <media.hpp>
Video device information structure.
Public Functions
-
inline VideoDevInfo()
Default constructor
-
void fromPj(const pjmedia_vid_dev_info &dev_info)
Construct from pjmedia_vid_dev_info.
-
~VideoDevInfo()
Destructor.
Public Members
-
pjmedia_vid_dev_index id
The device ID
-
string name
The device name
-
string driver
The underlying driver name
-
pjmedia_dir dir
The supported direction of the video device, i.e. whether it supports capture only, render only, or both.
-
unsigned caps
Device capabilities, as bitmask combination of pjmedia_vid_dev_cap
-
MediaFormatVideoVector fmt
Array of supported video formats. Some fields in each supported video format may be set to zero or of “unknown” value, to indicate that the value is unknown or should be ignored. When these value are not set to zero, it indicates that the exact format combination is being used.
-
inline VideoDevInfo()
-
struct VideoSwitchParam
- #include <media.hpp>
Parameter for switching device with PJMEDIA_VID_DEV_CAP_SWITCH capability.
Public Members
-
pjmedia_vid_dev_index target_id
Target device ID to switch to. Once the switching is successful, the video stream will use this device and the old device will be closed.
-
pjmedia_vid_dev_index target_id
-
class VidDevManager
- #include <media.hpp>
Video device manager.
Public Functions
-
void initSubsys()
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.
-
void 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.
-
unsigned getDevCount()
Get the number of video devices installed in the system.
- Returns:
The number of devices.
-
VideoDevInfo getDevInfo(int dev_id) const
Retrieve the video device info for the specified device index.
- Parameters:
dev_id – The video device id
- Returns:
The list of video device info
-
const VideoDevInfoVector &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
-
VideoDevInfoVector2 enumDev2() const
Enum all video devices installed in the system.
- Returns:
The list of video device info
-
int lookupDev(const string &drv_name, const string &dev_name) const
Lookup device index based on the driver and device name.
- Parameters:
drv_name – The driver name.
dev_name – The device name.
- Returns:
The device ID. If the device is not found, Error will be thrown.
-
string capName(pjmedia_vid_dev_cap cap) const
Get string info for the specified capability.
- Parameters:
cap – The capability ID.
- Returns:
Capability name.
-
void 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_id – The video device id.
format – The video format.
keep – Specify whether the setting is to be kept for future use.
-
MediaFormatVideo 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_id – The video device id.
- Returns:
keep The video format.
-
void 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_id – The video device id.
scale – The video scale.
keep – Specify whether the setting is to be kept for future use.
-
MediaSize 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_id – The video device id.
- Returns:
keep The video format.
-
void 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_id – The video device id.
flags – The video window flag.
keep – Specify whether the setting is to be kept for future use.
-
int 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_id – The video device id.
- Returns:
keep The video format.
-
void switchDev(int dev_id, const VideoSwitchParam ¶m)
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_id – The video device id.
param – The video switch param.
-
bool 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_id – The video device id
- Returns:
True if it’s active.
-
void 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_id – The video device id
orient – The video orientation.
keep – Specify whether the setting is to be kept for future use.
-
void initSubsys()
-
struct CodecInfo
- #include <media.hpp>
This structure describes codec information.
Public Functions
-
void fromPj(const pjsua_codec_info &codec_info)
Construct from pjsua_codec_info.
Public Members
-
string codecId
Codec unique identification.
-
pj_uint8_t priority
Codec priority (integer 0-255).
-
string desc
Codec description.
-
void fromPj(const pjsua_codec_info &codec_info)
-
struct CodecFmtp
- #include <media.hpp>
Structure of codec specific parameters which contains name=value pairs. The codec specific parameters are to be used with SDP according to the standards (e.g: RFC 3555) in SDP ‘a=fmtp’ attribute.
-
struct CodecParamInfo
- #include <media.hpp>
Audio codec parameters info.
Public Functions
-
inline CodecParamInfo()
Default constructor
Public Members
-
unsigned clockRate
Sampling rate in Hz
-
unsigned channelCnt
Channel count.
-
unsigned avgBps
Average bandwidth in bits/sec
-
unsigned maxBps
Maximum bandwidth in bits/sec
-
unsigned maxRxFrameSize
Maximum frame size
-
unsigned frameLen
Decoder frame ptime in msec.
-
unsigned frameLenDenum
Decoder frame ptime denum, or zero if ptime is integer.
-
unsigned encFrameLen
Encoder ptime, or zero if it’s equal to decoder ptime.
-
unsigned encFrameLenDenum
Encoder ptime denum, or zero if ptime is integer.
-
unsigned pcmBitsPerSample
Bits/sample in the PCM side
-
unsigned pt
Payload type.
-
pjmedia_format_id fmtId
Source format, it’s format of encoder input and decoder output.
-
inline CodecParamInfo()
-
struct CodecParamSetting
- #include <media.hpp>
Audio codec parameters setting.
Public Members
-
unsigned frmPerPkt
Number of frames per packet.
-
bool vad
Voice Activity Detector.
-
bool cng
Comfort Noise Generator.
-
bool penh
Perceptual Enhancement
-
bool plc
Packet loss concealment
-
bool reserved
Reserved, must be zero.
-
CodecFmtpVector encFmtp
Encoder’s fmtp params.
-
CodecFmtpVector decFmtp
Decoder’s fmtp params.
-
unsigned packetLoss
Encoder’s expected pkt loss %.
-
unsigned complexity
Encoder complexity, 0-10(max).
-
bool cbr
Constant bit rate?
-
unsigned frmPerPkt
-
struct CodecParam
- #include <media.hpp>
Detailed codec attributes used in configuring an audio codec and in querying the capability of audio codec factories.
Please note that codec parameter also contains SDP specific setting, setting::decFmtp and setting::encFmtp, which may need to be set appropriately based on the effective setting. See each codec documentation for more detail.
-
struct CodecOpusConfig
- #include <media.hpp>
Opus codec parameters setting;
Public Members
-
unsigned sample_rate
Sample rate in Hz.
-
unsigned channel_cnt
Number of channels.
-
unsigned frm_ptime
Frame time in msec.
-
unsigned frm_ptime_denum
Frame time denumerator.
-
unsigned bit_rate
Encoder bit rate in bps.
-
unsigned packet_loss
Encoder’s expected packet loss pct.
-
unsigned complexity
Encoder complexity, 0-10(10 is highest)
-
bool cbr
Constant bit rate?
-
unsigned sample_rate
-
struct CodecLyraConfig
- #include <media.hpp>
Lyra codec setting;
Public Members
-
unsigned bitRate
The value represents the decoder bitrate requested by the receiver. Endpoints can be configured with different bitrates. For example, the local endpoint might be set to a bitrate of 3200, while the remote endpoint is set to 6000. In this scenario, the remote endpoint will send data at 3200 bitrate, while the local endpoint will send data at 6000 bitrate. Valid bitrate: 3200, 6000, 9200. By default it is set to PJMEDIA_CODEC_LYRA_DEFAULT_BIT_RATE.
-
string modelPath
Lyra required some additional (model) files, including lyra_config.binarypb , lyragan.tflite , quantizer.tflite and soundstream_encoder.tflite . This setting represents the folder containing the above files. The specified folder should contain these files. If an invalid folder is provided, the codec creation will fail.
-
unsigned bitRate
-
struct VidCodecParam
- #include <media.hpp>
Detailed codec attributes used in configuring a video codec and in querying the capability of video codec factories.
Please note that codec parameter also contains SDP specific setting, decFmtp and encFmtp, which may need to be set appropriately based on the effective setting. See each codec documentation for more detail.
Public Functions
-
inline VidCodecParam()
Default constructor
Public Members
-
pjmedia_dir dir
Direction
-
pjmedia_vid_packing packing
Packetization strategy.
-
struct MediaFormatVideo encFmt
Encoded format
-
CodecFmtpVector encFmtp
Encoder fmtp params
-
unsigned encMtu
MTU or max payload size setting
-
struct MediaFormatVideo decFmt
Decoded format
-
CodecFmtpVector decFmtp
Decoder fmtp params
-
bool ignoreFmtp
Ignore fmtp params. If set to true, the codec will apply format settings specified in encFmt and decFmt only.
-
inline VidCodecParam()
-
struct MediaFmtChangedEvent
- #include <media.hpp>
This structure describes a media format changed event.
-
struct AudDevErrorEvent
- #include <media.hpp>
This structure describes an audio device error event.
Public Members
-
pjmedia_dir dir
The direction.
-
int id
The audio device ID.
-
pj_status_t status
The status code.
-
pjmedia_dir dir
-
union MediaEventData
- #include <media.hpp>
Media event data.
Public Members
-
MediaFmtChangedEvent fmtChanged
Media format changed event data.
-
AudDevErrorEvent audDevError
Audio device error event data.
-
GenericData ptr
Pointer to storage to user event data, if it’s outside this struct
-
MediaFmtChangedEvent fmtChanged
-
struct MediaEvent
- #include <media.hpp>
This structure describes a media event. It corresponds to the pjmedia_event structure.
Public Functions
-
inline MediaEvent()
Default constructor
-
void fromPj(const pjmedia_event &ev)
Convert from pjsip
Public Members
-
pjmedia_event_type type
The event type.
-
MediaEventData data
Additional data/parameters about the event. The type of data will be specific to the event type being reported.
-
void *pjMediaEvent
Pointer to original pjmedia_event. Only valid when the struct is converted from PJSIP’s pjmedia_event.
-
inline MediaEvent()
-
typedef std::vector<MediaFormatAudio> MediaFormatAudioVector