Group PJMEDIA_VID_TEE

group PJMEDIA_VID_TEE

Duplicate video data from a media port into multiple media port destinations.

This section describes media port to duplicate video data in the stream.

A video tee branches video stream flow from one source port to multiple destination ports by simply duplicating the video data supplied by the source port and delivering the copy to all registered destinations.

The video tee is a unidirectional port, i.e: data flows from source port to destination ports only. Also, the video source port MUST actively call pjmedia_port_put_frame() to the video tee and the video destination ports MUST NEVER call pjmedia_port_get_frame() to the video tee. Please note that there is no specific order of which destination port will receive a frame from the video tee.

The video tee is not thread-safe, so it is application responsibility to synchronize video tee operations, e.g: make sure the source port is paused during adding or removing a destination port.

Enums

enum pjmedia_vid_tee_flag

Enumeration of video tee flags.

Values:

enumerator PJMEDIA_VID_TEE_DST_DO_IN_PLACE_PROC

Tell the video tee that the destination port will do in-place processing, so the delivered data may be modified by this port. If this flag is used, buffer will be copied before being given to the destination port.

Functions

pj_status_t pjmedia_vid_tee_create(pj_pool_t *pool, const pjmedia_format *fmt, unsigned max_dst_cnt, pjmedia_port **p_vid_tee)

Create a video tee port with the specified source media port. Application should destroy the tee with pjmedia_port_destroy() as usual. Note that destroying the tee does not destroy its destination ports.

Parameters
  • pool – The pool.

  • fmt – The source media port’s format.

  • max_dst_cnt – The maximum number of destination ports supported.

  • p_vid_tee – Pointer to receive the video tee port.

Returns

PJ_SUCCESS on success, or the appropriate error code.

pj_status_t pjmedia_vid_tee_add_dst_port(pjmedia_port *vid_tee, unsigned option, pjmedia_port *port)

Add a destination media port to the video tee. For this function, the destination port’s media format must match the source format.

Parameters
  • vid_tee – The video tee.

  • option – Video tee option, see pjmedia_vid_tee_flag.

  • port – The destination media port.

Returns

PJ_SUCCESS on success, or the appropriate error code.

pj_status_t pjmedia_vid_tee_add_dst_port2(pjmedia_port *vid_tee, unsigned option, pjmedia_port *port)

Add a destination media port to the video tee. This function will also create a converter if the destination port’s media format does not match the source format.

Parameters
  • vid_tee – The video tee.

  • option – Video tee option, see pjmedia_vid_tee_flag.

  • port – The destination media port.

Returns

PJ_SUCCESS on success, or the appropriate error code.

pj_status_t pjmedia_vid_tee_remove_dst_port(pjmedia_port *vid_tee, pjmedia_port *port)

Remove a destination media port from the video tee.

Parameters
  • vid_tee – The video tee.

  • port – The destination media port to be removed.

Returns

PJ_SUCCESS on success, or the appropriate error code.