Home --> Documentations --> PJMEDIA Reference

Typedefs | Enumerations | Functions
The Endpoint

Typedefs

typedef void(* pjmedia_endpt_exit_callback )(pjmedia_endpt *endpt)
 

Enumerations

enum  pjmedia_endpt_flag { PJMEDIA_ENDPT_HAS_TELEPHONE_EVENT_FLAG }
 

Functions

pj_status_t pjmedia_endpt_create2 (pj_pool_factory *pf, pj_ioqueue_t *ioqueue, unsigned worker_cnt, pjmedia_endpt **p_endpt)
 
pj_status_t pjmedia_endpt_create (pj_pool_factory *pf, pj_ioqueue_t *ioqueue, unsigned worker_cnt, pjmedia_endpt **p_endpt)
 
pj_status_t pjmedia_endpt_destroy2 (pjmedia_endpt *endpt)
 
pj_status_t pjmedia_endpt_destroy (pjmedia_endpt *endpt)
 
pj_status_t pjmedia_endpt_set_flag (pjmedia_endpt *endpt, pjmedia_endpt_flag flag, const void *value)
 
pj_status_t pjmedia_endpt_get_flag (pjmedia_endpt *endpt, pjmedia_endpt_flag flag, void *value)
 
pj_ioqueue_tpjmedia_endpt_get_ioqueue (pjmedia_endpt *endpt)
 
unsigned pjmedia_endpt_get_thread_count (pjmedia_endpt *endpt)
 
pj_thread_tpjmedia_endpt_get_thread (pjmedia_endpt *endpt, unsigned index)
 
pj_status_t pjmedia_endpt_stop_threads (pjmedia_endpt *endpt)
 
pj_pool_tpjmedia_endpt_create_pool (pjmedia_endpt *endpt, const char *name, pj_size_t initial, pj_size_t increment)
 
pjmedia_codec_mgrpjmedia_endpt_get_codec_mgr (pjmedia_endpt *endpt)
 
pj_status_t pjmedia_endpt_create_sdp (pjmedia_endpt *endpt, pj_pool_t *pool, unsigned stream_cnt, const pjmedia_sock_info sock_info[], pjmedia_sdp_session **p_sdp)
 
pj_status_t pjmedia_endpt_create_base_sdp (pjmedia_endpt *endpt, pj_pool_t *pool, const pj_str_t *sess_name, const pj_sockaddr *origin, pjmedia_sdp_session **p_sdp)
 
pj_status_t pjmedia_endpt_create_audio_sdp (pjmedia_endpt *endpt, pj_pool_t *pool, const pjmedia_sock_info *si, unsigned options, pjmedia_sdp_media **p_m)
 
pj_status_t pjmedia_endpt_create_video_sdp (pjmedia_endpt *endpt, pj_pool_t *pool, const pjmedia_sock_info *si, unsigned options, pjmedia_sdp_media **p_m)
 
pj_status_t pjmedia_endpt_dump (pjmedia_endpt *endpt)
 
pj_status_t pjmedia_endpt_atexit (pjmedia_endpt *endpt, pjmedia_endpt_exit_callback func)
 

Detailed Description

The media endpoint acts as placeholder for endpoint capabilities. Each media endpoint will have a codec manager to manage list of codecs installed in the endpoint and a sound device factory.

A reference to media endpoint instance is required when application wants to create a media session (pjmedia_session_create()).

Typedef Documentation

typedef void(* pjmedia_endpt_exit_callback)(pjmedia_endpt *endpt)

Type of callback to register to pjmedia_endpt_atexit().

Enumeration Type Documentation

This enumeration describes various flags that can be set or retrieved in the media endpoint, by using pjmedia_endpt_set_flag() and pjmedia_endpt_get_flag() respectively.

Enumerator
PJMEDIA_ENDPT_HAS_TELEPHONE_EVENT_FLAG 

This flag controls whether telephony-event should be offered in SDP. Value is boolean.

