Loading camera/aidl/android/hardware/camera2/ICameraDeviceUser.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -140,5 +140,7 @@ interface ICameraDeviceUser void prepare2(int maxCount, int streamId); void updateOutputConfiguration(int streamId, in OutputConfiguration outputConfiguration); void finalizeOutputConfigurations(int streamId, in OutputConfiguration outputConfiguration); } camera/camera2/OutputConfiguration.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -160,12 +160,12 @@ status_t OutputConfiguration::readFromParcel(const android::Parcel* parcel) { } OutputConfiguration::OutputConfiguration(sp<IGraphicBufferProducer>& gbp, int rotation, int surfaceSetID) { int surfaceSetID, bool isShared) { mGbps.push_back(gbp); mRotation = rotation; mSurfaceSetID = surfaceSetID; mIsDeferred = false; mIsShared = false; mIsShared = isShared; } status_t OutputConfiguration::writeToParcel(android::Parcel* parcel) const { Loading camera/include/camera/camera2/OutputConfiguration.h +2 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public: OutputConfiguration(const android::Parcel& parcel); OutputConfiguration(sp<IGraphicBufferProducer>& gbp, int rotation, int surfaceSetID = INVALID_SET_ID); int surfaceSetID = INVALID_SET_ID, bool isShared = false); bool operator == (const OutputConfiguration& other) const { return ( mRotation == other.mRotation && Loading Loading @@ -110,6 +110,7 @@ public: bool gbpsEqual(const OutputConfiguration& other) const; bool gbpsLessThan(const OutputConfiguration& other) const; void addGraphicProducer(sp<IGraphicBufferProducer> gbp) {mGbps.push_back(gbp);} private: std::vector<sp<IGraphicBufferProducer>> mGbps; int mRotation; Loading camera/ndk/NdkCameraCaptureSession.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -135,3 +135,19 @@ camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* sessi } return session->abortCaptures(); } EXPORT camera_status_t ACameraCaptureSession_updateSharedOutput(ACameraCaptureSession* session, ACaptureSessionOutput* output) { ATRACE_CALL(); if (session == nullptr) { ALOGE("%s: Error: session is null", __FUNCTION__); return ACAMERA_ERROR_INVALID_PARAMETER; } if (session->isClosed()) { ALOGE("%s: session %p is already closed", __FUNCTION__, session); return ACAMERA_ERROR_SESSION_CLOSED; } return session->updateOutputConfiguration(output); } camera/ndk/NdkCameraDevice.cpp +64 −1 Original line number Diff line number Diff line Loading @@ -103,10 +103,73 @@ camera_status_t ACaptureSessionOutput_create( __FUNCTION__, window, out); return ACAMERA_ERROR_INVALID_PARAMETER; } *out = new ACaptureSessionOutput(window); *out = new ACaptureSessionOutput(window, false); return ACAMERA_OK; } EXPORT camera_status_t ACaptureSessionSharedOutput_create( ANativeWindow* window, /*out*/ACaptureSessionOutput** out) { ATRACE_CALL(); if (window == nullptr || out == nullptr) { ALOGE("%s: Error: bad argument. window %p, out %p", __FUNCTION__, window, out); return ACAMERA_ERROR_INVALID_PARAMETER; } *out = new ACaptureSessionOutput(window, true); return ACAMERA_OK; } EXPORT camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *out, ANativeWindow* window) { ATRACE_CALL(); if ((window == nullptr) || (out == nullptr)) { ALOGE("%s: Error: bad argument. window %p, out %p", __FUNCTION__, window, out); return ACAMERA_ERROR_INVALID_PARAMETER; } if (!out->mIsShared) { ALOGE("%s: Error trying to insert a new window in non-shared output configuration", __FUNCTION__); return ACAMERA_ERROR_INVALID_OPERATION; } if (out->mWindow == window) { ALOGE("%s: Error trying to add the same window associated with the output configuration", __FUNCTION__); return ACAMERA_ERROR_INVALID_PARAMETER; } auto insert = out->mSharedWindows.insert(window); camera_status_t ret = (insert.second) ? ACAMERA_OK : ACAMERA_ERROR_INVALID_PARAMETER; return ret; } EXPORT camera_status_t ACaptureSessionSharedOutput_remove(ACaptureSessionOutput *out, ANativeWindow* window) { ATRACE_CALL(); if ((window == nullptr) || (out == nullptr)) { ALOGE("%s: Error: bad argument. window %p, out %p", __FUNCTION__, window, out); return ACAMERA_ERROR_INVALID_PARAMETER; } if (!out->mIsShared) { ALOGE("%s: Error trying to remove a window in non-shared output configuration", __FUNCTION__); return ACAMERA_ERROR_INVALID_OPERATION; } if (out->mWindow == window) { ALOGE("%s: Error trying to remove the same window associated with the output configuration", __FUNCTION__); return ACAMERA_ERROR_INVALID_PARAMETER; } auto remove = out->mSharedWindows.erase(window); camera_status_t ret = (remove) ? ACAMERA_OK : ACAMERA_ERROR_INVALID_PARAMETER; return ret; } EXPORT void ACaptureSessionOutput_free(ACaptureSessionOutput* output) { ATRACE_CALL(); Loading Loading
camera/aidl/android/hardware/camera2/ICameraDeviceUser.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -140,5 +140,7 @@ interface ICameraDeviceUser void prepare2(int maxCount, int streamId); void updateOutputConfiguration(int streamId, in OutputConfiguration outputConfiguration); void finalizeOutputConfigurations(int streamId, in OutputConfiguration outputConfiguration); }
camera/camera2/OutputConfiguration.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -160,12 +160,12 @@ status_t OutputConfiguration::readFromParcel(const android::Parcel* parcel) { } OutputConfiguration::OutputConfiguration(sp<IGraphicBufferProducer>& gbp, int rotation, int surfaceSetID) { int surfaceSetID, bool isShared) { mGbps.push_back(gbp); mRotation = rotation; mSurfaceSetID = surfaceSetID; mIsDeferred = false; mIsShared = false; mIsShared = isShared; } status_t OutputConfiguration::writeToParcel(android::Parcel* parcel) const { Loading
camera/include/camera/camera2/OutputConfiguration.h +2 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ public: OutputConfiguration(const android::Parcel& parcel); OutputConfiguration(sp<IGraphicBufferProducer>& gbp, int rotation, int surfaceSetID = INVALID_SET_ID); int surfaceSetID = INVALID_SET_ID, bool isShared = false); bool operator == (const OutputConfiguration& other) const { return ( mRotation == other.mRotation && Loading Loading @@ -110,6 +110,7 @@ public: bool gbpsEqual(const OutputConfiguration& other) const; bool gbpsLessThan(const OutputConfiguration& other) const; void addGraphicProducer(sp<IGraphicBufferProducer> gbp) {mGbps.push_back(gbp);} private: std::vector<sp<IGraphicBufferProducer>> mGbps; int mRotation; Loading
camera/ndk/NdkCameraCaptureSession.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -135,3 +135,19 @@ camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* sessi } return session->abortCaptures(); } EXPORT camera_status_t ACameraCaptureSession_updateSharedOutput(ACameraCaptureSession* session, ACaptureSessionOutput* output) { ATRACE_CALL(); if (session == nullptr) { ALOGE("%s: Error: session is null", __FUNCTION__); return ACAMERA_ERROR_INVALID_PARAMETER; } if (session->isClosed()) { ALOGE("%s: session %p is already closed", __FUNCTION__, session); return ACAMERA_ERROR_SESSION_CLOSED; } return session->updateOutputConfiguration(output); }
camera/ndk/NdkCameraDevice.cpp +64 −1 Original line number Diff line number Diff line Loading @@ -103,10 +103,73 @@ camera_status_t ACaptureSessionOutput_create( __FUNCTION__, window, out); return ACAMERA_ERROR_INVALID_PARAMETER; } *out = new ACaptureSessionOutput(window); *out = new ACaptureSessionOutput(window, false); return ACAMERA_OK; } EXPORT camera_status_t ACaptureSessionSharedOutput_create( ANativeWindow* window, /*out*/ACaptureSessionOutput** out) { ATRACE_CALL(); if (window == nullptr || out == nullptr) { ALOGE("%s: Error: bad argument. window %p, out %p", __FUNCTION__, window, out); return ACAMERA_ERROR_INVALID_PARAMETER; } *out = new ACaptureSessionOutput(window, true); return ACAMERA_OK; } EXPORT camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *out, ANativeWindow* window) { ATRACE_CALL(); if ((window == nullptr) || (out == nullptr)) { ALOGE("%s: Error: bad argument. window %p, out %p", __FUNCTION__, window, out); return ACAMERA_ERROR_INVALID_PARAMETER; } if (!out->mIsShared) { ALOGE("%s: Error trying to insert a new window in non-shared output configuration", __FUNCTION__); return ACAMERA_ERROR_INVALID_OPERATION; } if (out->mWindow == window) { ALOGE("%s: Error trying to add the same window associated with the output configuration", __FUNCTION__); return ACAMERA_ERROR_INVALID_PARAMETER; } auto insert = out->mSharedWindows.insert(window); camera_status_t ret = (insert.second) ? ACAMERA_OK : ACAMERA_ERROR_INVALID_PARAMETER; return ret; } EXPORT camera_status_t ACaptureSessionSharedOutput_remove(ACaptureSessionOutput *out, ANativeWindow* window) { ATRACE_CALL(); if ((window == nullptr) || (out == nullptr)) { ALOGE("%s: Error: bad argument. window %p, out %p", __FUNCTION__, window, out); return ACAMERA_ERROR_INVALID_PARAMETER; } if (!out->mIsShared) { ALOGE("%s: Error trying to remove a window in non-shared output configuration", __FUNCTION__); return ACAMERA_ERROR_INVALID_OPERATION; } if (out->mWindow == window) { ALOGE("%s: Error trying to remove the same window associated with the output configuration", __FUNCTION__); return ACAMERA_ERROR_INVALID_PARAMETER; } auto remove = out->mSharedWindows.erase(window); camera_status_t ret = (remove) ? ACAMERA_OK : ACAMERA_ERROR_INVALID_PARAMETER; return ret; } EXPORT void ACaptureSessionOutput_free(ACaptureSessionOutput* output) { ATRACE_CALL(); Loading