]> nv-tegra.nvidia Code Review - android/platform/frameworks/opt/net/ims.git/blob - src/java/com/android/ims/ImsStreamMediaProfile.java
Merge kwd to master
[android/platform/frameworks/opt/net/ims.git] / src / java / com / android / ims / ImsStreamMediaProfile.java
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;
44     public static final int AUDIO_QUALITY_AMR = (1 << 0);
45     public static final int AUDIO_QUALITY_AMR_WB = (1 << 1);
46
47     /**
48      * Video information
49      */
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);
56
57     // Audio related information
58     public int mAudioQuality;
59     public int mAudioDirection;
60     // Video related information
61     public int mVideoQuality;
62     public int mVideoDirection;
63
64
65
66     public ImsStreamMediaProfile(Parcel in) {
67         readFromParcel(in);
68     }
69
70     public ImsStreamMediaProfile() {
71         mAudioQuality = AUDIO_QUALITY_AMR_WB;
72         mAudioDirection = DIRECTION_SEND_RECEIVE;
73         mVideoQuality = VIDEO_QUALITY_NONE;
74         mVideoDirection = DIRECTION_INVALID;
75     }
76
77     public ImsStreamMediaProfile(int audioQuality, int audioDirection,
78             int videoQuality, int videoDirection) {
79         mAudioQuality = audioQuality;
80         mAudioDirection = audioDirection;
81         mVideoQuality = videoQuality;
82         mVideoDirection = videoDirection;
83     }
84
85     public void copyFrom(ImsStreamMediaProfile profile) {
86         mAudioQuality = profile.mAudioQuality;
87         mAudioDirection = profile.mAudioDirection;
88         mVideoQuality = profile.mVideoQuality;
89         mVideoDirection = profile.mVideoDirection;
90     }
91
92     @Override
93     public String toString() {
94         return "{ audioQuality=" + mAudioQuality +
95                 ", audioDirection=" + mAudioDirection +
96                 ", videoQuality=" + mVideoQuality +
97                 ", videoDirection=" + mVideoDirection + " }";
98     }
99
100     @Override
101     public int describeContents() {
102         return 0;
103     }
104
105     @Override
106     public void writeToParcel(Parcel out, int flags) {
107         out.writeInt(mAudioQuality);
108         out.writeInt(mAudioDirection);
109         out.writeInt(mVideoQuality);
110         out.writeInt(mVideoDirection);
111     }
112
113     private void readFromParcel(Parcel in) {
114         mAudioQuality = in.readInt();
115         mAudioDirection = in.readInt();
116         mVideoQuality = in.readInt();
117         mVideoDirection = in.readInt();
118     }
119
120     public static final Creator<ImsStreamMediaProfile> CREATOR =
121             new Creator<ImsStreamMediaProfile>() {
122         @Override
123         public ImsStreamMediaProfile createFromParcel(Parcel in) {
124             return new ImsStreamMediaProfile(in);
125         }
126
127         @Override
128         public ImsStreamMediaProfile[] newArray(int size) {
129             return new ImsStreamMediaProfile[size];
130         }
131     };
132 }