2014-02-20 08:18:52 +04:00
|
|
|
/*
|
2015-03-03 20:37:30 +03:00
|
|
|
* Copyright (C) 2013-2015 Mozilla Foundation
|
2014-02-20 08:18:52 +04:00
|
|
|
*
|
|
|
|
* 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 DOM_CAMERA_TESTGONKCAMERAHARDWARE_H
|
|
|
|
#define DOM_CAMERA_TESTGONKCAMERAHARDWARE_H
|
|
|
|
|
|
|
|
#include "GonkCameraHwMgr.h"
|
2015-03-03 20:37:30 +03:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsIDOMEventListener.h"
|
|
|
|
#include "mozilla/CondVar.h"
|
2014-02-20 08:18:52 +04:00
|
|
|
|
2015-03-03 20:37:30 +03:00
|
|
|
namespace mozilla {
|
2014-02-20 08:18:52 +04:00
|
|
|
|
|
|
|
class TestGonkCameraHardware : public android::GonkCameraHardware
|
|
|
|
{
|
2015-03-11 02:39:49 +03:00
|
|
|
#ifndef MOZ_WIDGET_GONK
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
#endif
|
|
|
|
|
2014-02-20 08:18:52 +04:00
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult Init() override;
|
|
|
|
virtual int AutoFocus() override;
|
2015-03-17 20:01:24 +03:00
|
|
|
virtual int CancelAutoFocus() override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual int StartFaceDetection() override;
|
|
|
|
virtual int StopFaceDetection() override;
|
|
|
|
virtual int TakePicture() override;
|
|
|
|
virtual void CancelTakePicture() override;
|
|
|
|
virtual int StartPreview() override;
|
|
|
|
virtual void StopPreview() override;
|
|
|
|
virtual int PushParameters(const mozilla::GonkCameraParameters& aParams) override;
|
|
|
|
virtual nsresult PullParameters(mozilla::GonkCameraParameters& aParams) override;
|
|
|
|
virtual int StartRecording() override;
|
|
|
|
virtual int StopRecording() override;
|
|
|
|
virtual int StoreMetaDataInBuffers(bool aEnabled) override;
|
2015-03-11 02:39:49 +03:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual int PushParameters(const android::CameraParameters& aParams) override;
|
|
|
|
virtual void PullParameters(android::CameraParameters& aParams) override;
|
2015-03-11 02:39:49 +03:00
|
|
|
#endif
|
2014-02-20 08:18:52 +04:00
|
|
|
|
|
|
|
TestGonkCameraHardware(mozilla::nsGonkCameraControl* aTarget,
|
|
|
|
uint32_t aCameraId,
|
2015-03-03 20:37:30 +03:00
|
|
|
const android::sp<android::Camera>& aCamera);
|
|
|
|
|
|
|
|
protected:
|
2014-02-20 08:18:52 +04:00
|
|
|
virtual ~TestGonkCameraHardware();
|
|
|
|
|
2015-03-03 20:37:30 +03:00
|
|
|
class ControlMessage;
|
|
|
|
class PushParametersDelegate;
|
|
|
|
class PullParametersDelegate;
|
2014-02-20 08:18:52 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
nsresult WaitWhileRunningOnMainThread(RefPtr<ControlMessage> aRunnable);
|
2014-02-20 08:18:52 +04:00
|
|
|
|
2015-03-03 20:37:30 +03:00
|
|
|
nsCOMPtr<nsIDOMEventListener> mDomListener;
|
|
|
|
nsCOMPtr<nsIThread> mCameraThread;
|
|
|
|
mozilla::Mutex mMutex;
|
|
|
|
mozilla::CondVar mCondVar;
|
|
|
|
nsresult mStatus;
|
2014-04-09 19:12:25 +04:00
|
|
|
|
2014-02-20 08:18:52 +04:00
|
|
|
private:
|
2015-01-07 02:35:02 +03:00
|
|
|
TestGonkCameraHardware(const TestGonkCameraHardware&) = delete;
|
|
|
|
TestGonkCameraHardware& operator=(const TestGonkCameraHardware&) = delete;
|
2014-02-20 08:18:52 +04:00
|
|
|
};
|
|
|
|
|
2015-03-03 20:37:30 +03:00
|
|
|
} // namespace mozilla
|
2014-02-20 08:18:52 +04:00
|
|
|
|
|
|
|
#endif // DOM_CAMERA_TESTGONKCAMERAHARDWARE_H
|