Agora C++ API Reference for All Platforms
Loading...
Searching...
No Matches
IAgoraMediaStreamingSource.h
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
17namespace agora {
18namespace rtc {
19
20
22
23
54
55
56
72
73
81 int32_t type;
82 int64_t timestamp;
83 int64_t frame_index;
84 uint8_t* private_data;
85 int32_t data_size;
86};
87
88
89
98public:
100
101
111 virtual int open(const char* url, int64_t start_pos, bool auto_play = true) = 0;
112
119 virtual int close() = 0;
120
127 virtual int getSourceId() const = 0;
128
133 virtual bool isVideoValid() = 0;
134
139 virtual bool isAudioValid() = 0;
140
148 virtual int getDuration(int64_t& duration) = 0;
149
157 virtual int getStreamCount(int64_t& count) = 0;
158
167 virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo* out_info) = 0;
168
179 virtual int setLoopCount(int64_t loop_count) = 0;
180
187 virtual int play() = 0;
188
195 virtual int pause() = 0;
196
203 virtual int stop() = 0;
204
213 virtual int seek(int64_t new_pos) = 0;
214
222 virtual int getCurrPosition(int64_t& pos) = 0;
223
229
240 virtual int appendSeiData(const InputSeiData& inSeiData) = 0;
241
252
261
271 virtual int parseMediaInfo(const char* url,
273 media::base::PlayerStreamInfo& audio_info) = 0;
274
275};
276
277
278
285 public:
287
288
297 virtual void onStateChanged(STREAMING_SRC_STATE state, STREAMING_SRC_ERR err_code) = 0;
298
304 virtual void onOpenDone(STREAMING_SRC_ERR err_code) = 0;
305
311 virtual void onSeekDone(STREAMING_SRC_ERR err_code) = 0;
312
318 virtual void onEofOnce(int64_t progress_ms, int64_t repeat_count) = 0;
319
325 virtual void onProgress(int64_t position_ms) = 0;
326
334 virtual void onMetaData(const void* data, int length) = 0;
335
336};
337
338
339
340} //namespace rtc
341} // namespace agora
342
Definition AgoraRefPtr.h:31
The IMediaStreamingSource class provides access to a media streaming source demuxer....
Definition IAgoraMediaStreamingSource.h:97
virtual int getStreamInfo(int64_t index, media::base::PlayerStreamInfo *out_info)=0
Gets the detailed information of a media stream.
virtual int play()=0
Play & push the streaming source.
virtual STREAMING_SRC_STATE getCurrState()=0
virtual int setLoopCount(int64_t loop_count)=0
Sets whether to loop the streaming source for playback.
virtual int open(const char *url, int64_t start_pos, bool auto_play=true)=0
Opens a media streaming source with a specified URL.
virtual int stop()=0
Stop the playing & pushing of the streaming source, set the position to 0.
virtual bool isVideoValid()=0
Retrieve whether video stream is valid.
virtual int getDuration(int64_t &duration)=0
Gets the duration of the streaming source.
virtual int unregisterObserver(IMediaStreamingSourceObserver *observer)=0
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.
virtual int getSourceId() const =0
Gets the unique source ID of the streaming source.
virtual int getCurrPosition(int64_t &pos)=0
Gets the current playback position of the media file.
virtual bool isAudioValid()=0
Retrieve whether audio stream is valid.
virtual ~IMediaStreamingSource()
Definition IAgoraMediaStreamingSource.h:99
virtual int pause()=0
Pauses the playing & pushing of the streaming source, Keep current position.
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...
virtual int appendSeiData(const InputSeiData &inSeiData)=0
append the SEI data which can be sent attached to video packet
virtual int registerObserver(IMediaStreamingSourceObserver *observer)=0
virtual int getStreamCount(int64_t &count)=0
Gets the number of the streming source.
virtual int close()=0
Close current media streaming source.
This observer interface of media streaming source.
Definition IAgoraMediaStreamingSource.h:284
virtual void onOpenDone(STREAMING_SRC_ERR err_code)=0
Triggered when file is opened.
virtual void onSeekDone(STREAMING_SRC_ERR err_code)=0
Triggered when seeking is done.
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...
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...
virtual void onProgress(int64_t position_ms)=0
Reports current playback progress. The callback triggered once every one second during the playing st...
virtual ~IMediaStreamingSourceObserver()
Definition IAgoraMediaStreamingSource.h:286
virtual void onEofOnce(int64_t progress_ms, int64_t repeat_count)=0
Triggered when playing is EOF.
Definition AgoraExtensions.h:5
STREAMING_SRC_ERR
The error code of streaming source.
Definition IAgoraMediaStreamingSource.h:30
@ STREAMING_SRC_ERR_CLOSE
fail to IO close
Definition IAgoraMediaStreamingSource.h:45
@ STREAMING_SRC_ERR_EXPIRED
expired
Definition IAgoraMediaStreamingSource.h:40
@ STREAMING_SRC_ERR_EOF
reach to IO EOF, can do nothing
Definition IAgoraMediaStreamingSource.h:49
@ STREAMING_SRC_ERR_CODECOPEN
fail to codec open
Definition IAgoraMediaStreamingSource.h:50
@ STREAMING_SRC_ERR_CODECPROC
fail to codec process
Definition IAgoraMediaStreamingSource.h:52
@ STREAMING_SRC_ERR_NOT_FOUND
buffer underflow
Definition IAgoraMediaStreamingSource.h:38
@ STREAMING_SRC_ERR_WRITE
fail to IO write
Definition IAgoraMediaStreamingSource.h:47
@ STREAMING_SRC_ERR_NO_MEM
not enough memory
Definition IAgoraMediaStreamingSource.h:35
@ STREAMING_SRC_ERR_TIMEOUT
buffer underflow
Definition IAgoraMediaStreamingSource.h:39
@ STREAMING_SRC_ERR_UNSUPPORTED
unsupported
Definition IAgoraMediaStreamingSource.h:41
@ STREAMING_SRC_ERR_NOT_EXIST
component not exist
Definition IAgoraMediaStreamingSource.h:42
@ STREAMING_SRC_ERR_BAD_STATE
bad status
Definition IAgoraMediaStreamingSource.h:34
@ STREAMING_SRC_ERR_SEEK
fail to IO seek
Definition IAgoraMediaStreamingSource.h:48
@ STREAMING_SRC_ERR_READ
fail to IO read
Definition IAgoraMediaStreamingSource.h:46
@ STREAMING_SRC_ERR_NONE
no error
Definition IAgoraMediaStreamingSource.h:31
@ STREAMING_SRC_ERR_INVALID_PARAM
invalid parameter
Definition IAgoraMediaStreamingSource.h:33
@ STREAMING_SRC_ERR_UNKNOWN
unknown error
Definition IAgoraMediaStreamingSource.h:32
@ STREAMING_SRC_ERR_BUFFER_UNDERFLOW
buffer underflow
Definition IAgoraMediaStreamingSource.h:37
@ STREAMING_SRC_ERR_EXIST
component already exist
Definition IAgoraMediaStreamingSource.h:43
@ STREAMING_SRC_ERR_CODECCLOSE
fail to codec close
Definition IAgoraMediaStreamingSource.h:51
@ STREAMING_SRC_ERR_BUFFER_OVERFLOW
buffer overflow
Definition IAgoraMediaStreamingSource.h:36
@ STREAMING_SRC_ERR_OPEN
fail to IO open
Definition IAgoraMediaStreamingSource.h:44
STREAMING_SRC_STATE
The state machine of Streaming Source.
Definition IAgoraMediaStreamingSource.h:63
@ STREAMING_SRC_STATE_ERROR
The error status and can do nothing except close.
Definition IAgoraMediaStreamingSource.h:70
@ STREAMING_SRC_STATE_PLAYING
after call play() method, playing & pushing the AV data
Definition IAgoraMediaStreamingSource.h:67
@ STREAMING_SRC_STATE_CLOSED
streaming source still closed, can do nothing
Definition IAgoraMediaStreamingSource.h:64
@ STREAMING_SRC_STATE_EOF
The position is located at end, can NOT playing.
Definition IAgoraMediaStreamingSource.h:69
@ STREAMING_SRC_STATE_IDLE
streaming source is ready waiting for play
Definition IAgoraMediaStreamingSource.h:66
@ STREAMING_SRC_STATE_OPENING
after call open() method and start parsing streaming source
Definition IAgoraMediaStreamingSource.h:65
@ STREAMING_SRC_STATE_SEEKING
after call seek() method, start seeking poisition
Definition IAgoraMediaStreamingSource.h:68
Definition AgoraAtomicOps.h:21
The information of the media stream object.
Definition AgoraMediaPlayerTypes.h:266
The input SEI data.
Definition IAgoraMediaStreamingSource.h:80
int64_t timestamp
the frame timestamp which be attached
Definition IAgoraMediaStreamingSource.h:82
int64_t frame_index
the frame index which be attached
Definition IAgoraMediaStreamingSource.h:83
int32_t data_size
size of really data
Definition IAgoraMediaStreamingSource.h:85
int32_t type
SEI type.
Definition IAgoraMediaStreamingSource.h:81
uint8_t * private_data
SEI really data.
Definition IAgoraMediaStreamingSource.h:84