summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Bruckert <agrabren@yahoo.com>2012-11-20 04:48:00 -0800
committerDorian Snyder <dastin1015@gmail.com>2013-04-28 21:31:40 -0700
commitea33819479ae5b53b80704c12a317b1555adbc97 (patch)
tree3036675bd0b17960cc84fa89c6f94b12fb138a09
parente411d62373f5d13f6bebf3073efa6f94fd7ba460 (diff)
downloadframeworks_av-ea33819479ae5b53b80704c12a317b1555adbc97.zip
frameworks_av-ea33819479ae5b53b80704c12a317b1555adbc97.tar.gz
frameworks_av-ea33819479ae5b53b80704c12a317b1555adbc97.tar.bz2
Add camera parameters for htc evo 3D. (1/2)
Use BOARD_HTC_3D_SUPPORT to enable. Change-Id: I28fa3f1586071bcc78b8e887bbbf699d338a0ceb
-rw-r--r--camera/CameraParameters.cpp9
-rw-r--r--include/camera/CameraParameters.h7
-rwxr-xr-xmedia/libstagefright/Android.mk4
-rwxr-xr-xmedia/libstagefright/CameraSource.cpp4
-rw-r--r--media/libstagefright/OMXCodec.cpp20
-rw-r--r--services/camera/libcameraservice/Android.mk7
-rw-r--r--services/camera/libcameraservice/CameraHardwareInterface.h14
7 files changed, 63 insertions, 2 deletions
diff --git a/camera/CameraParameters.cpp b/camera/CameraParameters.cpp
index b082c1b..411bfac 100644
--- a/camera/CameraParameters.cpp
+++ b/camera/CameraParameters.cpp
@@ -66,6 +66,7 @@ const char CameraParameters::KEY_SUPPORTED_CAPTURE_MODES[] = "capture-mode-value
const char CameraParameters::KEY_PICTURE_SIZE[] = "picture-size";
const char CameraParameters::KEY_SUPPORTED_PICTURE_SIZES[] = "picture-size-values";
const char CameraParameters::KEY_PICTURE_FORMAT[] = "picture-format";
+const char CameraParameters::KEY_SUPPORTED_3D_FILE_FORMAT[] = "3d-file-format";
const char CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS[] = "picture-format-values";
const char CameraParameters::KEY_JPEG_THUMBNAIL_WIDTH[] = "jpeg-thumbnail-width";
const char CameraParameters::KEY_JPEG_THUMBNAIL_HEIGHT[] = "jpeg-thumbnail-height";
@@ -376,6 +377,9 @@ const char CameraParameters::SELECTABLE_ZONE_AF_FRAME_AVERAGE[] = "frame-average
const char CameraParameters::FACE_DETECTION_OFF[] = "off";
const char CameraParameters::FACE_DETECTION_ON[] = "on";
+const char CameraParameters::FILE_FORMAT_MPO[] = "mpo";
+const char CameraParameters::FILE_FORMAT_JPS[] = "jps";
+
// Values for MCE settings.
const char CameraParameters::MCE_ENABLE[] = "enable";
const char CameraParameters::MCE_DISABLE[] = "disable";
@@ -787,6 +791,11 @@ void CameraParameters::getSupportedPictureSizes(Vector<Size> &sizes) const
parseSizesList(pictureSizesStr, sizes);
}
+void CameraParameters::set3DFileFormat(const char *format)
+{
+ set(KEY_SUPPORTED_3D_FILE_FORMAT, format);
+}
+
void CameraParameters::setPictureFormat(const char *format)
{
set(KEY_PICTURE_FORMAT, format);
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h
index 2ed5825..61cf359 100644
--- a/include/camera/CameraParameters.h
+++ b/include/camera/CameraParameters.h
@@ -117,6 +117,7 @@ public:
void setPictureSize(int width, int height);
void getPictureSize(int *width, int *height) const;
void getSupportedPictureSizes(Vector<Size> &sizes) const;
+ void set3DFileFormat(const char* buffer);
void setPictureFormat(const char *format);
const char *getPictureFormat() const;
#ifdef QCOM_HARDWARE
@@ -203,6 +204,8 @@ public:
// Supported dimensions for captured pictures in pixels.
// Example value: "2048x1536,1024x768". Read only.
static const char KEY_SUPPORTED_PICTURE_SIZES[];
+ //HTC 3D color format
+ static const char KEY_SUPPORTED_3D_FILE_FORMAT[];
// The image format for captured pictures. See CAMERA_MSG_COMPRESSED_IMAGE
// in frameworks/base/include/camera/Camera.h.
// Example value: "jpeg" or PIXEL_FORMAT_XXX constants. Read/write.
@@ -916,6 +919,10 @@ public:
static const char FACE_DETECTION_OFF[];
static const char FACE_DETECTION_ON[];
+ // Values for HTC 3D image settings.
+ static const char FILE_FORMAT_MPO[];
+ static const char FILE_FORMAT_JPS[];
+
// Values for MCE settings.
static const char MCE_ENABLE[];
static const char MCE_DISABLE[];
diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk
index b394d90..193291e 100755
--- a/media/libstagefright/Android.mk
+++ b/media/libstagefright/Android.mk
@@ -3,6 +3,10 @@ include $(CLEAR_VARS)
include frameworks/av/media/libstagefright/codecs/common/Config.mk
+ifeq ($(BOARD_HTC_3D_SUPPORT),true)
+ LOCAL_CFLAGS += -DHTC_3D_SUPPORT
+endif
+
LOCAL_SRC_FILES:= \
ACodec.cpp \
AACExtractor.cpp \
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index b8b9152..9f63ec0 100755
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -347,11 +347,13 @@ status_t CameraSource::configureCamera(
ALOGV("Supported frame rates: %s", supportedFrameRates);
char buf[4];
snprintf(buf, 4, "%d", frameRate);
+#ifndef HTC_3D_SUPPORT // HTC uses invalid frame rates intentionally on the 3D camera
if (strstr(supportedFrameRates, buf) == NULL) {
ALOGE("Requested frame rate (%d) is not supported: %s",
frameRate, supportedFrameRates);
return BAD_VALUE;
}
+#endif
// The frame rate is supported, set the camera to the requested value.
params->setPreviewFrameRate(frameRate);
@@ -449,11 +451,13 @@ status_t CameraSource::checkFrameRate(
// Check the actual video frame rate against the target/requested
// video frame rate.
+#ifndef HTC_3D_SUPPORT // HTC uses invalid frame rates intentionally on the 3D camera
if (frameRate != -1 && (frameRateActual - frameRate) != 0) {
ALOGE("Failed to set preview frame rate to %d fps. The actual "
"frame rate is %d", frameRate, frameRateActual);
return UNKNOWN_ERROR;
}
+#endif
// Good now.
mVideoFrameRate = frameRateActual;
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 26989c1..b8b3ec4 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -306,6 +306,24 @@ void OMXCodec::findMatchingCodecs(
uint32_t OMXCodec::getComponentQuirks(
const MediaCodecList *list, size_t index) {
uint32_t quirks = 0;
+
+ if (list->codecHasQuirk(
+ index, "needs-flush-before-disable")) {
+ quirks |= kNeedsFlushBeforeDisable;
+ }
+ if (list->codecHasQuirk(
+ index, "requires-flush-complete-emulation")) {
+ quirks |= kRequiresFlushCompleteEmulation;
+ }
+ if (list->codecHasQuirk(
+ index, "supports-multiple-frames-per-input-buffer")) {
+ quirks |= kSupportsMultipleFramesPerInputBuffer;
+ }
+ if (list->codecHasQuirk(
+ index, "requires-larger-encoder-output-buffer")) {
+ quirks |= kRequiresLargerEncoderOutputBuffer;
+ }
+
if (list->codecHasQuirk(
index, "requires-allocate-on-input-ports")) {
quirks |= kRequiresAllocateBufferOnInputPorts;
@@ -325,7 +343,7 @@ uint32_t OMXCodec::getComponentQuirks(
#ifdef QCOM_HARDWARE
if (list->codecHasQuirk(
index, "requires-loaded-to-idle-after-allocation")) {
- quirks |= kRequiresLoadedToIdleAfterAllocation;
+ quirks |= kRequiresLoadedToIdleAfterAllocation;
}
if (list->codecHasQuirk(
index, "requires-global-flush")) {
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index 3e2ac14..7c770db 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -40,14 +40,19 @@ LOCAL_C_INCLUDES += \
system/media/camera/include \
external/jpeg
+
ifeq ($(BOARD_USES_QCOM_LEGACY_CAM_PARAMS),true)
LOCAL_CFLAGS += -DQCOM_LEGACY_CAM_PARAMS
endif
-ifeq ($(BOARD_HAVE_HTC_FFC), true)
+ifeq ($(BOARD_HAVE_HTC_FFC),true)
LOCAL_CFLAGS += -DBOARD_HAVE_HTC_FFC
endif
+ifeq ($(BOARD_HTC_3D_SUPPORT),true)
+ LOCAL_CFLAGS += -DHTC_3D_SUPPORT
+endif
+
LOCAL_MODULE:= libcameraservice
include $(BUILD_SHARED_LIBRARY)
diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h
index d67996e..f7e7397 100644
--- a/services/camera/libcameraservice/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/CameraHardwareInterface.h
@@ -650,6 +650,9 @@ private:
static int __set_usage(struct preview_stream_ops* w, int usage)
{
+#ifdef HTC_3D_SUPPORT
+ usage |= GRALLOC_USAGE_PRIVATE_0;
+#endif
ANativeWindow *a = anw(w);
return native_window_set_usage(a, usage);
}
@@ -668,6 +671,14 @@ private:
return a->query(a, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, count);
}
+#ifdef HTC_3D_SUPPORT
+ static int __set_3d_mode(
+ const struct preview_stream_ops *w, int r1, int r2, int r3)
+ {
+ return 0;
+ }
+#endif
+
void initHalPreviewWindow()
{
mHalPreviewWindow.nw.cancel_buffer = __cancel_buffer;
@@ -675,6 +686,9 @@ private:
mHalPreviewWindow.nw.dequeue_buffer = __dequeue_buffer;
mHalPreviewWindow.nw.enqueue_buffer = __enqueue_buffer;
mHalPreviewWindow.nw.set_buffer_count = __set_buffer_count;
+#ifdef HTC_3D_SUPPORT
+ mHalPreviewWindow.nw.set_3d_mode = __set_3d_mode;
+#endif
mHalPreviewWindow.nw.set_buffers_geometry = __set_buffers_geometry;
mHalPreviewWindow.nw.set_crop = __set_crop;
mHalPreviewWindow.nw.set_timestamp = __set_timestamp;