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 #include "DOMCameraControl.h"
6 #include "CameraControlImpl.h"
8 using namespace mozilla
;
11 * Fallback camera control subclass. Can be used as a template for the
12 * definition of new camera support classes.
14 class nsFallbackCameraControl
: public CameraControlImpl
17 nsFallbackCameraControl(uint32_t aCameraId
, nsIThread
* aCameraThread
, nsDOMCameraControl
* aDOMCameraControl
, nsICameraGetCameraCallback
* onSuccess
, nsICameraErrorCallback
* onError
, uint64_t aWindowId
);
19 const char* GetParameter(const char* aKey
);
20 const char* GetParameterConstChar(uint32_t aKey
);
21 double GetParameterDouble(uint32_t aKey
);
22 void GetParameter(uint32_t aKey
, nsTArray
<dom::CameraRegion
>& aRegions
);
23 void SetParameter(const char* aKey
, const char* aValue
);
24 void SetParameter(uint32_t aKey
, const char* aValue
);
25 void SetParameter(uint32_t aKey
, double aValue
);
26 void SetParameter(uint32_t aKey
, const nsTArray
<dom::CameraRegion
>& aRegions
);
27 nsresult
PushParameters();
30 ~nsFallbackCameraControl();
32 nsresult
GetPreviewStreamImpl(GetPreviewStreamTask
* aGetPreviewStream
);
33 nsresult
StartPreviewImpl(StartPreviewTask
* aStartPreview
);
34 nsresult
StopPreviewImpl(StopPreviewTask
* aStopPreview
);
35 nsresult
AutoFocusImpl(AutoFocusTask
* aAutoFocus
);
36 nsresult
TakePictureImpl(TakePictureTask
* aTakePicture
);
37 nsresult
StartRecordingImpl(StartRecordingTask
* aStartRecording
);
38 nsresult
StopRecordingImpl(StopRecordingTask
* aStopRecording
);
39 nsresult
PushParametersImpl();
40 nsresult
PullParametersImpl();
43 nsFallbackCameraControl(const nsFallbackCameraControl
&) MOZ_DELETE
;
44 nsFallbackCameraControl
& operator=(const nsFallbackCameraControl
&) MOZ_DELETE
;
48 * Stub implementation of the DOM-facing camera control constructor.
50 * This should never get called--it exists to keep the linker happy; if
51 * implemented, it should construct (e.g.) nsFallbackCameraControl and
52 * store a reference in the 'mCameraControl' member (which is why it is
55 nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId
, nsIThread
* aCameraThread
, nsICameraGetCameraCallback
* onSuccess
, nsICameraErrorCallback
* onError
, uint64_t aWindowId
)
60 * Stub implemetations of the fallback camera control.
62 * None of these should ever get called--they exist to keep the linker happy,
63 * and may be used as templates for new camera support classes.
65 nsFallbackCameraControl::nsFallbackCameraControl(uint32_t aCameraId
, nsIThread
* aCameraThread
, nsDOMCameraControl
* aDOMCameraControl
, nsICameraGetCameraCallback
* onSuccess
, nsICameraErrorCallback
* onError
, uint64_t aWindowId
)
66 : CameraControlImpl(aCameraId
, aCameraThread
, aWindowId
)
70 nsFallbackCameraControl::~nsFallbackCameraControl()
75 nsFallbackCameraControl::GetParameter(const char* aKey
)
81 nsFallbackCameraControl::GetParameterConstChar(uint32_t aKey
)
87 nsFallbackCameraControl::GetParameterDouble(uint32_t aKey
)
93 nsFallbackCameraControl::GetParameter(uint32_t aKey
, nsTArray
<dom::CameraRegion
>& aRegions
)
98 nsFallbackCameraControl::SetParameter(const char* aKey
, const char* aValue
)
103 nsFallbackCameraControl::SetParameter(uint32_t aKey
, const char* aValue
)
108 nsFallbackCameraControl::SetParameter(uint32_t aKey
, double aValue
)
113 nsFallbackCameraControl::SetParameter(uint32_t aKey
, const nsTArray
<dom::CameraRegion
>& aRegions
)
118 nsFallbackCameraControl::PushParameters()
120 return NS_ERROR_NOT_IMPLEMENTED
;
124 nsFallbackCameraControl::GetPreviewStreamImpl(GetPreviewStreamTask
* aGetPreviewStream
)
126 return NS_ERROR_NOT_IMPLEMENTED
;
130 nsFallbackCameraControl::StartPreviewImpl(StartPreviewTask
* aGetPreviewStream
)
132 return NS_ERROR_NOT_IMPLEMENTED
;
136 nsFallbackCameraControl::StopPreviewImpl(StopPreviewTask
* aGetPreviewStream
)
138 return NS_ERROR_NOT_IMPLEMENTED
;
142 nsFallbackCameraControl::AutoFocusImpl(AutoFocusTask
* aAutoFocus
)
144 return NS_ERROR_NOT_IMPLEMENTED
;
148 nsFallbackCameraControl::TakePictureImpl(TakePictureTask
* aTakePicture
)
150 return NS_ERROR_NOT_IMPLEMENTED
;
154 nsFallbackCameraControl::StartRecordingImpl(StartRecordingTask
* aStartRecording
)
156 return NS_ERROR_NOT_IMPLEMENTED
;
160 nsFallbackCameraControl::StopRecordingImpl(StopRecordingTask
* aStopRecording
)
162 return NS_ERROR_NOT_IMPLEMENTED
;
166 nsFallbackCameraControl::PushParametersImpl()
168 return NS_ERROR_NOT_IMPLEMENTED
;
172 nsFallbackCameraControl::PullParametersImpl()
174 return NS_ERROR_NOT_IMPLEMENTED
;