Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
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
18namespace webrtc {
19class VideoFrame;
20} // namespace webrtc
21
22namespace agora {
23namespace base {
24class BaseWorker;
25class IAgoraService;
26} // namespace base
27
28namespace 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::agora_refptr
Definition AgoraRefPtr.h:44
agora::base::IAgoraService
Definition IAgoraService.h:413
agora::media::base::IVideoFrameObserver
Definition AgoraMediaBase.h:1172
agora::rtc::IMediaPlayerSourceEx
Definition media_player_source_i.h:30
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)
agora::rtc::IMediaPlayerSourceEx::registerPlayerSourceObserver
int registerPlayerSourceObserver(IMediaPlayerSourceObserver *observer) final
Definition media_player_source_i.h:46
agora::rtc::IMediaPlayerSourceEx::getFirstAudioFramePts
virtual int64_t getFirstAudioFramePts()=0
agora::rtc::IMediaPlayerSourceEx::getFirstVideoFramePts
virtual int64_t getFirstVideoFramePts()=0
agora::rtc::IMediaPlayerSourceEx::~IMediaPlayerSourceEx
virtual ~IMediaPlayerSourceEx()=default
agora::rtc::IMediaPlayerSourceEx::registerPlayerSourceObserverEx
virtual int registerPlayerSourceObserverEx(IMediaPlayerSourceObserver *observer, bool internal)=0
agora::rtc::IMediaPlayerSourceEx::setRenderLastVideoFrame
virtual void setRenderLastVideoFrame(bool set_black_frame)=0
agora::rtc::IMediaPlayerSourceEx::getAudioPcmDataSender
virtual agora_refptr< rtc::IAudioPcmDataSender > getAudioPcmDataSender()=0
agora::rtc::IMediaPlayerSourceEx::showBlackFrameWhenStop
virtual bool showBlackFrameWhenStop()=0
agora::rtc::IMediaPlayerSourceEx::onPlayerSourceObserverCallback
virtual void onPlayerSourceObserverCallback(std::function< void(IMediaPlayerSourceObserver *)> &&task)=0
agora::rtc::IMediaPlayerSourceEx::getPlayerOption
virtual int getPlayerOption(const char *key, int64_t &value)=0
agora::rtc::IMediaPlayerSourceEx::getVideoFrameSender
virtual agora_refptr< rtc::IVideoFrameSender > getVideoFrameSender()=0
agora::rtc::IMediaPlayerSource
Definition IAgoraMediaPlayerSource.h:22
agora::rtc::IMediaPlayerSourceObserver
Definition IAgoraMediaPlayerSource.h:401
agora::rtc::IMediaPlayerVideoFrameObserverEx
Definition media_player_source_i.h:55
agora::rtc::IMediaPlayerVideoFrameObserverEx::isExternal
bool isExternal() final
Definition media_player_source_i.h:61
agora::rtc::IMediaPlayerVideoFrameObserverEx::onFrame
virtual void onFrame(webrtc::VideoFrame &videoFrame)=0
agora::rtc::IMediaPlayerVideoFrameObserverEx::onFrame
virtual void onFrame(const agora::media::base::VideoFrame *frame) final
Occurs each time the player receives a video frame.
Definition media_player_source_i.h:58
agora::rtc::IMediaPlayerVideoFrameObserverEx::~IMediaPlayerVideoFrameObserverEx
virtual ~IMediaPlayerVideoFrameObserverEx()
Definition media_player_source_i.h:57
agora::base
Definition IAgoraService.h:73
agora::internal
Definition AgoraOptional.h:54
agora::media::base::MEDIA_PLAYER_SOURCE_TYPE
MEDIA_PLAYER_SOURCE_TYPE
Definition AgoraMediaBase.h:1216
agora::media::base::MEDIA_PLAYER_SOURCE_DEFAULT
@ MEDIA_PLAYER_SOURCE_DEFAULT
Definition AgoraMediaBase.h:1222
agora::rtc
Definition AgoraExtensions.h:5
agora
Definition AgoraAtomicOps.h:21
webrtc
Definition common_defines.h:18
agora::media::base::VideoFrame
Configurations of the video frame.
Definition AgoraMediaBase.h:1024