Agora RTC Objective-C API Reference  Refactor
IAgoraMediaStreamingSource.h
Go to the documentation of this file.
1 //
2 // Agora SDK
3 // Copyright (c) 2019 Agora.io. All rights reserved.
4 //
5 // Created by xiaohua.lu in 2020-03.
6 // CodeStyle: Google C++
7 //
8 
9 #pragma once // NOLINT(build/header_guard)
10 
11 
12 #include "AgoraBase.h"
13 #include "AgoraMediaBase.h"
14 #include "AgoraMediaPlayerTypes.h"
15 #include "AgoraRefPtr.h"
16 
17 namespace agora {
18 namespace rtc {
19 
20 
21 class IMediaStreamingSourceObserver;
22 
23 
51 };
52 
53 
54 
67 };
68 
69 
74 struct InputSeiData {
75  int32_t type;
76  int64_t timestamp;
77  int64_t frame_index;
78  uint8_t* private_data;
79  int32_t data_size;
80 };
81 
82 
83 
90 public:
91  virtual ~IMediaStreamingSource() {};
92 
93 
103  virtual int open(const char* url, int64_t start_pos, bool auto_play = true) = 0;
104 
111  virtual int close() = 0;
112 
119  virtual int getSourceId() const = 0;
120 
125  virtual bool isVideoValid() = 0;
126 
131  virtual bool isAudioValid() = 0;
132 
140  virtual int getDuration(int64_t& duration) = 0;
141 
149  virtual int getStreamCount(int64_t& count) = 0;
150 
159  virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* out_info) = 0;
160 
171  virtual int setLoopCount(int64_t loop_count) = 0;
172 
179  virtual int play() = 0;
180 
187  virtual int pause() = 0;
188 
195  virtual int stop() = 0;
196 
205  virtual int seek(int64_t new_pos) = 0;
206 
214  virtual int getCurrPosition(int64_t& pos) = 0;
215 
221 
232  virtual int appendSeiData(const InputSeiData& inSeiData) = 0;
233 
244 
253 
263  virtual int parseMediaInfo(const char* url,
264  media::base::PlayerStreamInfo& video_info,
265  media::base::PlayerStreamInfo& audio_info) = 0;
266 
267 };
268 
269 
270 
275  public:
277 
278 
287  virtual void onStateChanged(STREAMING_SRC_STATE state, STREAMING_SRC_ERR err_code) = 0;
288 
294  virtual void onOpenDone(STREAMING_SRC_ERR err_code) = 0;
295 
301  virtual void onSeekDone(STREAMING_SRC_ERR err_code) = 0;
302 
308  virtual void onEofOnce(int64_t progress_ms, int64_t repeat_count) = 0;
309 
315  virtual void onProgress(int64_t position_ms) = 0;
316 
324  virtual void onMetaData(const void* data, int length) = 0;
325 
326 };
327 
328 
329 
330 } //namespace rtc
331 } // namespace agora
332 
agora::rtc::STREAMING_SRC_ERR_NOT_EXIST
@ STREAMING_SRC_ERR_NOT_EXIST
component not exist
Definition: IAgoraMediaStreamingSource.h:40
agora::rtc::IMediaStreamingSourceObserver::onSeekDone
virtual void onSeekDone(STREAMING_SRC_ERR err_code)=0
Triggered when seeking is done.
agora::rtc::STREAMING_SRC_ERR_EXIST
@ STREAMING_SRC_ERR_EXIST
component already exist
Definition: IAgoraMediaStreamingSource.h:41
AgoraBase.h
agora::rtc::STREAMING_SRC_ERR_UNKNOWN
@ STREAMING_SRC_ERR_UNKNOWN
unknown error
Definition: IAgoraMediaStreamingSource.h:30
agora::rtc::IMediaStreamingSourceObserver::onEofOnce
virtual void onEofOnce(int64_t progress_ms, int64_t repeat_count)=0
Triggered when playing is EOF.
agora::rtc::InputSeiData
The input SEI data.
Definition: IAgoraMediaStreamingSource.h:74
agora::rtc::IMediaStreamingSource::getCurrState
virtual STREAMING_SRC_STATE getCurrState()=0
agora::rtc::IMediaStreamingSource::registerObserver
virtual int registerObserver(IMediaStreamingSourceObserver *observer)=0
agora::rtc::IMediaStreamingSourceObserver::onProgress
virtual void onProgress(int64_t position_ms)=0
Reports current playback progress. The callback triggered once every one second during the playing st...
agora::rtc::STREAMING_SRC_ERR_OPEN
@ STREAMING_SRC_ERR_OPEN
fail to IO open
Definition: IAgoraMediaStreamingSource.h:42
agora::rtc::STREAMING_SRC_ERR_INVALID_PARAM
@ STREAMING_SRC_ERR_INVALID_PARAM
invalid parameter
Definition: IAgoraMediaStreamingSource.h:31
agora::rtc::IMediaStreamingSource::getCurrPosition
virtual int getCurrPosition(int64_t &pos)=0
Gets the current playback position of the media file.
agora::rtc::STREAMING_SRC_ERR_BUFFER_UNDERFLOW
@ STREAMING_SRC_ERR_BUFFER_UNDERFLOW
buffer underflow
Definition: IAgoraMediaStreamingSource.h:35
agora::rtc::STREAMING_SRC_ERR_NO_MEM
@ STREAMING_SRC_ERR_NO_MEM
not enough memory
Definition: IAgoraMediaStreamingSource.h:33
agora::rtc::IMediaStreamingSource::getStreamCount
virtual int getStreamCount(int64_t &count)=0
Gets the number of the streming source.
agora::rtc::STREAMING_SRC_ERR_CODECOPEN
@ STREAMING_SRC_ERR_CODECOPEN
fail to codec open
Definition: IAgoraMediaStreamingSource.h:48
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::IMediaStreamingSource::parseMediaInfo
virtual int parseMediaInfo(const char *url, media::base::PlayerStreamInfo &video_info, media::base::PlayerStreamInfo &audio_info)=0
Parse a media information with a specified URL.
agora::rtc::IMediaStreamingSourceObserver
This observer interface of media streaming source.
Definition: IAgoraMediaStreamingSource.h:274
agora::rtc::InputSeiData::private_data
uint8_t * private_data
SEI really data.
Definition: IAgoraMediaStreamingSource.h:78
agora::rtc::STREAMING_SRC_STATE_EOF
@ STREAMING_SRC_STATE_EOF
The position is located at end, can NOT playing.
Definition: IAgoraMediaStreamingSource.h:65
agora::rtc::STREAMING_SRC_ERR_CLOSE
@ STREAMING_SRC_ERR_CLOSE
fail to IO close
Definition: IAgoraMediaStreamingSource.h:43
agora::rtc::IMediaStreamingSource::appendSeiData
virtual int appendSeiData(const InputSeiData &inSeiData)=0
append the SEI data which can be sent attached to video packet
agora::rtc::STREAMING_SRC_ERR_NOT_FOUND
@ STREAMING_SRC_ERR_NOT_FOUND
buffer underflow
Definition: IAgoraMediaStreamingSource.h:36
agora::rtc::InputSeiData::frame_index
int64_t frame_index
the frame index which be attached
Definition: IAgoraMediaStreamingSource.h:77
agora::rtc::STREAMING_SRC_STATE_ERROR
@ STREAMING_SRC_STATE_ERROR
The error status and can do nothing except close.
Definition: IAgoraMediaStreamingSource.h:66
agora::rtc::IMediaStreamingSourceObserver::onStateChanged
virtual void onStateChanged(STREAMING_SRC_STATE state, STREAMING_SRC_ERR err_code)=0
Reports the playback state change. When the state of the playback changes, the SDK triggers this call...
agora::rtc::STREAMING_SRC_ERR
STREAMING_SRC_ERR
The error code of streaming source.
Definition: IAgoraMediaStreamingSource.h:28
agora::rtc::STREAMING_SRC_ERR_CODECPROC
@ STREAMING_SRC_ERR_CODECPROC
fail to codec process
Definition: IAgoraMediaStreamingSource.h:50
agora::rtc::InputSeiData::timestamp
int64_t timestamp
the frame timestamp which be attached
Definition: IAgoraMediaStreamingSource.h:76
agora::rtc::IMediaStreamingSource::~IMediaStreamingSource
virtual ~IMediaStreamingSource()
Definition: IAgoraMediaStreamingSource.h:91
agora::rtc::IMediaStreamingSource::getDuration
virtual int getDuration(int64_t &duration)=0
Gets the duration of the streaming source.
agora::media::base::PlayerStreamInfo
The information of the media stream object.
Definition: AgoraMediaPlayerTypes.h:264
agora::rtc::STREAMING_SRC_ERR_NONE
@ STREAMING_SRC_ERR_NONE
no error
Definition: IAgoraMediaStreamingSource.h:29
agora::rtc::STREAMING_SRC_STATE_PLAYING
@ STREAMING_SRC_STATE_PLAYING
after call play() method, playing & pushing the AV data
Definition: IAgoraMediaStreamingSource.h:63
agora::rtc::IMediaStreamingSource::stop
virtual int stop()=0
Stop the playing & pushing of the streaming source, set the position to 0.
agora::rtc::IMediaStreamingSource
The IMediaStreamingSource class provides access to a media streaming source demuxer....
Definition: IAgoraMediaStreamingSource.h:89
agora::rtc::STREAMING_SRC_STATE
STREAMING_SRC_STATE
The state machine of Streaming Source.
Definition: IAgoraMediaStreamingSource.h:59
agora::rtc::STREAMING_SRC_STATE_OPENING
@ STREAMING_SRC_STATE_OPENING
after call open() method and start parsing streaming source
Definition: IAgoraMediaStreamingSource.h:61
agora::rtc::IMediaStreamingSource::unregisterObserver
virtual int unregisterObserver(IMediaStreamingSourceObserver *observer)=0
agora::rtc::STREAMING_SRC_ERR_EXPIRED
@ STREAMING_SRC_ERR_EXPIRED
expired
Definition: IAgoraMediaStreamingSource.h:38
agora::rtc::IMediaStreamingSource::setLoopCount
virtual int setLoopCount(int64_t loop_count)=0
Sets whether to loop the streaming source for playback.
agora::rtc::STREAMING_SRC_STATE_CLOSED
@ STREAMING_SRC_STATE_CLOSED
streaming source still closed, can do nothing
Definition: IAgoraMediaStreamingSource.h:60
agora::rtc::IMediaStreamingSource::open
virtual int open(const char *url, int64_t start_pos, bool auto_play=true)=0
Opens a media streaming source with a specified URL.
agora::rtc::STREAMING_SRC_ERR_UNSUPPORTED
@ STREAMING_SRC_ERR_UNSUPPORTED
unsupported
Definition: IAgoraMediaStreamingSource.h:39
agora::rtc::STREAMING_SRC_ERR_BUFFER_OVERFLOW
@ STREAMING_SRC_ERR_BUFFER_OVERFLOW
buffer overflow
Definition: IAgoraMediaStreamingSource.h:34
AgoraRefPtr.h
agora::rtc::IMediaStreamingSource::play
virtual int play()=0
Play & push the streaming source.
agora::rtc::STREAMING_SRC_ERR_SEEK
@ STREAMING_SRC_ERR_SEEK
fail to IO seek
Definition: IAgoraMediaStreamingSource.h:46
agora::rtc::IMediaStreamingSource::pause
virtual int pause()=0
Pauses the playing & pushing of the streaming source, Keep current position.
AgoraMediaBase.h
agora::rtc::STREAMING_SRC_ERR_EOF
@ STREAMING_SRC_ERR_EOF
reach to IO EOF, can do nothing
Definition: IAgoraMediaStreamingSource.h:47
agora::rtc::IMediaStreamingSource::seek
virtual int seek(int64_t new_pos)=0
Sets the playback position of the streaming source. After seek done, it will return to previous statu...
AgoraMediaPlayerTypes.h
agora::rtc::InputSeiData::data_size
int32_t data_size
size of really data
Definition: IAgoraMediaStreamingSource.h:79
agora::rtc::STREAMING_SRC_ERR_WRITE
@ STREAMING_SRC_ERR_WRITE
fail to IO write
Definition: IAgoraMediaStreamingSource.h:45
agora::rtc::IMediaStreamingSource::isAudioValid
virtual bool isAudioValid()=0
Retrieve whether audio stream is valid.
agora::RefCountInterface
Definition: AgoraRefPtr.h:31
agora::rtc::STREAMING_SRC_STATE_IDLE
@ STREAMING_SRC_STATE_IDLE
streaming source is ready waiting for play
Definition: IAgoraMediaStreamingSource.h:62
agora::rtc::IMediaStreamingSource::getSourceId
virtual int getSourceId() const =0
Gets the unique source ID of the streaming source.
agora::rtc::IMediaStreamingSource::close
virtual int close()=0
Close current media streaming source.
agora::rtc::STREAMING_SRC_ERR_READ
@ STREAMING_SRC_ERR_READ
fail to IO read
Definition: IAgoraMediaStreamingSource.h:44
agora::rtc::IMediaStreamingSourceObserver::onMetaData
virtual void onMetaData(const void *data, int length)=0
Occurs when the metadata is received. The callback occurs when the player receives the media metadata...
agora::rtc::IMediaStreamingSource::getStreamInfo
virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo *out_info)=0
Gets the detailed information of a media stream.
agora::rtc::InputSeiData::type
int32_t type
SEI type.
Definition: IAgoraMediaStreamingSource.h:75
agora::rtc::STREAMING_SRC_ERR_BAD_STATE
@ STREAMING_SRC_ERR_BAD_STATE
bad status
Definition: IAgoraMediaStreamingSource.h:32
agora::rtc::IMediaStreamingSourceObserver::onOpenDone
virtual void onOpenDone(STREAMING_SRC_ERR err_code)=0
Triggered when file is opened.
agora::rtc::STREAMING_SRC_ERR_CODECCLOSE
@ STREAMING_SRC_ERR_CODECCLOSE
fail to codec close
Definition: IAgoraMediaStreamingSource.h:49
agora::rtc::IMediaStreamingSource::isVideoValid
virtual bool isVideoValid()=0
Retrieve whether video stream is valid.
agora::rtc::STREAMING_SRC_ERR_TIMEOUT
@ STREAMING_SRC_ERR_TIMEOUT
buffer underflow
Definition: IAgoraMediaStreamingSource.h:37
agora::rtc::IMediaStreamingSourceObserver::~IMediaStreamingSourceObserver
virtual ~IMediaStreamingSourceObserver()
Definition: IAgoraMediaStreamingSource.h:276
agora::rtc::STREAMING_SRC_STATE_SEEKING
@ STREAMING_SRC_STATE_SEEKING
after call seek() method, start seeking poisition
Definition: IAgoraMediaStreamingSource.h:64