BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJSIP Reference

#include <media.hpp>

Inheritance diagram for pj::AudioMedia:
pj::Media pj::AudioMediaPlayer pj::AudioMediaRecorder pj::ExtraAudioDevice pj::ToneGenerator

Public Member Functions

ConfPortInfo getPortInfo () const throw (Error)
 
int getPortId () const
 
void startTransmit (const AudioMedia &sink) const throw (Error)
 
void startTransmit2 (const AudioMedia &sink, const AudioMediaTransmitParam &param) const throw (Error)
 
void stopTransmit (const AudioMedia &sink) const throw (Error)
 
void adjustRxLevel (float level) throw (Error)
 
void adjustTxLevel (float level) throw (Error)
 
unsigned getRxLevel () const throw (Error)
 
unsigned getTxLevel () const throw (Error)
 
 AudioMedia ()
 
virtual ~AudioMedia ()
 
- Public Member Functions inherited from pj::Media
virtual ~Media ()
 
pjmedia_type getType () const
 

Static Public Member Functions

static ConfPortInfo getPortInfoFromId (int port_id) throw (Error)
 
static AudioMediatypecastFromMedia (Media *media)
 

Protected Member Functions

void registerMediaPort (MediaPort port) throw (Error)
 
void registerMediaPort2 (MediaPort port, pj_pool_t *pool) throw (Error)
 
void unregisterMediaPort ()
 
- Protected Member Functions inherited from pj::Media
 Media (pjmedia_type med_type)
 

Protected Attributes

int id
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ AudioMedia()

pj::AudioMedia::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.

◆ ~AudioMedia()

virtual pj::AudioMedia::~AudioMedia ( )
virtual

Virtual Destructor.

Member Function Documentation

◆ getPortInfo()

ConfPortInfo pj::AudioMedia::getPortInfo ( ) const
throw (Error
)

Get information about the specified conference port.

◆ getPortId()

int pj::AudioMedia::getPortId ( ) const

Get port Id.

◆ getPortInfoFromId()

static ConfPortInfo pj::AudioMedia::getPortInfoFromId ( int  port_id)
throw (Error
)
static

Get information from specific port id.

◆ startTransmit()

void pj::AudioMedia::startTransmit ( const AudioMedia sink) const
throw (Error
)

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
sinkThe destination Media.

◆ startTransmit2()

void pj::AudioMedia::startTransmit2 ( const AudioMedia sink,
const AudioMediaTransmitParam param 
) const
throw (Error
)

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
sinkThe destination Media.
paramThe parameter.

◆ stopTransmit()

void pj::AudioMedia::stopTransmit ( const AudioMedia sink) const
throw (Error
)

Stop media flow to destination/sink port.

Parameters
sinkThe destination media.

◆ adjustRxLevel()

void pj::AudioMedia::adjustRxLevel ( float  level)
throw (Error
)

Adjust the signal level to be transmitted from the bridge to this media port by making it louder or quieter.

Parameters
levelSignal level adjustment. Value 1.0 means no level adjustment, while value 0 means to mute the port.

◆ adjustTxLevel()

void pj::AudioMedia::adjustTxLevel ( float  level)
throw (Error
)

Adjust the signal level to be received from this media port (to the bridge) by making it louder or quieter.

Parameters
levelSignal level adjustment. Value 1.0 means no level adjustment, while value 0 means to mute the port.

◆ getRxLevel()

unsigned pj::AudioMedia::getRxLevel ( ) const
throw (Error
)

Get the last received signal level.

Returns
Signal level in percent.

◆ getTxLevel()

unsigned pj::AudioMedia::getTxLevel ( ) const
throw (Error
)

Get the last transmitted signal level.

Returns
Signal level in percent.

◆ typecastFromMedia()

static AudioMedia * pj::AudioMedia::typecastFromMedia ( Media media)
static

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
mediaThe object to be downcasted
Returns
The object as AudioMedia instance

◆ registerMediaPort()

void pj::AudioMedia::registerMediaPort ( MediaPort  port)
throw (Error
)
protected

Warning: deprecated and will be removed in future release, use registerMediaPort2() instead.

This method needs to be called by descendants of this class to register the media port created to the conference bridge and Endpoint's media list.

param port The media port to be registered to the conference bridge.

◆ registerMediaPort2()

void pj::AudioMedia::registerMediaPort2 ( MediaPort  port,
pj_pool_t pool 
)
throw (Error
)
protected

This method needs to be called by descendants of this class to register the media port created to the conference bridge and Endpoint's media list.

param port The media port to be registered to the conference bridge. param pool The memory pool.

◆ unregisterMediaPort()

void pj::AudioMedia::unregisterMediaPort ( )
protected

This method needs to be called by descendants of this class to remove the media port from the conference bridge and Endpoint's media list. Descendant should only call this method if it has registered the media with the previous call to registerMediaPort().

Field Documentation

◆ id

int pj::AudioMedia::id
protected

Conference port Id.


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.