Group PJMEDIA_PORT

group PJMEDIA_PORT

Extensible framework for media terminations.

Defines

DEPRECATED_FOR_TICKET_2251
PJMEDIA_PORT_SIG(a, b, c, d)

Create 32bit port signature from ASCII characters.

Enums

enum pjmedia_port_op

Port operation setting.

Values:

PJMEDIA_PORT_NO_CHANGE

No change to the port TX or RX settings.

PJMEDIA_PORT_DISABLE

TX or RX is disabled from the port. It means get_frame() or put_frame() WILL NOT be called for this port.

PJMEDIA_PORT_MUTE

TX or RX is muted, which means that get_frame() or put_frame() will still be called, but the audio frame is discarded.

PJMEDIA_PORT_ENABLE

Enable TX and RX to/from this port.

Functions

unsigned PJMEDIA_PIA_SRATE(const pjmedia_port_info *pia)

Utility to retrieve audio clock rate/sampling rate value from pjmedia_port_info.

Return

Audio clock rate.

Parameters
  • pia: Pointer to port info containing audio format.

unsigned PJMEDIA_PIA_CCNT(const pjmedia_port_info *pia)

Utility to retrieve audio channel count value from pjmedia_port_info.

Return

Audio channel count.

Parameters
  • pia: Pointer to port info containing audio format.

unsigned PJMEDIA_PIA_BITS(const pjmedia_port_info *pia)

Utility to retrieve audio bits per sample value from pjmedia_port_info.

Return

Number of bits per sample.

Parameters
  • pia: Pointer to port info containing audio format.

unsigned PJMEDIA_PIA_PTIME(const pjmedia_port_info *pia)

Utility to retrieve audio frame interval (ptime) value from pjmedia_port_info.

Return

Frame interval in msec.

Parameters
  • pia: Pointer to port info containing audio format.

unsigned PJMEDIA_PIA_SPF(const pjmedia_port_info *pia)

This is a utility routine to retrieve the audio samples_per_frame value from port info.

Return

Samples per frame value.

Parameters
  • pia: Pointer to port info containing audio format.

unsigned PJMEDIA_PIA_AVG_BPS(const pjmedia_port_info *pia)

This is a utility routine to retrieve the average bitrate value from port info.

Return

Bitrate, in bits per second.

Parameters
  • pia: Pointer to port info containing audio format.

unsigned PJMEDIA_PIA_MAX_BPS(const pjmedia_port_info *pia)

This is a utility routine to retrieve the maximum bitrate value from port info.

Return

Bitrate, in bits per second.

Parameters
  • pia: Pointer to port info containing audio format.

unsigned PJMEDIA_PIA_AVG_FSZ(const pjmedia_port_info *pia)

This is a utility routine to retrieve the average audio frame size value from pjmedia_port_info.

Return

Frame size in bytes.

Parameters
  • pia: Pointer to port info containing audio format.

unsigned PJMEDIA_PIA_MAX_FSZ(const pjmedia_port_info *pia)

Utility to retrieve audio frame size from maximum bitrate from pjmedia_port_info.

Return

Frame size in bytes.

Parameters
  • pia: Pointer to port info containing audio format.

pj_status_t pjmedia_port_info_init(pjmedia_port_info *info, const pj_str_t *name, unsigned signature, unsigned clock_rate, unsigned channel_count, unsigned bits_per_sample, unsigned samples_per_frame)

This is an auxiliary function to initialize port info for ports which deal with PCM audio.

Return

PJ_SUCCESS on success.

Parameters
  • info: The port info to be initialized.

  • name: Port name.

  • signature: Port signature.

  • clock_rate: Port’s clock rate.

  • channel_count: Number of channels.

  • bits_per_sample: Bits per sample.

  • samples_per_frame: Number of samples per frame.

pj_status_t pjmedia_port_info_init2(pjmedia_port_info *info, const pj_str_t *name, unsigned signature, pjmedia_dir dir, const pjmedia_format *fmt)

This is an auxiliary function to initialize port info for ports which deal with PCM audio.

Return

PJ_SUCCESS on success.

Parameters
  • info: The port info to be initialized.

  • name: Port name.

  • signature: Port signature.

  • dir: Port’s direction.

  • fmt: Port’s media format.

pjmedia_clock_src *pjmedia_port_get_clock_src(pjmedia_port *port, pjmedia_dir dir)

Get a clock source from the port.

Return

The clock source or NULL if clock source is not present in the port.

Parameters
  • port: The media port.

  • dir: Media port’s direction.

pj_status_t pjmedia_port_get_frame(pjmedia_port *port, pjmedia_frame *frame)

Get a frame from the port (and subsequent downstream ports).

Return

PJ_SUCCESS on success, or the appropriate error code.

Parameters
  • port: The media port.

  • frame: Frame to store samples.

pj_status_t pjmedia_port_put_frame(pjmedia_port *port, pjmedia_frame *frame)

Put a frame to the port (and subsequent downstream ports).

Return

PJ_SUCCESS on success, or the appropriate error code.

Parameters
  • port: The media port.

  • frame: Frame to the put to the port.

pj_status_t pjmedia_port_destroy(pjmedia_port *port)

Destroy port (and subsequent downstream ports)

Return

PJ_SUCCESS on success, or the appropriate error code.

Parameters
  • port: The media port.

struct pjmedia_port_info
#include <port.h>

Port info.

struct pjmedia_port
#include <port.h>

Port interface.