Function Documentation

pj_status_t pjmedia_endpt_create2 ( pj_pool_factory pf,
pj_ioqueue_t ioqueue,
unsigned  worker_cnt,
pjmedia_endpt **  p_endpt 
)

Create an instance of media endpoint.

Parameters
pfPool factory, which will be used by the media endpoint throughout its lifetime.
ioqueueOptional ioqueue instance to be registered to the endpoint. The ioqueue instance is used to poll all RTP and RTCP sockets. If this argument is NULL, the endpoint will create an internal ioqueue instance.
worker_cntSpecify the number of worker threads to be created to poll the ioqueue.
p_endptPointer to receive the endpoint instance.
Returns
PJ_SUCCESS on success.

Referenced by pjmedia_endpt_create().

pj_status_t pjmedia_endpt_create ( pj_pool_factory pf,
pj_ioqueue_t ioqueue,
unsigned  worker_cnt,
pjmedia_endpt **  p_endpt 
)

Create an instance of media endpoint and initialize audio subsystem.

Parameters
pfPool factory, which will be used by the media endpoint throughout its lifetime.
ioqueueOptional ioqueue instance to be registered to the endpoint. The ioqueue instance is used to poll all RTP and RTCP sockets. If this argument is NULL, the endpoint will create an internal ioqueue instance.
worker_cntSpecify the number of worker threads to be created to poll the ioqueue.
p_endptPointer to receive the endpoint instance.
Returns
PJ_SUCCESS on success.

References PJ_SUCCESS, pjmedia_aud_subsys_init(), pjmedia_aud_subsys_shutdown(), and pjmedia_endpt_create2().

pj_status_t pjmedia_endpt_destroy2 ( pjmedia_endpt endpt)

Destroy media endpoint instance.

Parameters
endptMedia endpoint instance.
Returns
PJ_SUCCESS on success.

Referenced by pjmedia_endpt_destroy().

pj_status_t pjmedia_endpt_destroy ( pjmedia_endpt endpt)

Destroy media endpoint instance and shutdown audio subsystem.

Parameters
endptMedia endpoint instance.
Returns
PJ_SUCCESS on success.

References pjmedia_aud_subsys_shutdown(), and pjmedia_endpt_destroy2().

pj_status_t pjmedia_endpt_set_flag ( pjmedia_endpt endpt,
pjmedia_endpt_flag  flag,
const void *  value 
)

Change the value of a flag.

Parameters
endptMedia endpoint.
flagThe flag.
valuePointer to the value to be set.

PJ_SUCCESS on success.

pj_status_t pjmedia_endpt_get_flag ( pjmedia_endpt endpt,
pjmedia_endpt_flag  flag,
void *  value 
)

Retrieve the value of a flag.

Parameters
endptMedia endpoint.
flagThe flag.
valuePointer to store the result.
Returns
PJ_SUCCESS on success.
pj_ioqueue_t* pjmedia_endpt_get_ioqueue ( pjmedia_endpt endpt)

Get the ioqueue instance of the media endpoint.

Parameters
endptThe media endpoint instance.
Returns
The ioqueue instance of the media endpoint.
unsigned pjmedia_endpt_get_thread_count ( pjmedia_endpt endpt)

Get the number of worker threads on the media endpoint

Parameters
endptThe media endpoint instance.
Returns
The number of worker threads on the media endpoint
pj_thread_t* pjmedia_endpt_get_thread ( pjmedia_endpt endpt,
unsigned  index 
)

Get a reference to one of the worker threads of the media endpoint

Parameters
endptThe media endpoint instance.
indexThe index of the thread: 0<= index < thread_cnt
Returns
pj_thread_t or NULL
pj_status_t pjmedia_endpt_stop_threads ( pjmedia_endpt endpt)

Stop and destroy the worker threads of the media endpoint

