Agora Java API Reference for Android

Public Member Functions | List of all members
agora::rtc::IVideoMixerSource Class Referenceabstract

`#include <NGIAgoraVideoMixerSource.h>`

Inheritance diagram for agora::rtc::IVideoMixerSource:

## Public Member Functions
virtual int | addVideoTrack (const char *id, agora_refptr< IVideoTrack > track, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | removeVideoTrack (const char *id, agora_refptr< IVideoTrack > track, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setStreamLayout (const char *id, const MixerLayoutConfig &config, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | delStreamLayout (const char *id, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | addImageSource (const char *id, const MixerLayoutConfig &config, ImageType type=kPng, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | delImageSource (const char *id, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | clearLayout (aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | refresh (aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setBackground (uint32_t width, uint32_t height, int fps, uint32_t color_argb=0, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setBackground (uint32_t width, uint32_t height, int fps, const char *url, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setRotation (uint8_t rotation, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | getAvgMixerDelay ()=0
virtual int | setMasterClockSource (const char *id=NULL, aosl_ref_t ares=AOSL_REF_INVALID)=0
Public Member Functions inherited from agora::RefCountInterface
virtual void | AddRef () const =0
virtual RefCountReleaseStatus | Release () const =0
virtual bool | HasOneRef () const =0

## Detailed Description

The IVideoMixerSource class abstracts a multi-in-multi-out video source which receives video streams from multiple local or remote video tracks and generate mixed video stream in user defined output format. When only one video track is added to the mixer, it simply forwards the incoming video frames to its sinks.

## Member Function Documentation

## ◆ addVideoTrack()

virtual int agora::rtc::IVideoMixerSource::addVideoTrack | ( | const char * | id,
|  | agora_refptr< IVideoTrack > | track,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Add a video track for mixing.

Parameters

  id | The unique id of the stream.
  track | The instance of the video track that you want mixer to receive its video stream.

Returns
  0 - Success <0 - Failure

## ◆ removeVideoTrack()

virtual int agora::rtc::IVideoMixerSource::removeVideoTrack | ( | const char * | id,
|  | agora_refptr< IVideoTrack > | track,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Remove the video track.

Parameters

  id | The unique id of the stream.
  track | The instance of the video track that you want to remove from the mixer.

Returns
  0 - Success <0 - Failure

## ◆ setStreamLayout()

virtual int agora::rtc::IVideoMixerSource::setStreamLayout | ( | const char * | id,
|  | const MixerLayoutConfig & | config,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Configures the layout of video frames comming from a specific track (indicated by uid) on the mixer canvas.

Parameters

  id | The unique id of the stream.
  config | The layout configuration

Returns
  0 - Success <0 - Failure

## ◆ delStreamLayout()

virtual int agora::rtc::IVideoMixerSource::delStreamLayout | ( | const char * | id,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Remove the user layout on the mixer canvas

Parameters

  id | The unique id of the stream.
  uid | The uid of the stream.

Returns
  0 - Success <0 - Failure

## ◆ addImageSource()

virtual int agora::rtc::IVideoMixerSource::addImageSource | ( | const char * | id,
|  | const MixerLayoutConfig & | config,
|  | ImageType | type = `kPng`,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Add a image source to the mixer with its layout configuration on the mixer canvas.

Parameters

  id | The unique id of the image.
  config | The layout configuration

Returns
  0 - Success <0 - Failure

## ◆ delImageSource()

virtual int agora::rtc::IVideoMixerSource::delImageSource | ( | const char * | id,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Delete a image source to the mixer.

Parameters

  id | The unique id of the image.

Returns
  0 - Success <0 - Failure

## ◆ clearLayout()

virtual int agora::rtc::IVideoMixerSource::clearLayout | ( | aosl_ref_t | ares = `AOSL_REF_INVALID` | ) |
| pure virtual

Clear all the layout settings set previously

## ◆ refresh()

virtual int agora::rtc::IVideoMixerSource::refresh | ( | aosl_ref_t | ares = `AOSL_REF_INVALID` | ) |
| pure virtual

Refresh the user layout on the mixer canvas

Returns
  0 - Success <0 - Failure

## ◆ setBackground() [1/2]

virtual int agora::rtc::IVideoMixerSource::setBackground | ( | uint32_t | width,
|  | uint32_t | height,
|  | int | fps,
|  | uint32_t | color_argb = `0`,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Set the mixer canvas background to override the default configuration

Parameters

  width | width of the canvas
  height | height of the canvas
  fps | fps of the mixed video stream
  color_argb | mixer canvas background color in argb

Returns
  0 - Success <0 - Failure

## ◆ setBackground() [2/2]

virtual int agora::rtc::IVideoMixerSource::setBackground | ( | uint32_t | width,
|  | uint32_t | height,
|  | int | fps,
|  | const char * | url,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Set the mixer canvas background to override the default configuration

Parameters

  width | width of the canvas
  height | height of the canvas
  fps | fps of the mixed video stream
  url | URL of the canvas background image

Returns
  0 - Success <0 - Failure

## ◆ setRotation()

virtual int agora::rtc::IVideoMixerSource::setRotation | ( | uint8_t | rotation,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Set the rotation of the mixed video stream

Parameters

  rotation:0:none,1:90°,2:180°,3:270° |

Returns
  0 - Success <0 - Failure

## ◆ getAvgMixerDelay()

virtual int agora::rtc::IVideoMixerSource::getAvgMixerDelay | ( |  | ) |
| pure virtual

Get the average delay in ms introduced by the mixer module, which includes the average mixing delay plus the encoder delay.

Returns
  delay in ms

## ◆ setMasterClockSource()

virtual int agora::rtc::IVideoMixerSource::setMasterClockSource | ( | const char * | id = `NULL`,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Set the master clock source for mixed video frame. The master clock source serves as the reference clock for audio/video synchronization after mixing.

Returns
  0 - Success <0 - Failure