BLOG | DOCUMENTATION | TRAC

Home --> Documentations --> PJSIP Reference

#include <media.hpp>

Inheritance diagram for pj::AudioMediaPlayer:
pj::AudioMedia pj::Media

Public Member Functions

 AudioMediaPlayer ()
 
void createPlayer (const string &file_name, unsigned options=0) PJSUA2_THROW(Error)
 
void createPlaylist (const StringVector &file_names, const string &label="", unsigned options=0) PJSUA2_THROW(Error)
 
AudioMediaPlayerInfo getInfo () const PJSUA2_THROW(Error)
 
pj_uint32_t getPos () const PJSUA2_THROW(Error)
 
void setPos (pj_uint32_t samples) PJSUA2_THROW(Error)
 
virtual ~AudioMediaPlayer ()
 
virtual bool onEof ()
 
- Public Member Functions inherited from pj::AudioMedia
ConfPortInfo getPortInfo () const PJSUA2_THROW(Error)
 
int getPortId () const
 
void startTransmit (const AudioMedia &sink) const PJSUA2_THROW(Error)
 
void startTransmit2 (const AudioMedia &sink, const AudioMediaTransmitParam &param) const PJSUA2_THROW(Error)
 
void stopTransmit (const AudioMedia &sink) const PJSUA2_THROW(Error)
 
void adjustRxLevel (float level) PJSUA2_THROW(Error)
 
void adjustTxLevel (float level) PJSUA2_THROW(Error)
 
unsigned getRxLevel () const PJSUA2_THROW(Error)
 
unsigned getTxLevel () const PJSUA2_THROW(Error)
 
 AudioMedia ()
 
virtual ~AudioMedia ()
 
- Public Member Functions inherited from pj::Media
virtual ~Media ()
 
pjmedia_type getType () const
 

Static Public Member Functions

static AudioMediaPlayertypecastFromAudioMedia (AudioMedia *media)
 
- Static Public Member Functions inherited from pj::AudioMedia
static ConfPortInfo getPortInfoFromId (int port_id) PJSUA2_THROW(Error)
 
static AudioMediatypecastFromMedia (Media *media)
 

Additional Inherited Members

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

Detailed Description

Audio Media Player.

Constructor & Destructor Documentation

◆ AudioMediaPlayer()

pj::AudioMediaPlayer::AudioMediaPlayer ( )

Constructor.

◆ ~AudioMediaPlayer()

virtual pj::AudioMediaPlayer::~AudioMediaPlayer ( )
virtual

Destructor. This will unregister the player port from the conference bridge.

Member Function Documentation

◆ createPlayer()

void pj::AudioMediaPlayer::createPlayer ( const string &  file_name,
unsigned  options = 0 
)

Create a file player, and automatically add this player to the conference bridge.

Parameters
file_nameThe 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).
optionsOptional option flag. Application may specify PJMEDIA_FILE_NO_LOOP to prevent playback loop.

◆ createPlaylist()

void pj::AudioMediaPlayer::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_namesArray 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.
labelOptional label to be set for the media port.
optionsOptional option flag. Application may specify PJMEDIA_FILE_NO_LOOP to prevent looping.

◆ getInfo()

AudioMediaPlayerInfo pj::AudioMediaPlayer::getInfo ( ) const

Get additional info about the player. This operation is only valid for player. For playlist, Error will be thrown.

Returns
the info.

◆ getPos()

pj_uint32_t pj::AudioMediaPlayer::getPos ( ) const

Get current playback position in samples. This operation is not valid for playlist.

Returns
Current playback position, in samples.

◆ setPos()

void pj::AudioMediaPlayer::setPos ( pj_uint32_t  samples)

Set playback position in samples. This operation is not valid for playlist.

Parameters
samplesThe desired playback position, in samples.

◆ typecastFromAudioMedia()

static AudioMediaPlayer* pj::AudioMediaPlayer::typecastFromAudioMedia ( AudioMedia media)
static

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

◆ onEof()

virtual bool pj::AudioMediaPlayer::onEof ( )
inlinevirtual

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.

Returns
If the callback returns false, the playback will stop. Note that if application destroys the player in the callback, it must return false here.

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.