Camera2: Revamp recording support to allow opaque formats.

- Avoid memcpy of buffer data by using metadata mode
- Temporarily add MediaConsumer BufferQueue class

Bug: 6243944
Change-Id: I7a8c4222b7dbd14f1b1d86fda06d38eb640e87c1
diff --git a/services/camera/libcameraservice/Camera2Client.h b/services/camera/libcameraservice/Camera2Client.h
index 8d410f1..d7836ca 100644
--- a/services/camera/libcameraservice/Camera2Client.h
+++ b/services/camera/libcameraservice/Camera2Client.h
@@ -23,6 +23,7 @@
 #include <binder/MemoryBase.h>
 #include <binder/MemoryHeapBase.h>
 #include <gui/CpuConsumer.h>
+#include "MediaConsumer.h"
 
 namespace android {
 
@@ -170,6 +171,8 @@
 
         bool recordingHint;
         bool videoStabilization;
+
+        bool storeMetadataInBuffers;
     } mParameters;
 
     /** Camera device-related private members */
@@ -219,11 +222,11 @@
     /* Recording related members */
 
     int mRecordingStreamId;
-    sp<CpuConsumer>    mRecordingConsumer;
+    sp<MediaConsumer>    mRecordingConsumer;
     sp<ANativeWindow>  mRecordingWindow;
     // Simple listener that forwards frame available notifications from
     // a CPU consumer to the recording notification
-    class RecordingWaiter: public CpuConsumer::FrameAvailableListener {
+    class RecordingWaiter: public MediaConsumer::FrameAvailableListener {
       public:
         RecordingWaiter(Camera2Client *parent) : mParent(parent) {}
         void onFrameAvailable() { mParent->onRecordingFrameAvailable(); }
@@ -237,7 +240,6 @@
     // TODO: This needs to be queried from somewhere, or the BufferQueue needs
     // to be passed all the way to stagefright
     static const size_t kRecordingHeapCount = 4;
-    static const uint32_t kRecordingFormat = HAL_PIXEL_FORMAT_YCrCb_420_SP;
     size_t mRecordingHeapHead, mRecordingHeapFree;
     // Handle new recording image buffers
     void onRecordingFrameAvailable();