Agora Server Gateway SDK C++ API Reference
NGIAgoraRtmpConnection.h
Go to the documentation of this file.
1//
2// Agora RTMP connection
3//
4// Created by Haonong Yu in 2020-02.
5// Copyright (c) 2020 Agora.io. All rights reserved.
6//
7
8#pragma once // NOLINT(build/header_guard)
9
10#include "AgoraBase.h"
11#include "AgoraRefPtr.h"
12
13namespace agora {
14namespace rtc {
15
16class IRtmpLocalUser;
17
26
31
38
43
45 numberOfChannels(1), bitrate(48000) {}
46};
47
59 int width;
60
68 int height;
69
74
79
84
89
93 unsigned int gopInMs;
94
102
107
109 bitrate(800), maxBitrate(960), minBitrate(600), gopInMs(2000), encoderHwSwMode(0),
111};
112
113
122
127
132
138};
139
153
160
168
177
193
204
222};
223
232
234};
235
236
241 public:
247 virtual void onConnected(const RtmpConnectionInfo& connectionInfo) = 0;
248
254 virtual void onDisconnected(const RtmpConnectionInfo& connectionInfo) = 0;
255
261 virtual void onReconnecting(const RtmpConnectionInfo& connectionInfo) = 0;
262
268 virtual void onReconnected(const RtmpConnectionInfo& connectionInfo) = 0;
269
276 virtual void onConnectionFailure(const RtmpConnectionInfo& connectionInfo,
277 RTMP_CONNECTION_ERROR errCode) = 0;
278
292 virtual void onTransferStatistics(uint64_t video_width, uint64_t video_height, uint64_t video_bitrate, uint64_t audio_bitrate, uint64_t video_frame_rate, uint64_t push_video_frame_cnt, uint64_t pop_video_frame_cnt) = 0;
293
295};
296
306class IRtmpConnection : public RefCountInterface {
307 public:
309
332 virtual int connect(const char* url) = 0;
333
344 virtual int disconnect() = 0;
345
354
365
376 virtual int registerObserver(IRtmpConnectionObserver* observer, void(*safeDeleter)(IRtmpConnectionObserver*) = NULL) = 0;
377
386 virtual int unregisterObserver(IRtmpConnectionObserver* observer) = 0;
387};
388
389} // namespace rtc
390} // namespace agora
Definition: NGIAgoraRtmpConnection.h:306
virtual int connect(const char *url)=0
virtual RtmpConnectionInfo getConnectionInfo()=0
~IRtmpConnection()
Definition: NGIAgoraRtmpConnection.h:308
virtual int disconnect()=0
virtual int unregisterObserver(IRtmpConnectionObserver *observer)=0
virtual int registerObserver(IRtmpConnectionObserver *observer, void(*safeDeleter)(IRtmpConnectionObserver *)=NULL)=0
virtual IRtmpLocalUser * getRtmpLocalUser()=0
Definition: NGIAgoraRtmpConnection.h:240
virtual void onConnected(const RtmpConnectionInfo &connectionInfo)=0
virtual void onReconnecting(const RtmpConnectionInfo &connectionInfo)=0
virtual ~IRtmpConnectionObserver()
Definition: NGIAgoraRtmpConnection.h:294
virtual void onDisconnected(const RtmpConnectionInfo &connectionInfo)=0
virtual void onReconnected(const RtmpConnectionInfo &connectionInfo)=0
virtual void onConnectionFailure(const RtmpConnectionInfo &connectionInfo, RTMP_CONNECTION_ERROR errCode)=0
virtual void onTransferStatistics(uint64_t video_width, uint64_t video_height, uint64_t video_bitrate, uint64_t audio_bitrate, uint64_t video_frame_rate, uint64_t push_video_frame_cnt, uint64_t pop_video_frame_cnt)=0
Definition: NGIAgoraRtmpLocalUser.h:115
RTMP_CONNECTION_STATE
Definition: NGIAgoraRtmpConnection.h:143
@ STATE_DISCONNECTED
Definition: NGIAgoraRtmpConnection.h:152
@ STATE_FAILED
Definition: NGIAgoraRtmpConnection.h:192
@ STATE_RECONNECTED
Definition: NGIAgoraRtmpConnection.h:202
@ STATE_CONNECTING
Definition: NGIAgoraRtmpConnection.h:159
@ STATE_RECONNECTING
Definition: NGIAgoraRtmpConnection.h:176
@ STATE_CONNECTED
Definition: NGIAgoraRtmpConnection.h:167
ORIENTATION_MODE
Definition: AgoraBase.h:1440
@ ORIENTATION_MODE_ADAPTIVE
Definition: AgoraBase.h:1448
RTMP_CONNECTION_ERROR
Definition: NGIAgoraRtmpConnection.h:117
@ RTMP_CONNECTION_ERR_BAD_NAME
Definition: NGIAgoraRtmpConnection.h:137
@ RTMP_CONNECTION_ERR_INVALID_URL
Definition: NGIAgoraRtmpConnection.h:131
@ RTMP_CONNECTION_ERR_OK
Definition: NGIAgoraRtmpConnection.h:121
@ RTMP_CONNECTION_ERR_FAILED
Definition: NGIAgoraRtmpConnection.h:126
Definition: AgoraBase.h:86
Definition: NGIAgoraRtmpConnection.h:208
RtmpStreamingAudioConfiguration audioConfig
Definition: NGIAgoraRtmpConnection.h:212
bool enableWriteFlvFile
Definition: NGIAgoraRtmpConnection.h:220
RtmpConnectionConfiguration()
Definition: NGIAgoraRtmpConnection.h:221
RtmpStreamingVideoConfiguration videoConfig
Definition: NGIAgoraRtmpConnection.h:216
Definition: NGIAgoraRtmpConnection.h:227
RTMP_CONNECTION_STATE state
Definition: NGIAgoraRtmpConnection.h:231
RtmpConnectionInfo()
Definition: NGIAgoraRtmpConnection.h:233
Definition: NGIAgoraRtmpConnection.h:21
int numberOfChannels
Definition: NGIAgoraRtmpConnection.h:37
RtmpStreamingAudioConfiguration()
Definition: NGIAgoraRtmpConnection.h:44
int bytesPerSample
Definition: NGIAgoraRtmpConnection.h:30
int bitrate
Definition: NGIAgoraRtmpConnection.h:42
int sampleRateHz
Definition: NGIAgoraRtmpConnection.h:25
Definition: NGIAgoraRtmpConnection.h:51
int width
Definition: NGIAgoraRtmpConnection.h:59
RtmpStreamingVideoConfiguration()
Definition: NGIAgoraRtmpConnection.h:108
unsigned int gopInMs
Definition: NGIAgoraRtmpConnection.h:93
int framerate
Definition: NGIAgoraRtmpConnection.h:73
int encoderHwSwMode
Definition: NGIAgoraRtmpConnection.h:101
int height
Definition: NGIAgoraRtmpConnection.h:68
ORIENTATION_MODE orientationMode
Definition: NGIAgoraRtmpConnection.h:106
int bitrate
Definition: NGIAgoraRtmpConnection.h:78
int maxBitrate
Definition: NGIAgoraRtmpConnection.h:83
int minBitrate
Definition: NGIAgoraRtmpConnection.h:88