Agora C++ API Reference for All Platforms

media_player_source_i.h
1 //
2 // Agora RTC/MEDIA SDK
3 //
4 // Created by Pengfei Han in 2019-11.
5 // Copyright (c) 2019 Agora.io. All rights reserved.
6 //
7 #pragma once
8
9 #include <memory>
10 #include <functional>
11 #include "AgoraRefPtr.h"
12 #include "AgoraMediaBase.h"
13 #include "IAgoraMediaPlayerSource.h"
14 #include "NGIAgoraMediaNodeFactory.h"
15 #include "NGIAgoraMediaNode.h"
16
17
18 namespace webrtc {
19 class VideoFrame;
20 } // namespace webrtc
21
22 namespace agora {
23 namespace base {
24 class BaseWorker;
25 class IAgoraService;
26 } // namespace base
27
28 namespace rtc {
29
30 class IMediaPlayerSourceEx : public IMediaPlayerSource {
31 protected:
32 virtual ~IMediaPlayerSourceEx() = default;
33
34 public:
35 static agora_refptr<IMediaPlayerSourceEx> Create(base::IAgoraService *agora_service,
36 media::base::MEDIA_PLAYER_SOURCE_TYPE type = media::base::MEDIA_PLAYER_SOURCE_DEFAULT);
37
38 virtual agora_refptr<rtc::IAudioPcmDataSender> getAudioPcmDataSender() = 0;
39 virtual agora_refptr<rtc::IVideoFrameSender> getVideoFrameSender() = 0;
40 virtual void setRenderLastVideoFrame(bool set_black_frame) = 0;
41 virtual bool showBlackFrameWhenStop() = 0;
42 virtual int64_t getFirstAudioFramePts() = 0;
43 virtual int64_t getFirstVideoFramePts() = 0;
44 virtual int getPlayerOption(const char* key, int64_t& value) = 0;
45 virtual int registerPlayerSourceObserverEx(IMediaPlayerSourceObserver* observer, bool internal) = 0;
46 int registerPlayerSourceObserver(IMediaPlayerSourceObserver* observer) final {
47 return registerPlayerSourceObserverEx(observer, false);
48 }
49 virtual void onPlayerSourceObserverCallback(std::function<void(IMediaPlayerSourceObserver*)>&& task) = 0;
50 };
51
55 class IMediaPlayerVideoFrameObserverEx : public agora::media::base::IVideoFrameObserver {
56 public:
57 virtual ~IMediaPlayerVideoFrameObserverEx() {}
58 virtual void onFrame(const agora::media::base::VideoFrame* frame) final { return; }
59 virtual void onFrame(webrtc::VideoFrame& videoFrame) = 0;
60
61 bool isExternal() final { return false; }
62 };
63
64 } // namespace rtc
65 } // namespace agora
agora::media::base::VideoFrame
Definition: AgoraMediaBase.h:963
agora::rtc::IMediaPlayerVideoFrameObserverEx::onFrame
virtual void onFrame(webrtc::VideoFrame &videoFrame)=0
agora::base::IAgoraService
Definition: IAgoraService.h:395
agora::media::base::MEDIA_PLAYER_SOURCE_TYPE
MEDIA_PLAYER_SOURCE_TYPE
Definition: AgoraMediaBase.h:1122
agora::rtc::IMediaPlayerSourceEx::getPlayerOption
virtual int getPlayerOption(const char *key, int64_t &value)=0
agora::media::base::MEDIA_PLAYER_SOURCE_DEFAULT
@ MEDIA_PLAYER_SOURCE_DEFAULT
Definition: AgoraMediaBase.h:1128
agora::rtc::IMediaPlayerVideoFrameObserverEx::onFrame
virtual void onFrame(const agora::media::base::VideoFrame *frame) final
Definition: media_player_source_i.h:58
agora::agora_refptr
Definition: AgoraRefPtr.h:44
agora::rtc::IMediaPlayerSource
Definition: IAgoraMediaPlayerSource.h:22
webrtc
Definition: common_defines.h:18
agora::rtc::IMediaPlayerSourceEx::onPlayerSourceObserverCallback
virtual void onPlayerSourceObserverCallback(std::function< void(IMediaPlayerSourceObserver *)> &&task)=0
agora::rtc::IMediaPlayerSourceObserver
Definition: IAgoraMediaPlayerSource.h:380
agora::media::base::IVideoFrameObserver
Definition: AgoraMediaBase.h:1106
agora::rtc::IMediaPlayerVideoFrameObserverEx
Definition: media_player_source_i.h:55
agora::rtc::IMediaPlayerSourceEx::setRenderLastVideoFrame
virtual void setRenderLastVideoFrame(bool set_black_frame)=0
agora::rtc::IMediaPlayerSourceEx::getFirstAudioFramePts
virtual int64_t getFirstAudioFramePts()=0
agora::rtc::IMediaPlayerSourceEx::registerPlayerSourceObserver
int registerPlayerSourceObserver(IMediaPlayerSourceObserver *observer) final
Definition: media_player_source_i.h:46
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::IMediaPlayerSourceEx::getVideoFrameSender
virtual agora_refptr< rtc::IVideoFrameSender > getVideoFrameSender()=0
agora::rtc::IMediaPlayerSourceEx
Definition: media_player_source_i.h:30
agora::rtc::IMediaPlayerSourceEx::showBlackFrameWhenStop
virtual bool showBlackFrameWhenStop()=0
agora::rtc::IMediaPlayerVideoFrameObserverEx::isExternal
bool isExternal() final
Definition: media_player_source_i.h:61
agora::rtc::IMediaPlayerSourceEx::registerPlayerSourceObserverEx
virtual int registerPlayerSourceObserverEx(IMediaPlayerSourceObserver *observer, bool internal)=0
agora::rtc::IMediaPlayerSourceEx::getAudioPcmDataSender
virtual agora_refptr< rtc::IAudioPcmDataSender > getAudioPcmDataSender()=0
agora::rtc::IMediaPlayerSourceEx::getFirstVideoFramePts
virtual int64_t getFirstVideoFramePts()=0
agora::rtc::IMediaPlayerSourceEx::~IMediaPlayerSourceEx
virtual ~IMediaPlayerSourceEx()=default
agora::rtc::IMediaPlayerVideoFrameObserverEx::~IMediaPlayerVideoFrameObserverEx
virtual ~IMediaPlayerVideoFrameObserverEx()
Definition: media_player_source_i.h:57
agora::rtc::IMediaPlayerSourceEx::Create
static agora_refptr< IMediaPlayerSourceEx > Create(base::IAgoraService *agora_service, media::base::MEDIA_PLAYER_SOURCE_TYPE type=media::base::MEDIA_PLAYER_SOURCE_DEFAULT)
rtc
Definition: video_node_i.h:28