• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_SHARING_RTP_DEF_H
17 #define OHOS_SHARING_RTP_DEF_H
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 namespace OHOS {
24 namespace Sharing {
25 enum class RtpPayloadStream {
26     H264,
27     MPEG4_GENERIC, // AAC
28     MPEG2_TS,
29     MPEG2_PS,
30     PCMA, // G.711 alaw
31     PCMU, // G.711 ulaw
32 };
33 
34 class Extra {
35 public:
36     using Ptr = std::shared_ptr<Extra>;
37 };
38 
39 class AACExtra : public Extra {
40 public:
41     using Ptr = std::shared_ptr<AACExtra>;
42 
43     // SDP: a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=121056E500
44     // 121056E500
45     std::string aacConfig_;
46 };
47 
48 class H264Extra : public Extra {
49 public:
50     using Ptr = std::shared_ptr<H264Extra>;
51 
52     std::vector<uint8_t> sps;
53     std::vector<uint8_t> pps;
54 };
55 
56 class RtpPlaylodParam {
57 public:
58     uint32_t pt_ = 0;
59     int32_t sampleRate_ = 90000;
60 
61     RtpPayloadStream ps_ = RtpPayloadStream::H264;
62 
63     Extra::Ptr extra_ = nullptr;
64 };
65 } // namespace Sharing
66 } // namespace OHOS
67 #endif