Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
video_codec_provider_i.h
1//
2// Agora SDK
3//
4// Copyright (c) 2021 Agora.io. All rights reserved.
5//
6
7#pragma once
8
9#include "NGIAgoraExtensionProvider.h"
10#include "AgoraExtensionVersion.h"
11#include <api/aosl_mpq.h>
12#include <api/cpp/aosl_ref_class.h>
13
14 namespace webrtc {
15 class VideoEncoder;
16 class VideoDecoder;
17} // namespace webrtc
18
19 namespace agora {
20 namespace rtc {
21
22 static const int MAX_ENCODER_NUM_PER_PROVIDER = 5;
23 static const int MAX_DECODER_NUM_PER_PROVIDER = 5;
24
25// string literals for codec property keys
26 static const char* const PROP_KEY_CODEC_SDP_FORMAT_JSON = "video_sdp_format_json";
27
28 struct VideoCodecInfo {
29 const char* codec_name = nullptr;
30 const char* impl_type = nullptr;
31 bool is_hw_accelerated = false;
32};
33
34 static const int32_t MAX_JSON_LEN = 1000;
35 struct VideoSdpFormatJson {
36 char json_str[MAX_JSON_LEN];
37 int32_t str_len = 0;
38};
39
40 class IVideoEncoderProvider : public IExtensionProvider {
41 public:
42 virtual ~IVideoEncoderProvider() {}
43 virtual int enumerateEncoders(VideoCodecInfo* info_list, int& count) = 0;
44 virtual webrtc::VideoEncoder* createEncoder(const VideoCodecInfo& info, aosl_mpq_t mpq = AOSL_MPQ_INVALID) = 0;
45 virtual int destroyEncoder(webrtc::VideoEncoder* encoder) = 0;
46 virtual int getCustomProperty(const VideoCodecInfo& info,
47 const char* key, void* data) {
48 return -1;
49 }
50 virtual int setCustomProperty(const VideoCodecInfo& info,
51 const char* key, const void* data) {
52 return -1;
53 }
54};
55
56 class IVideoDecoderProvider : public IExtensionProvider {
57 public:
58 virtual ~IVideoDecoderProvider() {}
59 virtual int enumerateDecoders(VideoCodecInfo* info_list, int& count) = 0;
60 virtual webrtc::VideoDecoder* createDecoder(const VideoCodecInfo& info, aosl_mpq_t mpq) = 0;
61 virtual int destroyDecoder(webrtc::VideoDecoder* decoder) = 0;
62 virtual int getCustomProperty(const VideoCodecInfo& info,
63 const char* key, void* data) {
64 return -1;
65 }
66 virtual int setCustomProperty(const VideoCodecInfo& info,
67 const char* key, const void* data) {
68 return -1;
69 }
70};
71
72#define RESERVED_ENCODER_PROVIDER_MAJOR_VERSION 10000
73 template <>
74 struct ExtensionInterfaceVersion<IVideoEncoderProvider> {
75 static ExtensionVersion Version() {
76 return ExtensionVersion(RESERVED_ENCODER_PROVIDER_MAJOR_VERSION, 0, 0);
77 }
78};
79
80#define RESERVED_DECODER_PROVIDER_MAJOR_VERSION 20000
81 template <>
82 struct ExtensionInterfaceVersion<IVideoDecoderProvider> {
83 static ExtensionVersion Version() {
84 return ExtensionVersion(RESERVED_DECODER_PROVIDER_MAJOR_VERSION, 0, 0);
85 }
86};
87
88} // namespace rtc
89} // namespace agora
agora::rtc::IExtensionProvider
Definition NGIAgoraExtensionProvider.h:35
agora::rtc::IVideoDecoderProvider
Definition video_codec_provider_i.h:56
agora::rtc::IVideoDecoderProvider::destroyDecoder
virtual int destroyDecoder(webrtc::VideoDecoder *decoder)=0
agora::rtc::IVideoDecoderProvider::createDecoder
virtual webrtc::VideoDecoder * createDecoder(const VideoCodecInfo &info, aosl_mpq_t mpq)=0
agora::rtc::IVideoDecoderProvider::setCustomProperty
virtual int setCustomProperty(const VideoCodecInfo &info, const char *key, const void *data)
Definition video_codec_provider_i.h:66
agora::rtc::IVideoDecoderProvider::getCustomProperty
virtual int getCustomProperty(const VideoCodecInfo &info, const char *key, void *data)
Definition video_codec_provider_i.h:62
agora::rtc::IVideoDecoderProvider::~IVideoDecoderProvider
virtual ~IVideoDecoderProvider()
Definition video_codec_provider_i.h:58
agora::rtc::IVideoDecoderProvider::enumerateDecoders
virtual int enumerateDecoders(VideoCodecInfo *info_list, int &count)=0
agora::rtc::IVideoEncoderProvider
Definition video_codec_provider_i.h:40
agora::rtc::IVideoEncoderProvider::setCustomProperty
virtual int setCustomProperty(const VideoCodecInfo &info, const char *key, const void *data)
Definition video_codec_provider_i.h:50
agora::rtc::IVideoEncoderProvider::createEncoder
virtual webrtc::VideoEncoder * createEncoder(const VideoCodecInfo &info, aosl_mpq_t mpq=AOSL_MPQ_INVALID)=0
agora::rtc::IVideoEncoderProvider::getCustomProperty
virtual int getCustomProperty(const VideoCodecInfo &info, const char *key, void *data)
Definition video_codec_provider_i.h:46
agora::rtc::IVideoEncoderProvider::~IVideoEncoderProvider
virtual ~IVideoEncoderProvider()
Definition video_codec_provider_i.h:42
agora::rtc::IVideoEncoderProvider::enumerateEncoders
virtual int enumerateEncoders(VideoCodecInfo *info_list, int &count)=0
agora::rtc::IVideoEncoderProvider::destroyEncoder
virtual int destroyEncoder(webrtc::VideoEncoder *encoder)=0
agora::rtc
Definition AgoraExtensionVersion.h:12
agora::rtc::MAX_DECODER_NUM_PER_PROVIDER
static const int MAX_DECODER_NUM_PER_PROVIDER
Definition video_codec_provider_i.h:23
agora::rtc::MAX_ENCODER_NUM_PER_PROVIDER
static const int MAX_ENCODER_NUM_PER_PROVIDER
Definition video_codec_provider_i.h:22
agora::rtc::MAX_JSON_LEN
static const int32_t MAX_JSON_LEN
Definition video_codec_provider_i.h:34
agora::rtc::PROP_KEY_CODEC_SDP_FORMAT_JSON
static const char *const PROP_KEY_CODEC_SDP_FORMAT_JSON
Definition video_codec_provider_i.h:26
agora
Definition AgoraAtomicOps.h:21
webrtc
Definition common_defines.h:18
agora::rtc::ExtensionInterfaceVersion< IVideoDecoderProvider >::Version
static ExtensionVersion Version()
Definition video_codec_provider_i.h:83
agora::rtc::ExtensionInterfaceVersion< IVideoEncoderProvider >::Version
static ExtensionVersion Version()
Definition video_codec_provider_i.h:75
agora::rtc::ExtensionInterfaceVersion
Definition AgoraExtensionVersion.h:66
agora::rtc::ExtensionVersion
Definition AgoraExtensionVersion.h:14
agora::rtc::VideoCodecInfo
Definition video_codec_provider_i.h:28
agora::rtc::VideoCodecInfo::is_hw_accelerated
bool is_hw_accelerated
Definition video_codec_provider_i.h:31
agora::rtc::VideoCodecInfo::impl_type
const char * impl_type
Definition video_codec_provider_i.h:30
agora::rtc::VideoCodecInfo::codec_name
const char * codec_name
Definition video_codec_provider_i.h:29
agora::rtc::VideoSdpFormatJson
Definition video_codec_provider_i.h:35
agora::rtc::VideoSdpFormatJson::str_len
int32_t str_len
Definition video_codec_provider_i.h:37
agora::rtc::VideoSdpFormatJson::json_str
char json_str[MAX_JSON_LEN]
Definition video_codec_provider_i.h:36