Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package com.android.ims; |
| 18 | |
| 19 | import android.os.Parcel; |
| 20 | import 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 | */ |
| 28 | public 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 Ganesh | 482e6da | 2014-10-13 11:31:50 -0700 | [diff] [blame] | 44 | 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 Kolangade | 66742f2 | 2016-01-28 16:52:47 -0800 | [diff] [blame] | 54 | 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 Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 64 | |
Shriram Ganesh | 482e6da | 2014-10-13 11:31:50 -0700 | [diff] [blame] | 65 | /** |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 66 | * 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 Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame] | 75 | /** |
| 76 | * RTT Modes |
| 77 | */ |
| 78 | public static final int RTT_MODE_DISABLED = 0; |
| 79 | public static final int RTT_MODE_FULL = 1; |
| 80 | |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 81 | // Audio related information |
| 82 | public int mAudioQuality; |
| 83 | public int mAudioDirection; |
| 84 | // Video related information |
| 85 | public int mVideoQuality; |
| 86 | public int mVideoDirection; |
Anju Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame] | 87 | // Rtt related information |
| 88 | public int mRttMode; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 89 | |
| 90 | public ImsStreamMediaProfile(Parcel in) { |
| 91 | readFromParcel(in); |
| 92 | } |
| 93 | |
| 94 | public ImsStreamMediaProfile() { |
Shriram Ganesh | 8d8c51f | 2015-03-12 14:26:01 +0530 | [diff] [blame] | 95 | mAudioQuality = AUDIO_QUALITY_NONE; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 96 | mAudioDirection = DIRECTION_SEND_RECEIVE; |
| 97 | mVideoQuality = VIDEO_QUALITY_NONE; |
| 98 | mVideoDirection = DIRECTION_INVALID; |
Anju Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame] | 99 | mRttMode = RTT_MODE_DISABLED; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 100 | } |
| 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 Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame] | 110 | public ImsStreamMediaProfile(int rttMode) { |
| 111 | mRttMode = rttMode; |
| 112 | } |
| 113 | |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 114 | public void copyFrom(ImsStreamMediaProfile profile) { |
| 115 | mAudioQuality = profile.mAudioQuality; |
| 116 | mAudioDirection = profile.mAudioDirection; |
| 117 | mVideoQuality = profile.mVideoQuality; |
| 118 | mVideoDirection = profile.mVideoDirection; |
Anju Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame] | 119 | mRttMode = profile.mRttMode; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | @Override |
| 123 | public String toString() { |
| 124 | return "{ audioQuality=" + mAudioQuality + |
| 125 | ", audioDirection=" + mAudioDirection + |
| 126 | ", videoQuality=" + mVideoQuality + |
Anju Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame] | 127 | ", videoDirection=" + mVideoDirection + |
| 128 | ", rttMode=" + mRttMode + " }"; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 129 | } |
| 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 Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame] | 142 | out.writeInt(mRttMode); |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | private void readFromParcel(Parcel in) { |
| 146 | mAudioQuality = in.readInt(); |
| 147 | mAudioDirection = in.readInt(); |
| 148 | mVideoQuality = in.readInt(); |
| 149 | mVideoDirection = in.readInt(); |
Anju Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame] | 150 | mRttMode = in.readInt(); |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 151 | } |
| 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 Mathapati | 7e177da | 2017-01-24 11:58:28 -0800 | [diff] [blame] | 165 | |
| 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 Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 181 | } |