From d7f6220b70a7c298ec0ca2aeab2c0e74cf01e24b Mon Sep 17 00:00:00 2001 From: mbernr-epiframe Date: Wed, 26 Apr 2017 15:09:57 +0200 Subject: [PATCH] added video quality option for QVGA --- .../src/main/api16/com/flurgle/camerakit/Camera1.java | 10 +++++++++- .../src/main/java/com/flurgle/camerakit/CameraKit.java | 1 + camerakit/src/main/res/values/attrs.xml | 1 + .../main/types/com/flurgle/camerakit/VideoQuality.java | 3 ++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java b/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java index ca9e1f48..58bb3720 100644 --- a/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java +++ b/camerakit/src/main/api16/com/flurgle/camerakit/Camera1.java @@ -443,11 +443,19 @@ public class Camera1 extends CameraImpl { private CamcorderProfile getCamcorderProfile(@VideoQuality int videoQuality) { CamcorderProfile camcorderProfile = null; switch (videoQuality) { + case CameraKit.Constants.VIDEO_QUALITY_QVGA: + if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_QVGA)) { + camcorderProfile = CamcorderProfile.get(mCameraId, CamcorderProfile.QUALITY_QVGA); + } else { + return getCamcorderProfile(CameraKit.Constants.VIDEO_QUALITY_LOWEST); + } + break; + case CameraKit.Constants.VIDEO_QUALITY_480P: if (CamcorderProfile.hasProfile(mCameraId, CamcorderProfile.QUALITY_480P)) { camcorderProfile = CamcorderProfile.get(mCameraId, CamcorderProfile.QUALITY_480P); } else { - return getCamcorderProfile(CameraKit.Constants.VIDEO_QUALITY_LOWEST); + return getCamcorderProfile(CameraKit.Constants.VIDEO_QUALITY_QVGA); } break; diff --git a/camerakit/src/main/java/com/flurgle/camerakit/CameraKit.java b/camerakit/src/main/java/com/flurgle/camerakit/CameraKit.java index 578b12e1..1ea8da85 100644 --- a/camerakit/src/main/java/com/flurgle/camerakit/CameraKit.java +++ b/camerakit/src/main/java/com/flurgle/camerakit/CameraKit.java @@ -44,6 +44,7 @@ public class CameraKit { public static final int VIDEO_QUALITY_2160P = 3; public static final int VIDEO_QUALITY_HIGHEST = 4; public static final int VIDEO_QUALITY_LOWEST = 5; + public static final int VIDEO_QUALITY_QVGA = 6; } diff --git a/camerakit/src/main/res/values/attrs.xml b/camerakit/src/main/res/values/attrs.xml index 62724b36..13c4efb8 100644 --- a/camerakit/src/main/res/values/attrs.xml +++ b/camerakit/src/main/res/values/attrs.xml @@ -46,6 +46,7 @@ + diff --git a/camerakit/src/main/types/com/flurgle/camerakit/VideoQuality.java b/camerakit/src/main/types/com/flurgle/camerakit/VideoQuality.java index 1d7d832f..e9709167 100644 --- a/camerakit/src/main/types/com/flurgle/camerakit/VideoQuality.java +++ b/camerakit/src/main/types/com/flurgle/camerakit/VideoQuality.java @@ -11,8 +11,9 @@ import static com.flurgle.camerakit.CameraKit.Constants.VIDEO_QUALITY_480P; import static com.flurgle.camerakit.CameraKit.Constants.VIDEO_QUALITY_720P; import static com.flurgle.camerakit.CameraKit.Constants.VIDEO_QUALITY_HIGHEST; import static com.flurgle.camerakit.CameraKit.Constants.VIDEO_QUALITY_LOWEST; +import static com.flurgle.camerakit.CameraKit.Constants.VIDEO_QUALITY_QVGA; @Retention(RetentionPolicy.SOURCE) -@IntDef({VIDEO_QUALITY_480P, VIDEO_QUALITY_720P, VIDEO_QUALITY_1080P, VIDEO_QUALITY_2160P, VIDEO_QUALITY_HIGHEST, VIDEO_QUALITY_LOWEST}) +@IntDef({VIDEO_QUALITY_QVGA, VIDEO_QUALITY_480P, VIDEO_QUALITY_720P, VIDEO_QUALITY_1080P, VIDEO_QUALITY_2160P, VIDEO_QUALITY_HIGHEST, VIDEO_QUALITY_LOWEST}) public @interface VideoQuality { }