1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef DOM_CAMERA_CAMERACONTROLLISTENER_H
6 #define DOM_CAMERA_CAMERACONTROLLISTENER_H
9 #include "ICameraControl.h"
17 class CameraControlListener
20 CameraControlListener()
22 MOZ_COUNT_CTOR(CameraControlListener
);
26 // Protected destructor, to discourage deletion outside of Release():
27 virtual ~CameraControlListener()
29 MOZ_COUNT_DTOR(CameraControlListener
);
33 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CameraControlListener
);
40 virtual void OnHardwareStateChange(HardwareState aState
) { }
48 virtual void OnPreviewStateChange(PreviewState aState
) { }
55 kFileSizeLimitReached
,
56 kVideoLengthLimitReached
,
63 enum { kNoTrackNumber
= -1 };
64 virtual void OnRecorderStateChange(RecorderState aState
, int32_t aStatus
, int32_t aTrackNum
) { }
66 virtual void OnShutter() { }
67 virtual void OnRateLimitPreview(bool aLimit
) { }
68 virtual bool OnNewPreviewFrame(layers::Image
* aFrame
, uint32_t aWidth
, uint32_t aHeight
)
73 class CameraListenerConfiguration
: public ICameraControl::Configuration
76 uint32_t mMaxMeteringAreas
;
77 uint32_t mMaxFocusAreas
;
79 virtual void OnConfigurationChange(const CameraListenerConfiguration
& aConfiguration
) { }
81 virtual void OnAutoFocusComplete(bool aAutoFocusSucceeded
) { }
82 virtual void OnAutoFocusMoving(bool aIsMoving
) { }
83 virtual void OnTakePictureComplete(uint8_t* aData
, uint32_t aLength
, const nsAString
& aMimeType
) { }
84 virtual void OnFacesDetected(const nsTArray
<ICameraControl::Face
>& aFaces
) { }
91 kInStartFaceDetection
,
101 kInResumeContinuousFocus
,
104 // Error handler for problems arising due to user-initiated actions.
105 virtual void OnUserError(UserContext aContext
, nsresult aError
) { }
111 // Error handler for problems arising due to system failures, not triggered
112 // by something the CameraControl API user did.
113 virtual void OnSystemError(SystemContext aContext
, nsresult aError
) { }
116 } // namespace mozilla
118 #endif // DOM_CAMERA_CAMERACONTROLLISTENER_H