2 * Copyright (c) 2013 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.ims;
19 import android.os.Parcel;
20 import android.os.Parcelable;
23 * Parcelable object to handle IMS stream media profile.
24 * It provides the media direction, quality of audio and/or video.
28 public class ImsStreamMediaProfile implements Parcelable {
29 private static final String TAG = "ImsStreamMediaProfile";
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;
43 public static final int AUDIO_QUALITY_NONE = 0;
44 public static final int AUDIO_QUALITY_AMR = (1 << 0);
45 public static final int AUDIO_QUALITY_AMR_WB = (1 << 1);
50 public static final int VIDEO_QUALITY_NONE = 0;
51 public static final int VIDEO_QUALITY_QCIF = (1 << 0);
52 public static final int VIDEO_QUALITY_QVGA_LANDSCAPE = (1 << 1);
53 public static final int VIDEO_QUALITY_QVGA_PORTRAIT = (1 << 2);
54 public static final int VIDEO_QUALITY_VGA_LANDSCAPE = (1 << 3);
55 public static final int VIDEO_QUALITY_VGA_PORTRAIT = (1 << 4);
57 // Audio related information
58 public int mAudioQuality;
59 public int mAudioDirection;
60 // Video related information
61 public int mVideoQuality;
62 public int mVideoDirection;
66 public ImsStreamMediaProfile(Parcel in) {
70 public ImsStreamMediaProfile() {
71 mAudioQuality = AUDIO_QUALITY_AMR_WB;
72 mAudioDirection = DIRECTION_SEND_RECEIVE;
73 mVideoQuality = VIDEO_QUALITY_NONE;
74 mVideoDirection = DIRECTION_INVALID;
77 public ImsStreamMediaProfile(int audioQuality, int audioDirection,
78 int videoQuality, int videoDirection) {
79 mAudioQuality = audioQuality;
80 mAudioDirection = audioDirection;
81 mVideoQuality = videoQuality;
82 mVideoDirection = videoDirection;
85 public void copyFrom(ImsStreamMediaProfile profile) {
86 mAudioQuality = profile.mAudioQuality;
87 mAudioDirection = profile.mAudioDirection;
88 mVideoQuality = profile.mVideoQuality;
89 mVideoDirection = profile.mVideoDirection;
93 public String toString() {
94 return "{ audioQuality=" + mAudioQuality +
95 ", audioDirection=" + mAudioDirection +
96 ", videoQuality=" + mVideoQuality +
97 ", videoDirection=" + mVideoDirection + " }";
101 public int describeContents() {
106 public void writeToParcel(Parcel out, int flags) {
107 out.writeInt(mAudioQuality);
108 out.writeInt(mAudioDirection);
109 out.writeInt(mVideoQuality);
110 out.writeInt(mVideoDirection);
113 private void readFromParcel(Parcel in) {
114 mAudioQuality = in.readInt();
115 mAudioDirection = in.readInt();
116 mVideoQuality = in.readInt();
117 mVideoDirection = in.readInt();
120 public static final Creator<ImsStreamMediaProfile> CREATOR =
121 new Creator<ImsStreamMediaProfile>() {
123 public ImsStreamMediaProfile createFromParcel(Parcel in) {
124 return new ImsStreamMediaProfile(in);
128 public ImsStreamMediaProfile[] newArray(int size) {
129 return new ImsStreamMediaProfile[size];