blob: cfe37b52434713aec3082028ef02ec5859307f2e [file] [log] [blame]
Wink Savillef8458ff2014-06-25 16:08:02 -07001/*
2 * Copyright (c) 2013 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
17package com.android.ims;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/**
23 * Parcelable object to handle IMS stream media profile.
24 * It provides the media direction, quality of audio and/or video.
25 *
26 * @hide
27 */
28public class ImsStreamMediaProfile implements Parcelable {
29 private static final String TAG = "ImsStreamMediaProfile";
30
31 /**
32 * Media directions
33 */
34 public static final int DIRECTION_INVALID = (-1);
35 public static final int DIRECTION_INACTIVE = 0;
36 public static final int DIRECTION_RECEIVE = 1;
37 public static final int DIRECTION_SEND = 2;
38 public static final int DIRECTION_SEND_RECEIVE = 3;
39
40 /**
41 * Audio information
42 */
43 public static final int AUDIO_QUALITY_NONE = 0;
Shriram Ganesh482e6da2014-10-13 11:31:50 -070044 public static final int AUDIO_QUALITY_AMR = 1;
45 public static final int AUDIO_QUALITY_AMR_WB = 2;
46 public static final int AUDIO_QUALITY_QCELP13K = 3;
47 public static final int AUDIO_QUALITY_EVRC = 4;
48 public static final int AUDIO_QUALITY_EVRC_B = 5;
49 public static final int AUDIO_QUALITY_EVRC_WB = 6;
50 public static final int AUDIO_QUALITY_EVRC_NW = 7;
51 public static final int AUDIO_QUALITY_GSM_EFR = 8;
52 public static final int AUDIO_QUALITY_GSM_FR = 9;
53 public static final int AUDIO_QUALITY_GSM_HR = 10;
Omkar Kolangade66742f22016-01-28 16:52:47 -080054 public static final int AUDIO_QUALITY_G711U = 11;
55 public static final int AUDIO_QUALITY_G723 = 12;
56 public static final int AUDIO_QUALITY_G711A = 13;
57 public static final int AUDIO_QUALITY_G722 = 14;
58 public static final int AUDIO_QUALITY_G711AB = 15;
59 public static final int AUDIO_QUALITY_G729 = 16;
60 public static final int AUDIO_QUALITY_EVS_NB = 17;
61 public static final int AUDIO_QUALITY_EVS_WB = 18;
62 public static final int AUDIO_QUALITY_EVS_SWB = 19;
63 public static final int AUDIO_QUALITY_EVS_FB = 20;
Wink Savillef8458ff2014-06-25 16:08:02 -070064
Shriram Ganesh482e6da2014-10-13 11:31:50 -070065 /**
Wink Savillef8458ff2014-06-25 16:08:02 -070066 * Video information
67 */
68 public static final int VIDEO_QUALITY_NONE = 0;
69 public static final int VIDEO_QUALITY_QCIF = (1 << 0);
70 public static final int VIDEO_QUALITY_QVGA_LANDSCAPE = (1 << 1);
71 public static final int VIDEO_QUALITY_QVGA_PORTRAIT = (1 << 2);
72 public static final int VIDEO_QUALITY_VGA_LANDSCAPE = (1 << 3);
73 public static final int VIDEO_QUALITY_VGA_PORTRAIT = (1 << 4);
74
Anju Mathapati7e177da2017-01-24 11:58:28 -080075 /**
76 * RTT Modes
77 */
78 public static final int RTT_MODE_DISABLED = 0;
79 public static final int RTT_MODE_FULL = 1;
80
Wink Savillef8458ff2014-06-25 16:08:02 -070081 // Audio related information
82 public int mAudioQuality;
83 public int mAudioDirection;
84 // Video related information
85 public int mVideoQuality;
86 public int mVideoDirection;
Anju Mathapati7e177da2017-01-24 11:58:28 -080087 // Rtt related information
88 public int mRttMode;
Wink Savillef8458ff2014-06-25 16:08:02 -070089
90 public ImsStreamMediaProfile(Parcel in) {
91 readFromParcel(in);
92 }
93
94 public ImsStreamMediaProfile() {
Shriram Ganesh8d8c51f2015-03-12 14:26:01 +053095 mAudioQuality = AUDIO_QUALITY_NONE;
Wink Savillef8458ff2014-06-25 16:08:02 -070096 mAudioDirection = DIRECTION_SEND_RECEIVE;
97 mVideoQuality = VIDEO_QUALITY_NONE;
98 mVideoDirection = DIRECTION_INVALID;
Anju Mathapati7e177da2017-01-24 11:58:28 -080099 mRttMode = RTT_MODE_DISABLED;
Wink Savillef8458ff2014-06-25 16:08:02 -0700100 }
101
102 public ImsStreamMediaProfile(int audioQuality, int audioDirection,
103 int videoQuality, int videoDirection) {
104 mAudioQuality = audioQuality;
105 mAudioDirection = audioDirection;
106 mVideoQuality = videoQuality;
107 mVideoDirection = videoDirection;
108 }
109
Anju Mathapati7e177da2017-01-24 11:58:28 -0800110 public ImsStreamMediaProfile(int rttMode) {
111 mRttMode = rttMode;
112 }
113
Wink Savillef8458ff2014-06-25 16:08:02 -0700114 public void copyFrom(ImsStreamMediaProfile profile) {
115 mAudioQuality = profile.mAudioQuality;
116 mAudioDirection = profile.mAudioDirection;
117 mVideoQuality = profile.mVideoQuality;
118 mVideoDirection = profile.mVideoDirection;
Anju Mathapati7e177da2017-01-24 11:58:28 -0800119 mRttMode = profile.mRttMode;
Wink Savillef8458ff2014-06-25 16:08:02 -0700120 }
121
122 @Override
123 public String toString() {
124 return "{ audioQuality=" + mAudioQuality +
125 ", audioDirection=" + mAudioDirection +
126 ", videoQuality=" + mVideoQuality +
Anju Mathapati7e177da2017-01-24 11:58:28 -0800127 ", videoDirection=" + mVideoDirection +
128 ", rttMode=" + mRttMode + " }";
Wink Savillef8458ff2014-06-25 16:08:02 -0700129 }
130
131 @Override
132 public int describeContents() {
133 return 0;
134 }
135
136 @Override
137 public void writeToParcel(Parcel out, int flags) {
138 out.writeInt(mAudioQuality);
139 out.writeInt(mAudioDirection);
140 out.writeInt(mVideoQuality);
141 out.writeInt(mVideoDirection);
Anju Mathapati7e177da2017-01-24 11:58:28 -0800142 out.writeInt(mRttMode);
Wink Savillef8458ff2014-06-25 16:08:02 -0700143 }
144
145 private void readFromParcel(Parcel in) {
146 mAudioQuality = in.readInt();
147 mAudioDirection = in.readInt();
148 mVideoQuality = in.readInt();
149 mVideoDirection = in.readInt();
Anju Mathapati7e177da2017-01-24 11:58:28 -0800150 mRttMode = in.readInt();
Wink Savillef8458ff2014-06-25 16:08:02 -0700151 }
152
153 public static final Creator<ImsStreamMediaProfile> CREATOR =
154 new Creator<ImsStreamMediaProfile>() {
155 @Override
156 public ImsStreamMediaProfile createFromParcel(Parcel in) {
157 return new ImsStreamMediaProfile(in);
158 }
159
160 @Override
161 public ImsStreamMediaProfile[] newArray(int size) {
162 return new ImsStreamMediaProfile[size];
163 }
164 };
Anju Mathapati7e177da2017-01-24 11:58:28 -0800165
166 /**
167 * Determines if it's RTT call
168 * @return true if RTT call, false otherwise.
169 */
170 public boolean isRttCall() {
171 return (mRttMode == RTT_MODE_FULL);
172 }
173
174 /**
175 * Updates the RttCall attribute
176 */
177 public void setRttMode(int rttMode) {
178 mRttMode = rttMode;
179 }
180
Wink Savillef8458ff2014-06-25 16:08:02 -0700181}