Agora C++ API Reference for All Platforms

media_engine_i.h
1 //
2 // Agora Media SDK
3 //
4 // Copyright (c) 2015 Agora IO. All rights reserved.
5 //
6
7 #pragma once
8
9 #include "AgoraMediaBase.h"
10 #include "api/video/video_frame.h"
11 #include "IAgoraMediaEngine.h"
12
13 namespace agora {
14
15 namespace rtc {
16 struct RtcConnection;
17 }
18
19 namespace media {
20 namespace base {
21 class IVideoFrameObserverEx : public IVideoFrameObserver {
22 public:
23 virtual ~IVideoFrameObserverEx() {}
24 void onFrame(const VideoFrame* frame) final {}
25 bool isExternal() final { return false; }
26 virtual void onFrame(const webrtc::VideoFrame& frame) = 0;
27 };
28 }
29
33 class IVideoFrameObserverEx : public IVideoFrameObserver {
34 public:
35 virtual ~IVideoFrameObserverEx() {}
36
37 bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) final { return false; }
38 bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame& videoFrame) final { return false; }
39
40 bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid,
41 VideoFrame& videoFrame) final { return false; }
42
43 bool onTranscodedVideoFrame(VideoFrame& videoFrame) final { return false; }
44 bool onMediaPlayerVideoFrame(VideoFrame& videoFrame, int mediaPlayerId) final { return false; }
45 bool isExternal() final { return false; }
46
47 virtual bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, webrtc::VideoFrame& videoFrame) { return false; }
48 virtual bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, webrtc::VideoFrame& videoFrame) { return false; }
49
50 virtual bool onRenderVideoFrame(const char* channelId, rtc::uid_t remoteUid,
51 webrtc::VideoFrame& videoFrame) { return false; }
52
53 virtual bool onTranscodedVideoFrame(webrtc::VideoFrame& videoFrame) { return false; }
54 virtual bool onMediaPlayerVideoFrame(webrtc::VideoFrame& videoFrame, int mediaPlayerId) { return false; }
55 };
56
60 class IMediaEngineEx : public IMediaEngine {
61 public:
62 using IMediaEngine::registerAudioFrameObserver;
63 using IMediaEngine::registerVideoFrameObserver;
64 using IMediaEngine::registerVideoEncodedFrameObserver;
65 using IMediaEngine::pushEncodedVideoImage;
66
67 virtual int pushVideoFrameEx(const webrtc::VideoFrame& frame, unsigned int video_track_id = 0) = 0;
68
69 virtual int enableDualStreamModeEx(bool enabled, const rtc::SimulcastStreamConfig& streamConfig,
70 const rtc::RtcConnection& connection) = 0;
74 virtual int setExternalVideoConfigEx(const rtc::VideoEncoderConfiguration& config) = 0;
75 virtual int setExternalVideoConfigEx(const rtc::VideoEncoderConfiguration& config, const rtc::RtcConnection& connection) = 0;
76
77 ~IMediaEngineEx() override = default;
78 };
79
80 } // namespace media
81 } // namespace agora
agora::media::base::VideoFrame
Definition: AgoraMediaBase.h:963
agora::media::IMediaEngineEx::enableDualStreamModeEx
virtual int enableDualStreamModeEx(bool enabled, const rtc::SimulcastStreamConfig &streamConfig, const rtc::RtcConnection &connection)=0
agora::media::IMediaEngine::pushEncodedVideoImage
virtual int pushEncodedVideoImage(const unsigned char *imageBuffer, size_t length, const agora::rtc::EncodedVideoFrameInfo &videoEncodedFrameInfo, unsigned int videoTrackId=0)=0
agora::media::IVideoFrameObserverEx::onRenderVideoFrame
virtual bool onRenderVideoFrame(const char *channelId, rtc::uid_t remoteUid, webrtc::VideoFrame &videoFrame)
Definition: media_engine_i.h:50
agora::media::IVideoFrameObserverEx
Definition: media_engine_i.h:33
agora::media::IMediaEngine::registerVideoFrameObserver
virtual int registerVideoFrameObserver(IVideoFrameObserver *observer)=0
agora::media::base::IVideoFrameObserverEx::onFrame
virtual void onFrame(const webrtc::VideoFrame &frame)=0
agora::media::base::IVideoFrameObserver
Definition: AgoraMediaBase.h:1106
agora::media::IVideoFrameObserver
Definition: AgoraMediaBase.h:1664
agora::media::base::IVideoFrameObserverEx
Definition: media_engine_i.h:21
agora::rtc::VideoEncoderConfiguration
Definition: AgoraBase.h:1920
agora::media::IMediaEngine::registerAudioFrameObserver
virtual int registerAudioFrameObserver(IAudioFrameObserver *observer)=0
agora::rtc::SimulcastStreamConfig
Definition: AgoraBase.h:2133
agora::media::IVideoFrameObserverEx::onCaptureVideoFrame
virtual bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, webrtc::VideoFrame &videoFrame)
Definition: media_engine_i.h:47
agora::media::base::IVideoFrameObserverEx::isExternal
bool isExternal() final
Definition: media_engine_i.h:25
agora::media::IMediaEngineEx::setExternalVideoConfigEx
virtual int setExternalVideoConfigEx(const rtc::VideoEncoderConfiguration &config)=0
agora
Definition: AgoraAtomicOps.h:21
agora::media::IVideoFrameObserverEx::onRenderVideoFrame
bool onRenderVideoFrame(const char *channelId, rtc::uid_t remoteUid, VideoFrame &videoFrame) final
Definition: media_engine_i.h:40
agora::media::IMediaEngineEx
Definition: media_engine_i.h:60
agora::media::IVideoFrameObserverEx::onCaptureVideoFrame
bool onCaptureVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame &videoFrame) final
Definition: media_engine_i.h:37
agora::media::IMediaEngineEx::~IMediaEngineEx
~IMediaEngineEx() override=default
agora::media::IVideoFrameObserverEx::onMediaPlayerVideoFrame
bool onMediaPlayerVideoFrame(VideoFrame &videoFrame, int mediaPlayerId) final
Definition: media_engine_i.h:44
agora::media::IMediaEngine::registerVideoEncodedFrameObserver
virtual int registerVideoEncodedFrameObserver(IVideoEncodedFrameObserver *observer)=0
agora::media::IVideoFrameObserverEx::onPreEncodeVideoFrame
bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame &videoFrame) final
Definition: media_engine_i.h:38
agora::rtc::RtcConnection
Definition: IAgoraRtcEngineEx.h:20
agora::media::IVideoFrameObserverEx::onTranscodedVideoFrame
virtual bool onTranscodedVideoFrame(webrtc::VideoFrame &videoFrame)
Definition: media_engine_i.h:53
agora::media::IVideoFrameObserverEx::~IVideoFrameObserverEx
virtual ~IVideoFrameObserverEx()
Definition: media_engine_i.h:35
agora::rtc::VIDEO_SOURCE_TYPE
VIDEO_SOURCE_TYPE
Definition: AgoraMediaBase.h:68
agora::media::IMediaEngineEx::pushVideoFrameEx
virtual int pushVideoFrameEx(const webrtc::VideoFrame &frame, unsigned int video_track_id=0)=0
agora::media::IVideoFrameObserverEx::onMediaPlayerVideoFrame
virtual bool onMediaPlayerVideoFrame(webrtc::VideoFrame &videoFrame, int mediaPlayerId)
Definition: media_engine_i.h:54
agora::media::base::IVideoFrameObserverEx::~IVideoFrameObserverEx
virtual ~IVideoFrameObserverEx()
Definition: media_engine_i.h:23
agora::media::IMediaEngine
Definition: IAgoraMediaEngine.h:32
agora::media::IVideoFrameObserverEx::onTranscodedVideoFrame
bool onTranscodedVideoFrame(VideoFrame &videoFrame) final
Definition: media_engine_i.h:43
agora::media::IMediaEngineEx::setExternalVideoConfigEx
virtual int setExternalVideoConfigEx(const rtc::VideoEncoderConfiguration &config, const rtc::RtcConnection &connection)=0
agora::rtc::uid_t
unsigned int uid_t
Definition: AgoraMediaBase.h:28
agora::media::base::IVideoFrameObserverEx::onFrame
void onFrame(const VideoFrame *frame) final
Definition: media_engine_i.h:24
agora::media::IVideoFrameObserverEx::isExternal
bool isExternal() final
Definition: media_engine_i.h:45
rtc
Definition: video_node_i.h:28
agora::media::IVideoFrameObserverEx::onPreEncodeVideoFrame
virtual bool onPreEncodeVideoFrame(agora::rtc::VIDEO_SOURCE_TYPE type, webrtc::VideoFrame &videoFrame)
Definition: media_engine_i.h:48