| 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 |
|
| 21 |
import android.hardware.camera2.CameraCharacteristics; |
| 22 |
import android.hardware.camera2.utils.HashCodeHelpers; |
| 23 |
import android.util.Range; |
| 24 |
import android.util.Size; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
public final class HighSpeedVideoConfiguration { |
| 36 |
static final private int HIGH_SPEED_MAX_MINIMAL_FPS = 120; |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
public HighSpeedVideoConfiguration( |
| 52 |
final int width, final int height, final int fpsMin, final int fpsMax, |
| 53 |
final int batchSizeMax) { |
| 54 |
if (fpsMax < HIGH_SPEED_MAX_MINIMAL_FPS) { |
| 55 |
throw new IllegalArgumentException("fpsMax must be at least " + |
| 56 |
HIGH_SPEED_MAX_MINIMAL_FPS); |
| 57 |
} |
| 58 |
mFpsMax = fpsMax; |
| 59 |
mWidth = checkArgumentPositive(width, "width must be positive"); |
| 60 |
mHeight = checkArgumentPositive(height, "height must be positive"); |
| 61 |
mFpsMin = checkArgumentPositive(fpsMin, "fpsMin must be positive"); |
| 62 |
mSize = new Size(mWidth, mHeight); |
| 63 |
mBatchSizeMax = checkArgumentPositive(batchSizeMax, "batchSizeMax must be positive"); |
| 64 |
mFpsRange = new Range<Integer>(mFpsMin, mFpsMax); |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
public int getWidth() { |
| 73 |
return mWidth; |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
public int getHeight() { |
| 82 |
return mHeight; |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
public int getFpsMin() { |
| 91 |
return mFpsMin; |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
public int getFpsMax() { |
| 100 |
return mFpsMax; |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
public Size getSize() { |
| 109 |
return mSize; |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
public int getBatchSizeMax() { |
| 118 |
return mBatchSizeMax; |
| 119 |
} |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
public Range<Integer> getFpsRange() { |
| 127 |
return mFpsRange; |
| 128 |
} |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
@Override |
| 139 |
public boolean equals(final Object obj) { |
| 140 |
if (obj == null) { |
| 141 |
return false; |
| 142 |
} |
| 143 |
if (this == obj) { |
| 144 |
return true; |
| 145 |
} |
| 146 |
if (obj instanceof HighSpeedVideoConfiguration) { |
| 147 |
final HighSpeedVideoConfiguration other = (HighSpeedVideoConfiguration) obj; |
| 148 |
return mWidth == other.mWidth && |
| 149 |
mHeight == other.mHeight && |
| 150 |
mFpsMin == other.mFpsMin && |
| 151 |
mFpsMax == other.mFpsMax && |
| 152 |
mBatchSizeMax == other.mBatchSizeMax; |
| 153 |
} |
| 154 |
return false; |
| 155 |
} |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
@Override |
| 161 |
public int hashCode() { |
| 162 |
return HashCodeHelpers.hashCode(mWidth, mHeight, mFpsMin, mFpsMax); |
| 163 |
} |
| 164 |
|
| 165 |
private final int mWidth; |
| 166 |
private final int mHeight; |
| 167 |
private final int mFpsMin; |
| 168 |
private final int mFpsMax; |
| 169 |
private final int mBatchSizeMax; |
| 170 |
private final Size mSize; |
| 171 |
private final Range<Integer> mFpsRange; |
| 172 |
} |