| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.hardware.camera2.params; |
| 18 |
|
| 19 |
import static com.android.internal.util.Preconditions.*; |
| 20 |
import static android.hardware.camera2.params.StreamConfigurationMap.checkArgumentFormatInternal; |
| 21 |
|
| 22 |
import android.graphics.ImageFormat; |
| 23 |
import android.hardware.camera2.CameraCharacteristics; |
| 24 |
import android.hardware.camera2.utils.HashCodeHelpers; |
| 25 |
import android.graphics.PixelFormat; |
| 26 |
import android.util.Size; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public final class StreamConfigurationDuration { |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
public StreamConfigurationDuration( |
| 56 |
final int format, final int width, final int height, final long durationNs) { |
| 57 |
mFormat = checkArgumentFormatInternal(format); |
| 58 |
mWidth = checkArgumentPositive(width, "width must be positive"); |
| 59 |
mHeight = checkArgumentPositive(height, "height must be positive"); |
| 60 |
mDurationNs = checkArgumentNonnegative(durationNs, "durationNs must be non-negative"); |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
public final int getFormat() { |
| 72 |
return mFormat; |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
public int getWidth() { |
| 82 |
return mWidth; |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
public int getHeight() { |
| 91 |
return mHeight; |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
public Size getSize() { |
| 100 |
return new Size(mWidth, mHeight); |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
public long getDuration() { |
| 109 |
return mDurationNs; |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
@Override |
| 121 |
public boolean equals(final Object obj) { |
| 122 |
if (obj == null) { |
| 123 |
return false; |
| 124 |
} |
| 125 |
if (this == obj) { |
| 126 |
return true; |
| 127 |
} |
| 128 |
if (obj instanceof StreamConfigurationDuration) { |
| 129 |
final StreamConfigurationDuration other = (StreamConfigurationDuration) obj; |
| 130 |
return mFormat == other.mFormat && |
| 131 |
mWidth == other.mWidth && |
| 132 |
mHeight == other.mHeight && |
| 133 |
mDurationNs == other.mDurationNs; |
| 134 |
} |
| 135 |
return false; |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
@Override |
| 142 |
public int hashCode() { |
| 143 |
return HashCodeHelpers.hashCode(mFormat, mWidth, mHeight, |
| 144 |
(int) mDurationNs, (int)(mDurationNs >>> Integer.SIZE)); |
| 145 |
} |
| 146 |
|
| 147 |
private final int mFormat; |
| 148 |
private final int mWidth; |
| 149 |
private final int mHeight; |
| 150 |
private final long mDurationNs; |
| 151 |
} |