Group PJMEDIA_VIDEO_PORT

group PJMEDIA_VIDEO_PORT

Video media port.

Typedefs

typedef struct pjmedia_vid_port pjmedia_vid_port

Opaque data type for video port.

Functions

void pjmedia_vid_port_param_default(pjmedia_vid_port_param *prm)

Initialize the parameter with the default values. Note that this typically would only fill the structure to zeroes unless they have different default values.

Parameters

prm – The parameter.

pj_status_t pjmedia_vid_port_create(pj_pool_t *pool, const pjmedia_vid_port_param *prm, pjmedia_vid_port **p_vp)

Create a video port with the specified parameter. When video port opens the video stream with different parameter than the requested values in the prm.vidparam argument, it will automatically do the necessary conversion.

Parameters
  • pool – Pool to allocate memory from.

  • prm – The video port parameter.

  • p_vp – Pointer to receive the result.

Returns

PJ_SUCCESS if video port has been created successfully, or the appropriate error code.

void pjmedia_vid_port_set_cb(pjmedia_vid_port *vid_port, const pjmedia_vid_dev_cb *cb, void *user_data)

Set the callbacks of the video port’s underlying video stream.

Parameters
  • vid_port – The video port.

  • cb – Pointer to structure containing video stream callbacks.

  • user_data – Arbitrary user data, which will be given back in the callbacks.

pjmedia_vid_dev_stream *pjmedia_vid_port_get_stream(pjmedia_vid_port *vid_port)

Return the underlying video stream of the video port.

Parameters

vid_port – The video port.

Returns

The video stream.

pjmedia_port *pjmedia_vid_port_get_passive_port(pjmedia_vid_port *vid_port)

Return the (passive) media port of the video port. This operation is only valid for video ports created with passive interface selected. Retrieving the media port for active video ports may raise an assertion.

Parameters

vid_port – The video port.

Returns

The media port instance, or NULL.

pjmedia_clock_src *pjmedia_vid_port_get_clock_src(pjmedia_vid_port *vid_port)

Get a clock source from the video port.

Parameters

vid_port – The video port.

Returns

The clock source.

pj_status_t pjmedia_vid_port_set_clock_src(pjmedia_vid_port *vid_port, pjmedia_clock_src *clocksrc)

Set a clock source for the video port.

Parameters
  • vid_port – The video port.

  • clocksrc – The clock source.

Returns

PJ_SUCCESS on success or the appropriate error code.

pj_status_t pjmedia_vid_port_subscribe_event(pjmedia_vid_port *vid_port, pjmedia_port *port)

Subscribe media event notifications from the specified media port. Sample use case is that renderer video port needs to monitor stream port events so renderer can adjust its param whenever stream port detects format change.

Parameters
  • vid_port – The video port.

  • port – The media port whose events to be monitored.

Returns

PJ_SUCCESS on success or the appropriate error code.

pj_status_t pjmedia_vid_port_connect(pjmedia_vid_port *vid_port, pjmedia_port *port, pj_bool_t destroy)

Connect the video port to a downstream (slave) media port. This operation is only valid for video ports created with active interface selected. Connecting a passive video port may raise an assertion.

Parameters
  • vid_port – The video port.

  • port – A downstream media port to be connected to this video port.

  • destroy – Specify if the downstream media port should also be destroyed by this video port when the video port is destroyed.

Returns

PJ_SUCCESS on success or the appropriate error code.

pj_status_t pjmedia_vid_port_disconnect(pjmedia_vid_port *vid_port)

Disconnect the video port from its downstream (slave) media port, if any. This operation is only valid for video ports created with active interface selected, and assertion may be triggered if this is invoked on a passive video port.

Parameters

vid_port – The video port.

Returns

PJ_SUCCESS on success or the appropriate error code.

pjmedia_port *pjmedia_vid_port_get_connected_port(pjmedia_vid_port *vid_port)

Retrieve the media port currently connected as downstream media port of the specified video port. This operation is only valid for video ports created with active interface selected, and assertion may be triggered if this is invoked on a passive video port.

Parameters

vid_port – The video port.

Returns

Media port currently connected to the video port, if any.

pj_status_t pjmedia_vid_port_start(pjmedia_vid_port *vid_port)

Start the video port.

Parameters

vid_port – The video port.

Returns

PJ_SUCCESS on success or the appropriate error code.

pj_bool_t pjmedia_vid_port_is_running(pjmedia_vid_port *vid_port)

Query whether the video port has been started.

Parameters

vid_port – The video port.

Returns

PJ_TRUE if the video port has been started.

pj_status_t pjmedia_vid_port_stop(pjmedia_vid_port *vid_port)

Stop the video port.

Parameters

vid_port – The video port.

Returns

PJ_SUCCESS on success or the appropriate error code.

void pjmedia_vid_port_destroy(pjmedia_vid_port *vid_port)

Destroy the video port, along with its video stream. If the video port is an active one, this may also destroy the downstream media port, if the destroy flag is set when the media port is connected.

Parameters

vid_port – The video port.

struct pjmedia_vid_port_param
#include <vid_port.h>

This structure describes the parameters to create a video port