BLOG | DOCUMENTATION | GITHUB

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) throw (Error)
 
void createPlaylist (const StringVector &file_names, const string &label="", unsigned options=0) throw (Error)
 
AudioMediaPlayerInfo getInfo () const throw (Error)
 
pj_uint32_t getPos () const throw (Error)
 
void setPos (pj_uint32_t samples) throw (Error)
 
virtual ~AudioMediaPlayer ()
 
virtual void onEof2 ()
 
- Public Member Functions inherited from pj::AudioMedia
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 AudioMediaPlayertypecastFromAudioMedia (AudioMedia *media)
 
- Static Public Member Functions inherited from pj::AudioMedia
static ConfPortInfo getPortInfoFromId (int port_id) throw (Error)
 
static AudioMediatypecastFromMedia (Media *media)
 

Additional Inherited Members

- Protected Member Functions inherited from pj::AudioMedia
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 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 
)
throw (Error
)

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

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

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

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

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

◆ onEof2()

virtual void pj::AudioMediaPlayer::onEof2 ( )
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.

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.


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.