summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/device3/Camera3Device.h
diff options
context:
space:
mode:
Diffstat (limited to 'services/camera/libcameraservice/device3/Camera3Device.h')
-rw-r--r--services/camera/libcameraservice/device3/Camera3Device.h80
1 files changed, 70 insertions, 10 deletions
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index a77548d..4fbcb2e 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -116,6 +116,8 @@ class Camera3Device :
virtual status_t deleteReprocessStream(int id);
virtual status_t configureStreams();
+ virtual status_t getInputBufferProducer(
+ sp<IGraphicBufferProducer> *producer);
virtual status_t createDefaultRequest(int templateId, CameraMetadata *request);
@@ -136,6 +138,8 @@ class Camera3Device :
virtual status_t flush(int64_t *lastFrameNumber = NULL);
+ virtual status_t prepare(int streamId);
+
virtual uint32_t getDeviceVersion();
virtual ssize_t getJpegBufferSize(uint32_t width, uint32_t height) const;
@@ -179,6 +183,14 @@ class Camera3Device :
uint32_t mDeviceVersion;
+ struct Size {
+ uint32_t width;
+ uint32_t height;
+ Size(uint32_t w = 0, uint32_t h = 0) : width(w), height(h){}
+ };
+ // Map from format to size.
+ Vector<Size> mSupportedOpaqueInputSizes;
+
enum Status {
STATUS_ERROR,
STATUS_UNINITIALIZED,
@@ -324,11 +336,11 @@ class Camera3Device :
*/
bool tryLockSpinRightRound(Mutex& lock);
- struct Size {
- int width;
- int height;
- Size(int w, int h) : width(w), height(h){}
- };
+ /**
+ * Helper function to determine if an input size for implementation defined
+ * format is supported.
+ */
+ bool isOpaqueInputSizeSupported(uint32_t width, uint32_t height);
/**
* Helper function to get the largest Jpeg resolution (in area)
@@ -364,7 +376,7 @@ class Camera3Device :
sp<camera3::StatusTracker> statusTracker,
camera3_device_t *hal3Device);
- void setNotifyCallback(NotificationListener *listener);
+ void setNotificationListener(NotificationListener *listener);
/**
* Call after stream (re)-configuration is completed.
@@ -428,6 +440,12 @@ class Camera3Device :
*/
CameraMetadata getLatestRequest() const;
+ /**
+ * Returns true if the stream is a target of any queued or repeating
+ * capture request
+ */
+ bool isStreamPending(sp<camera3::Camera3StreamInterface>& stream);
+
protected:
virtual bool threadLoop();
@@ -549,7 +567,6 @@ class Camera3Device :
Vector<camera3_stream_buffer_t> pendingOutputBuffers;
-
// Fields used by the partial result only
struct PartialResultInFlight {
// Set by process_capture_result once 3A has been sent to clients
@@ -600,7 +617,8 @@ class Camera3Device :
resultExtras(extras),
hasInputBuffer(hasInput){
}
-};
+ };
+
// Map from frame number to the in-flight request state
typedef KeyedVector<uint32_t, InFlightRequest> InFlightMap;
@@ -632,6 +650,45 @@ class Camera3Device :
sp<camera3::StatusTracker> mStatusTracker;
/**
+ * Thread for preparing streams
+ */
+ class PreparerThread : private Thread, public virtual RefBase {
+ public:
+ PreparerThread();
+ ~PreparerThread();
+
+ void setNotificationListener(NotificationListener *listener);
+
+ /**
+ * Queue up a stream to be prepared. Streams are processed by
+ * a background thread in FIFO order
+ */
+ status_t prepare(sp<camera3::Camera3StreamInterface>& stream);
+
+ /**
+ * Cancel all current and pending stream preparation
+ */
+ status_t clear();
+
+ private:
+ Mutex mLock;
+
+ virtual bool threadLoop();
+
+ // Guarded by mLock
+
+ NotificationListener *mListener;
+ List<sp<camera3::Camera3StreamInterface> > mPendingStreams;
+ bool mActive;
+ bool mCancelNow;
+
+ // Only accessed by threadLoop and the destructor
+
+ sp<camera3::Camera3StreamInterface> mCurrentStream;
+ };
+ sp<PreparerThread> mPreparerThread;
+
+ /**
* Output result queue and current HAL device 3A state
*/
@@ -639,8 +696,10 @@ class Camera3Device :
Mutex mOutputLock;
/**** Scope for mOutputLock ****/
-
+ // the minimal frame number of the next non-reprocess result
uint32_t mNextResultFrameNumber;
+ // the minimal frame number of the next reprocess result
+ uint32_t mNextReprocessResultFrameNumber;
uint32_t mNextShutterFrameNumber;
List<CaptureResult> mResultQueue;
Condition mResultSignal;
@@ -669,7 +728,8 @@ class Camera3Device :
// partial results, and the frame number to the result queue.
void sendCaptureResult(CameraMetadata &pendingMetadata,
CaptureResultExtras &resultExtras,
- CameraMetadata &collectedPartialResult, uint32_t frameNumber);
+ CameraMetadata &collectedPartialResult, uint32_t frameNumber,
+ bool reprocess);
/**** Scope for mInFlightLock ****/