1 /* 2 * Copyright (C) 2014 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 android.media; 18 19 /** 20 * The AudioMixPort is a specialized type of AudioPort 21 * describing an audio mix or stream at an input or output stream of the audio 22 * framework. 23 * In addition to base audio port attributes, the mix descriptor contains: 24 * - the unique audio I/O handle assigned by AudioFlinger to this mix. 25 * @see AudioPort 26 * @hide 27 */ 28 29 public class AudioMixPort extends AudioPort { 30 31 private final int mIoHandle; 32 AudioMixPort(AudioHandle handle, int ioHandle, int role, String deviceName, int[] samplingRates, int[] channelMasks, int[] channelIndexMasks, int[] formats, AudioGain[] gains)33 AudioMixPort(AudioHandle handle, int ioHandle, int role, String deviceName, 34 int[] samplingRates, int[] channelMasks, int[] channelIndexMasks, 35 int[] formats, AudioGain[] gains) { 36 super(handle, role, deviceName, samplingRates, channelMasks, channelIndexMasks, 37 formats, gains); 38 mIoHandle = ioHandle; 39 } 40 41 /** 42 * Build a specific configuration of this audio mix port for use by methods 43 * like AudioManager.connectAudioPatch(). 44 */ buildConfig(int samplingRate, int channelMask, int format, AudioGainConfig gain)45 public AudioMixPortConfig buildConfig(int samplingRate, int channelMask, int format, 46 AudioGainConfig gain) { 47 return new AudioMixPortConfig(this, samplingRate, channelMask, format, gain); 48 } 49 50 /** 51 * Get the device type (e.g AudioManager.DEVICE_OUT_SPEAKER) 52 */ ioHandle()53 public int ioHandle() { 54 return mIoHandle; 55 } 56 57 @Override equals(Object o)58 public boolean equals(Object o) { 59 if (o == null || !(o instanceof AudioMixPort)) { 60 return false; 61 } 62 AudioMixPort other = (AudioMixPort)o; 63 if (mIoHandle != other.ioHandle()) { 64 return false; 65 } 66 67 return super.equals(o); 68 } 69 70 } 71