Home | History | Annotate | Download | only in ims
      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;
     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;
     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;
     64 
     65    /**
     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 
     75     // Audio related information
     76     public int mAudioQuality;
     77     public int mAudioDirection;
     78     // Video related information
     79     public int mVideoQuality;
     80     public int mVideoDirection;
     81 
     82 
     83 
     84     public ImsStreamMediaProfile(Parcel in) {
     85         readFromParcel(in);
     86     }
     87 
     88     public ImsStreamMediaProfile() {
     89         mAudioQuality = AUDIO_QUALITY_NONE;
     90         mAudioDirection = DIRECTION_SEND_RECEIVE;
     91         mVideoQuality = VIDEO_QUALITY_NONE;
     92         mVideoDirection = DIRECTION_INVALID;
     93     }
     94 
     95     public ImsStreamMediaProfile(int audioQuality, int audioDirection,
     96             int videoQuality, int videoDirection) {
     97         mAudioQuality = audioQuality;
     98         mAudioDirection = audioDirection;
     99         mVideoQuality = videoQuality;
    100         mVideoDirection = videoDirection;
    101     }
    102 
    103     public void copyFrom(ImsStreamMediaProfile profile) {
    104         mAudioQuality = profile.mAudioQuality;
    105         mAudioDirection = profile.mAudioDirection;
    106         mVideoQuality = profile.mVideoQuality;
    107         mVideoDirection = profile.mVideoDirection;
    108     }
    109 
    110     @Override
    111     public String toString() {
    112         return "{ audioQuality=" + mAudioQuality +
    113                 ", audioDirection=" + mAudioDirection +
    114                 ", videoQuality=" + mVideoQuality +
    115                 ", videoDirection=" + mVideoDirection + " }";
    116     }
    117 
    118     @Override
    119     public int describeContents() {
    120         return 0;
    121     }
    122 
    123     @Override
    124     public void writeToParcel(Parcel out, int flags) {
    125         out.writeInt(mAudioQuality);
    126         out.writeInt(mAudioDirection);
    127         out.writeInt(mVideoQuality);
    128         out.writeInt(mVideoDirection);
    129     }
    130 
    131     private void readFromParcel(Parcel in) {
    132         mAudioQuality = in.readInt();
    133         mAudioDirection = in.readInt();
    134         mVideoQuality = in.readInt();
    135         mVideoDirection = in.readInt();
    136     }
    137 
    138     public static final Creator<ImsStreamMediaProfile> CREATOR =
    139             new Creator<ImsStreamMediaProfile>() {
    140         @Override
    141         public ImsStreamMediaProfile createFromParcel(Parcel in) {
    142             return new ImsStreamMediaProfile(in);
    143         }
    144 
    145         @Override
    146         public ImsStreamMediaProfile[] newArray(int size) {
    147             return new ImsStreamMediaProfile[size];
    148         }
    149     };
    150 }
    151