1 /**
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef TEXTCONFIG_H
18 #define TEXTCONFIG_H
19 
20 #include <binder/Parcel.h>
21 #include <binder/Parcelable.h>
22 #include <binder/Status.h>
23 #include <RtpConfig.h>
24 
25 namespace android
26 {
27 
28 namespace telephony
29 {
30 
31 namespace imsmedia
32 {
33 
34 /** Native representation of android.telephony.imsmedia.TextConfig */
35 
36 /**
37  * The class represents RTP (Real Time Control) configuration for text stream.
38  */
39 class TextConfig : public RtpConfig
40 {
41 public:
42     enum CodecType
43     {
44         /** codec is not defined */
45         TEXT_CODEC_NONE = 0,
46         /** T.140 enabled */
47         TEXT_T140,
48         /** T.140 and redundant codec enabled */
49         TEXT_T140_RED,
50     };
51 
52     TextConfig();
53     TextConfig(TextConfig* config);
54     TextConfig(TextConfig& config);
55     virtual ~TextConfig();
56     TextConfig& operator=(const TextConfig& config);
57     bool operator==(const TextConfig& config) const;
58     bool operator!=(const TextConfig& config) const;
59     virtual status_t writeToParcel(Parcel* out) const;
60     virtual status_t readFromParcel(const Parcel* in);
61     void setCodecType(const int32_t codec);
62     int32_t getCodecType();
63     void setBitrate(const int32_t bitrate);
64     int32_t getBitrate();
65     void setRedundantPayload(const int8_t payload);
66     int8_t getRedundantPayload();
67     void setRedundantLevel(const int8_t level);
68     int8_t getRedundantLevel();
69     void setKeepRedundantLevel(const bool enable);
70     bool getKeepRedundantLevel();
71 
72 private:
73     /** Codec type to set, RTT is using T.140 and redundant of T.140 with in payload number with
74      * original T.140. The codec type can be choose to use only T.140 or use the redundant payload
75      * together. */
76     int32_t mCodecType;
77 
78     /** Bitrate for the encoding streaming in kbps unit*/
79     int32_t mBitrate;
80 
81     /** The negotiated text redundancy payload number for RED payload */
82     int8_t mRedundantPayload;
83 
84     /* The text redundancy level which is how many redundant payload of the T.140 payload is sent
85      * every time packet sent */
86     int8_t mRedundantLevel;
87 
88     /** The option for sending empty redundant payload when the codec type is sending T.140 and RED
89      * payload */
90     bool mKeepRedundantLevel;
91 };
92 
93 }  // namespace imsmedia
94 
95 }  // namespace telephony
96 
97 }  // namespace android
98 
99 #endif
100