Parameters
endptThe media endpoint instance.
Returns
PJ_SUCCESS on success.
pj_pool_t* pjmedia_endpt_create_pool ( pjmedia_endpt endpt,
const char *  name,
pj_size_t  initial,
pj_size_t  increment 
)

Request the media endpoint to create pool.

Parameters
endptThe media endpoint instance.
nameName to be assigned to the pool.
initialInitial pool size, in bytes.
incrementIncrement size, in bytes.
Returns
Memory pool.
pjmedia_codec_mgr* pjmedia_endpt_get_codec_mgr ( pjmedia_endpt endpt)

Get the codec manager instance of the media endpoint.

Parameters
endptThe media endpoint instance.
Returns
The instance of codec manager belonging to this media endpoint.
pj_status_t pjmedia_endpt_create_sdp ( pjmedia_endpt endpt,
pj_pool_t pool,
unsigned  stream_cnt,
const pjmedia_sock_info  sock_info[],
pjmedia_sdp_session **  p_sdp 
)

Create a SDP session description that describes the endpoint capability.

Parameters
endptThe media endpoint.
poolPool to use to create the SDP descriptor.
stream_cntNumber of elements in the sock_info array. This also denotes the maximum number of streams (i.e. the "m=" lines) that will be created in the SDP. By convention, if this value is greater than one, the first media will be audio and the remaining media is video.
sock_infoArray of socket transport information. One transport is needed for each media stream, and each transport consists of an RTP and RTCP socket pair.
p_sdpPointer to receive SDP session descriptor.
Returns
PJ_SUCCESS on success.
pj_status_t pjmedia_endpt_create_base_sdp ( pjmedia_endpt endpt,
pj_pool_t pool,
const pj_str_t sess_name,
const pj_sockaddr origin,
pjmedia_sdp_session **  p_sdp 
)

Create a "blank" SDP session description. The SDP will contain basic SDP fields such as origin, time, and name, but without any media lines.

Parameters
endptThe media endpoint.
poolPool to allocate memory from.
sess_nameOptional SDP session name, or NULL to use default value.
originAddress to put in the origin field.
p_sdpPointer to receive the created SDP session.
Returns
PJ_SUCCESS on success, or the appropriate error code.
pj_status_t pjmedia_endpt_create_audio_sdp ( pjmedia_endpt endpt,
pj_pool_t pool,
const pjmedia_sock_info si,
unsigned  options,
pjmedia_sdp_media **  p_m 
)

Create SDP media line for audio media.

Parameters
endptThe media endpoint.
poolPool to allocate memory from.
siSocket information.
optionsOption flags, must be zero for now.
p_mPointer to receive the created SDP media.
Returns
PJ_SUCCESS on success, or the appropriate error code.
pj_status_t pjmedia_endpt_create_video_sdp ( pjmedia_endpt endpt,
pj_pool_t pool,
const pjmedia_sock_info si,
unsigned  options,
pjmedia_sdp_media **  p_m 
)

Create SDP media line for video media.

Parameters
endptThe media endpoint.
poolPool to allocate memory from.
siSocket information.
optionsOption flags, must be zero for now.
p_mPointer to receive the created SDP media.
Returns
PJ_SUCCESS on success, or the appropriate error code.
pj_status_t pjmedia_endpt_dump ( pjmedia_endpt endpt)

Dump media endpoint capabilities.

Parameters
endptThe media endpoint.
Returns
PJ_SUCCESS on success.
pj_status_t pjmedia_endpt_atexit ( pjmedia_endpt endpt,
pjmedia_endpt_exit_callback  func 
)

Register cleanup function to be called by media endpoint when pjmedia_endpt_destroy() is called. Note that application should not use or access any endpoint resource (such as pool, ioqueue) from within the callback as such resource may have been released when the callback function is invoked.

Parameters
endptThe media endpoint.
funcThe function to be registered.
Returns
PJ_SUCCESS on success.

 


PJMEDIA small footprint Open Source media stack
Copyright (C) 2006-2008 Teluu Inc.