Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / camera / CameraControlListener.h
blob727324ac2b275c86486f18d1f5514620152b9074
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
8 #include <stdint.h>
9 #include "ICameraControl.h"
11 namespace mozilla {
13 namespace layers {
14 class Image;
17 class CameraControlListener
19 public:
20 CameraControlListener()
22 MOZ_COUNT_CTOR(CameraControlListener);
25 protected:
26 // Protected destructor, to discourage deletion outside of Release():
27 virtual ~CameraControlListener()
29 MOZ_COUNT_DTOR(CameraControlListener);
32 public:
33 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CameraControlListener);
35 enum HardwareState
37 kHardwareOpen,
38 kHardwareClosed
40 virtual void OnHardwareStateChange(HardwareState aState) { }
42 enum PreviewState
44 kPreviewStopped,
45 kPreviewPaused,
46 kPreviewStarted
48 virtual void OnPreviewStateChange(PreviewState aState) { }
50 enum RecorderState
52 kRecorderStopped,
53 kRecorderStarted,
54 #ifdef MOZ_B2G_CAMERA
55 kFileSizeLimitReached,
56 kVideoLengthLimitReached,
57 kTrackCompleted,
58 kTrackFailed,
59 kMediaRecorderFailed,
60 kMediaServerFailed
61 #endif
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)
70 return false;
73 class CameraListenerConfiguration : public ICameraControl::Configuration
75 public:
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) { }
86 enum UserContext
88 kInStartCamera,
89 kInStopCamera,
90 kInAutoFocus,
91 kInStartFaceDetection,
92 kInStopFaceDetection,
93 kInTakePicture,
94 kInStartRecording,
95 kInStopRecording,
96 kInSetConfiguration,
97 kInStartPreview,
98 kInStopPreview,
99 kInSetPictureSize,
100 kInSetThumbnailSize,
101 kInResumeContinuousFocus,
102 kInUnspecified
104 // Error handler for problems arising due to user-initiated actions.
105 virtual void OnUserError(UserContext aContext, nsresult aError) { }
107 enum SystemContext
109 kSystemService
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