summaryrefslogtreecommitdiffstats
path: root/include/camera
diff options
context:
space:
mode:
Diffstat (limited to 'include/camera')
-rw-r--r--include/camera/CameraParameters2.h203
-rw-r--r--include/camera/CaptureResult.h90
-rw-r--r--include/camera/ICameraService.h12
-rw-r--r--include/camera/VendorTagDescriptor.h145
-rw-r--r--include/camera/camera2/ICameraDeviceCallbacks.h12
-rw-r--r--include/camera/camera2/ICameraDeviceUser.h42
6 files changed, 291 insertions, 213 deletions
diff --git a/include/camera/CameraParameters2.h b/include/camera/CameraParameters2.h
deleted file mode 100644
index 88ad812..0000000
--- a/include/camera/CameraParameters2.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_CAMERA_PARAMETERS2_H
-#define ANDROID_HARDWARE_CAMERA_PARAMETERS2_H
-
-#include <utils/Vector.h>
-#include <utils/String8.h>
-#include "CameraParameters.h"
-
-namespace android {
-
-/**
- * A copy of CameraParameters plus ABI-breaking changes. Needed
- * because some camera HALs directly link to CameraParameters and cannot
- * tolerate an ABI change.
- */
-class CameraParameters2
-{
-public:
- CameraParameters2();
- CameraParameters2(const String8 &params) { unflatten(params); }
- ~CameraParameters2();
-
- String8 flatten() const;
- void unflatten(const String8 &params);
-
- void set(const char *key, const char *value);
- void set(const char *key, int value);
- void setFloat(const char *key, float value);
- // Look up string value by key.
- // -- The string remains valid until the next set/remove of the same key,
- // or until the map gets cleared.
- const char *get(const char *key) const;
- int getInt(const char *key) const;
- float getFloat(const char *key) const;
-
- // Compare the order that key1 was set vs the order that key2 was set.
- //
- // Sets the order parameter to an integer less than, equal to, or greater
- // than zero if key1's set order was respectively, to be less than, to
- // match, or to be greater than key2's set order.
- //
- // Error codes:
- // * NAME_NOT_FOUND - if either key has not been set previously
- // * BAD_VALUE - if any of the parameters are NULL
- status_t compareSetOrder(const char *key1, const char *key2,
- /*out*/
- int *order) const;
-
- void remove(const char *key);
-
- void setPreviewSize(int width, int height);
- void getPreviewSize(int *width, int *height) const;
- void getSupportedPreviewSizes(Vector<Size> &sizes) const;
-
- // Set the dimensions in pixels to the given width and height
- // for video frames. The given width and height must be one
- // of the supported dimensions returned from
- // getSupportedVideoSizes(). Must not be called if
- // getSupportedVideoSizes() returns an empty Vector of Size.
- void setVideoSize(int width, int height);
- // Retrieve the current dimensions (width and height)
- // in pixels for video frames, which must be one of the
- // supported dimensions returned from getSupportedVideoSizes().
- // Must not be called if getSupportedVideoSizes() returns an
- // empty Vector of Size.
- void getVideoSize(int *width, int *height) const;
- // Retrieve a Vector of supported dimensions (width and height)
- // in pixels for video frames. If sizes returned from the method
- // is empty, the camera does not support calls to setVideoSize()
- // or getVideoSize(). In adddition, it also indicates that
- // the camera only has a single output, and does not have
- // separate output for video frames and preview frame.
- void getSupportedVideoSizes(Vector<Size> &sizes) const;
- // Retrieve the preferred preview size (width and height) in pixels
- // for video recording. The given width and height must be one of
- // supported preview sizes returned from getSupportedPreviewSizes().
- // Must not be called if getSupportedVideoSizes() returns an empty
- // Vector of Size. If getSupportedVideoSizes() returns an empty
- // Vector of Size, the width and height returned from this method
- // is invalid, and is "-1x-1".
- void getPreferredPreviewSizeForVideo(int *width, int *height) const;
-
- void setPreviewFrameRate(int fps);
- int getPreviewFrameRate() const;
- void getPreviewFpsRange(int *min_fps, int *max_fps) const;
- void setPreviewFpsRange(int min_fps, int max_fps);
- void setPreviewFormat(const char *format);
- const char *getPreviewFormat() const;
- void setPictureSize(int width, int height);
- void getPictureSize(int *width, int *height) const;
- void getSupportedPictureSizes(Vector<Size> &sizes) const;
- void setPictureFormat(const char *format);
- const char *getPictureFormat() const;
-
- void dump() const;
- status_t dump(int fd, const Vector<String16>& args) const;
-
-private:
-
- // Quick and dirty map that maintains insertion order
- template <typename KeyT, typename ValueT>
- struct OrderedKeyedVector {
-
- ssize_t add(const KeyT& key, const ValueT& value) {
- return mList.add(Pair(key, value));
- }
-
- size_t size() const {
- return mList.size();
- }
-
- const KeyT& keyAt(size_t idx) const {
- return mList[idx].mKey;
- }
-
- const ValueT& valueAt(size_t idx) const {
- return mList[idx].mValue;
- }
-
- const ValueT& valueFor(const KeyT& key) const {
- ssize_t i = indexOfKey(key);
- LOG_ALWAYS_FATAL_IF(i<0, "%s: key not found", __PRETTY_FUNCTION__);
-
- return valueAt(i);
- }
-
- ssize_t indexOfKey(const KeyT& key) const {
- size_t vectorIdx = 0;
- for (; vectorIdx < mList.size(); ++vectorIdx) {
- if (mList[vectorIdx].mKey == key) {
- return (ssize_t) vectorIdx;
- }
- }
-
- return NAME_NOT_FOUND;
- }
-
- ssize_t removeItem(const KeyT& key) {
- size_t vectorIdx = (size_t) indexOfKey(key);
-
- if (vectorIdx < 0) {
- return vectorIdx;
- }
-
- return mList.removeAt(vectorIdx);
- }
-
- void clear() {
- mList.clear();
- }
-
- // Same as removing and re-adding. The key's index changes to max.
- ssize_t replaceValueFor(const KeyT& key, const ValueT& value) {
- removeItem(key);
- return add(key, value);
- }
-
- private:
-
- struct Pair {
- Pair() : mKey(), mValue() {}
- Pair(const KeyT& key, const ValueT& value) :
- mKey(key),
- mValue(value) {}
- KeyT mKey;
- ValueT mValue;
- };
-
- Vector<Pair> mList;
- };
-
- /**
- * Order matters: Keys that are set() later are stored later in the map.
- *
- * If two keys have meaning that conflict, then the later-set key
- * wins.
- *
- * For example, preview FPS and preview FPS range conflict since only
- * we only want to use the FPS range if that's the last thing that was set.
- * So in that case, only use preview FPS range if it was set later than
- * the preview FPS.
- */
- OrderedKeyedVector<String8,String8> mMap;
-};
-
-}; // namespace android
-
-#endif
diff --git a/include/camera/CaptureResult.h b/include/camera/CaptureResult.h
new file mode 100644
index 0000000..6e47a16
--- /dev/null
+++ b/include/camera/CaptureResult.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_CAPTURERESULT_H
+#define ANDROID_HARDWARE_CAPTURERESULT_H
+
+#include <utils/RefBase.h>
+#include <camera/CameraMetadata.h>
+
+namespace android {
+
+/**
+ * CaptureResultExtras is a structure to encapsulate various indices for a capture result.
+ * These indices are framework-internal and not sent to the HAL.
+ */
+struct CaptureResultExtras {
+ /**
+ * An integer to index the request sequence that this result belongs to.
+ */
+ int32_t requestId;
+
+ /**
+ * An integer to index this result inside a request sequence, starting from 0.
+ */
+ int32_t burstId;
+
+ /**
+ * TODO: Add documentation for this field.
+ */
+ int32_t afTriggerId;
+
+ /**
+ * TODO: Add documentation for this field.
+ */
+ int32_t precaptureTriggerId;
+
+ /**
+ * A 64bit integer to index the frame number associated with this result.
+ */
+ int64_t frameNumber;
+
+ /**
+ * Constructor initializes object as invalid by setting requestId to be -1.
+ */
+ CaptureResultExtras()
+ : requestId(-1),
+ burstId(0),
+ afTriggerId(0),
+ precaptureTriggerId(0),
+ frameNumber(0) {
+ }
+
+ /**
+ * This function returns true if it's a valid CaptureResultExtras object.
+ * Otherwise, returns false. It is valid only when requestId is non-negative.
+ */
+ bool isValid();
+
+ status_t readFromParcel(Parcel* parcel);
+ status_t writeToParcel(Parcel* parcel) const;
+};
+
+struct CaptureResult : public virtual LightRefBase<CaptureResult> {
+ CameraMetadata mMetadata;
+ CaptureResultExtras mResultExtras;
+
+ CaptureResult();
+
+ CaptureResult(const CaptureResult& otherResult);
+
+ status_t readFromParcel(Parcel* parcel);
+ status_t writeToParcel(Parcel* parcel) const;
+};
+
+}
+
+#endif /* ANDROID_HARDWARE_CAPTURERESULT_H */
diff --git a/include/camera/ICameraService.h b/include/camera/ICameraService.h
index f342122..6e48f22 100644
--- a/include/camera/ICameraService.h
+++ b/include/camera/ICameraService.h
@@ -31,6 +31,7 @@ class ICameraServiceListener;
class ICameraDeviceUser;
class ICameraDeviceCallbacks;
class CameraMetadata;
+class VendorTagDescriptor;
class ICameraService : public IInterface
{
@@ -47,6 +48,7 @@ public:
ADD_LISTENER,
REMOVE_LISTENER,
GET_CAMERA_CHARACTERISTICS,
+ GET_CAMERA_VENDOR_TAG_DESCRIPTOR,
};
enum {
@@ -58,10 +60,16 @@ public:
virtual int32_t getNumberOfCameras() = 0;
virtual status_t getCameraInfo(int cameraId,
- struct CameraInfo* cameraInfo) = 0;
+ /*out*/
+ struct CameraInfo* cameraInfo) = 0;
virtual status_t getCameraCharacteristics(int cameraId,
- CameraMetadata* cameraInfo) = 0;
+ /*out*/
+ CameraMetadata* cameraInfo) = 0;
+
+ virtual status_t getCameraVendorTagDescriptor(
+ /*out*/
+ sp<VendorTagDescriptor>& desc) = 0;
// Returns 'OK' if operation succeeded
// - Errors: ALREADY_EXISTS if the listener was already added
diff --git a/include/camera/VendorTagDescriptor.h b/include/camera/VendorTagDescriptor.h
new file mode 100644
index 0000000..1758acf
--- /dev/null
+++ b/include/camera/VendorTagDescriptor.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VENDOR_TAG_DESCRIPTOR_H
+
+#include <utils/Vector.h>
+#include <utils/KeyedVector.h>
+#include <utils/String8.h>
+#include <utils/RefBase.h>
+#include <system/camera_vendor_tags.h>
+
+#include <stdint.h>
+
+namespace android {
+
+class Parcel;
+
+/**
+ * VendorTagDescriptor objects are parcelable containers for the vendor tag
+ * definitions provided, and are typically used to pass the vendor tag
+ * information enumerated by the HAL to clients of the camera service.
+ */
+class VendorTagDescriptor
+ : public LightRefBase<VendorTagDescriptor> {
+ public:
+ virtual ~VendorTagDescriptor();
+
+ /**
+ * The following 'get*' methods implement the corresponding
+ * functions defined in
+ * system/media/camera/include/system/camera_vendor_tags.h
+ */
+
+ // Returns the number of vendor tags defined.
+ int getTagCount() const;
+
+ // Returns an array containing the id's of vendor tags defined.
+ void getTagArray(uint32_t* tagArray) const;
+
+ // Returns the section name string for a given vendor tag id.
+ const char* getSectionName(uint32_t tag) const;
+
+ // Returns the tag name string for a given vendor tag id.
+ const char* getTagName(uint32_t tag) const;
+
+ // Returns the tag type for a given vendor tag id.
+ int getTagType(uint32_t tag) const;
+
+ /**
+ * Write the VendorTagDescriptor object into the given parcel.
+ *
+ * Returns OK on success, or a negative error code.
+ */
+ status_t writeToParcel(
+ /*out*/
+ Parcel* parcel) const;
+
+ /**
+ * Convenience method to get a vector containing all vendor tag
+ * sections, or an empty vector if none are defined.
+ */
+ SortedVector<String8> getAllSectionNames() const;
+
+ /**
+ * Lookup the tag id for a given tag name and section.
+ *
+ * Returns OK on success, or a negative error code.
+ */
+ status_t lookupTag(String8 name, String8 section, /*out*/uint32_t* tag) const;
+
+ /**
+ * Dump the currently configured vendor tags to a file descriptor.
+ */
+ void dump(int fd, int verbosity, int indentation) const;
+
+ // Static methods:
+
+ /**
+ * Create a VendorTagDescriptor object from the given parcel.
+ *
+ * Returns OK on success, or a negative error code.
+ */
+ static status_t createFromParcel(const Parcel* parcel,
+ /*out*/
+ sp<VendorTagDescriptor>& descriptor);
+
+ /**
+ * Create a VendorTagDescriptor object from the given vendor_tag_ops_t
+ * struct.
+ *
+ * Returns OK on success, or a negative error code.
+ */
+ static status_t createDescriptorFromOps(const vendor_tag_ops_t* vOps,
+ /*out*/
+ sp<VendorTagDescriptor>& descriptor);
+
+ /**
+ * Sets the global vendor tag descriptor to use for this process.
+ * Camera metadata operations that access vendor tags will use the
+ * vendor tag definitions set this way.
+ *
+ * Returns OK on success, or a negative error code.
+ */
+ static status_t setAsGlobalVendorTagDescriptor(const sp<VendorTagDescriptor>& desc);
+
+ /**
+ * Clears the global vendor tag descriptor used by this process.
+ */
+ static void clearGlobalVendorTagDescriptor();
+
+ /**
+ * Returns the global vendor tag descriptor used by this process.
+ * This will contain NULL if no vendor tags are defined.
+ */
+ static sp<VendorTagDescriptor> getGlobalVendorTagDescriptor();
+ protected:
+ VendorTagDescriptor();
+ KeyedVector<String8, KeyedVector<String8, uint32_t>*> mReverseMapping;
+ KeyedVector<uint32_t, String8> mTagToNameMap;
+ KeyedVector<uint32_t, uint32_t> mTagToSectionMap; // Value is offset in mSections
+ KeyedVector<uint32_t, int32_t> mTagToTypeMap;
+ SortedVector<String8> mSections;
+ // must be int32_t to be compatible with Parcel::writeInt32
+ int32_t mTagCount;
+ private:
+ vendor_tag_ops mVendorOps;
+};
+
+} /* namespace android */
+
+#define VENDOR_TAG_DESCRIPTOR_H
+#endif /* VENDOR_TAG_DESCRIPTOR_H */
diff --git a/include/camera/camera2/ICameraDeviceCallbacks.h b/include/camera/camera2/ICameraDeviceCallbacks.h
index 8dac4f2..f059b3d 100644
--- a/include/camera/camera2/ICameraDeviceCallbacks.h
+++ b/include/camera/camera2/ICameraDeviceCallbacks.h
@@ -24,9 +24,12 @@
#include <utils/Timers.h>
#include <system/camera.h>
+#include <camera/CaptureResult.h>
+
namespace android {
class CameraMetadata;
+
class ICameraDeviceCallbacks : public IInterface
{
/**
@@ -45,18 +48,19 @@ public:
};
// One way
- virtual void onDeviceError(CameraErrorCode errorCode) = 0;
+ virtual void onDeviceError(CameraErrorCode errorCode,
+ const CaptureResultExtras& resultExtras) = 0;
// One way
virtual void onDeviceIdle() = 0;
// One way
- virtual void onCaptureStarted(int32_t requestId,
+ virtual void onCaptureStarted(const CaptureResultExtras& resultExtras,
int64_t timestamp) = 0;
// One way
- virtual void onResultReceived(int32_t requestId,
- const CameraMetadata& result) = 0;
+ virtual void onResultReceived(const CameraMetadata& metadata,
+ const CaptureResultExtras& resultExtras) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/include/camera/camera2/ICameraDeviceUser.h b/include/camera/camera2/ICameraDeviceUser.h
index f71f302..913696f 100644
--- a/include/camera/camera2/ICameraDeviceUser.h
+++ b/include/camera/camera2/ICameraDeviceUser.h
@@ -19,6 +19,7 @@
#include <binder/IInterface.h>
#include <binder/Parcel.h>
+#include <utils/List.h>
struct camera_metadata;
@@ -30,6 +31,10 @@ class Surface;
class CaptureRequest;
class CameraMetadata;
+enum {
+ NO_IN_FLIGHT_REPEATING_FRAMES = -1,
+};
+
class ICameraDeviceUser : public IInterface
{
/**
@@ -44,9 +49,34 @@ public:
* Request Handling
**/
+ /**
+ * For streaming requests, output lastFrameNumber is the last frame number
+ * of the previous repeating request.
+ * For non-streaming requests, output lastFrameNumber is the expected last
+ * frame number of the current request.
+ */
virtual int submitRequest(sp<CaptureRequest> request,
- bool streaming = false) = 0;
- virtual status_t cancelRequest(int requestId) = 0;
+ bool streaming = false,
+ /*out*/
+ int64_t* lastFrameNumber = NULL) = 0;
+
+ /**
+ * For streaming requests, output lastFrameNumber is the last frame number
+ * of the previous repeating request.
+ * For non-streaming requests, output lastFrameNumber is the expected last
+ * frame number of the current request.
+ */
+ virtual int submitRequestList(List<sp<CaptureRequest> > requestList,
+ bool streaming = false,
+ /*out*/
+ int64_t* lastFrameNumber = NULL) = 0;
+
+ /**
+ * Output lastFrameNumber is the last frame number of the previous repeating request.
+ */
+ virtual status_t cancelRequest(int requestId,
+ /*out*/
+ int64_t* lastFrameNumber = NULL) = 0;
virtual status_t deleteStream(int streamId) = 0;
virtual status_t createStream(
@@ -64,8 +94,12 @@ public:
// Wait until all the submitted requests have finished processing
virtual status_t waitUntilIdle() = 0;
- // Flush all pending and in-progress work as quickly as possible.
- virtual status_t flush() = 0;
+ /**
+ * Flush all pending and in-progress work as quickly as possible.
+ * Output lastFrameNumber is the last frame number of the previous repeating request.
+ */
+ virtual status_t flush(/*out*/
+ int64_t* lastFrameNumber = NULL) = 0;
};
// ----------------------------------------------------------------------------