2012-07-31 01:59:05 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2012-09-05 05:01:56 +04:00
|
|
|
#include "DOMCameraControl.h"
|
|
|
|
#include "CameraControlImpl.h"
|
2012-07-31 01:59:05 +04:00
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fallback camera control subclass. Can be used as a template for the
|
|
|
|
* definition of new camera support classes.
|
|
|
|
*/
|
2012-09-05 05:01:56 +04:00
|
|
|
class nsFallbackCameraControl : public CameraControlImpl
|
2012-07-31 01:59:05 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-10-01 04:37:47 +04:00
|
|
|
nsFallbackCameraControl(uint32_t aCameraId, nsIThread* aCameraThread, nsDOMCameraControl* aDOMCameraControl, nsICameraGetCameraCallback* onSuccess, nsICameraErrorCallback* onError, uint64_t aWindowId);
|
2012-07-31 01:59:05 +04:00
|
|
|
|
|
|
|
const char* GetParameter(const char* aKey);
|
2012-08-22 19:56:38 +04:00
|
|
|
const char* GetParameterConstChar(uint32_t aKey);
|
|
|
|
double GetParameterDouble(uint32_t aKey);
|
|
|
|
void GetParameter(uint32_t aKey, nsTArray<dom::CameraRegion>& aRegions);
|
2012-07-31 01:59:05 +04:00
|
|
|
void SetParameter(const char* aKey, const char* aValue);
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetParameter(uint32_t aKey, const char* aValue);
|
|
|
|
void SetParameter(uint32_t aKey, double aValue);
|
|
|
|
void SetParameter(uint32_t aKey, const nsTArray<dom::CameraRegion>& aRegions);
|
2012-09-05 05:01:56 +04:00
|
|
|
nsresult PushParameters();
|
2012-07-31 01:59:05 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
~nsFallbackCameraControl();
|
|
|
|
|
|
|
|
nsresult GetPreviewStreamImpl(GetPreviewStreamTask* aGetPreviewStream);
|
2012-09-05 05:01:56 +04:00
|
|
|
nsresult StartPreviewImpl(StartPreviewTask* aStartPreview);
|
|
|
|
nsresult StopPreviewImpl(StopPreviewTask* aStopPreview);
|
2012-07-31 01:59:05 +04:00
|
|
|
nsresult AutoFocusImpl(AutoFocusTask* aAutoFocus);
|
|
|
|
nsresult TakePictureImpl(TakePictureTask* aTakePicture);
|
|
|
|
nsresult StartRecordingImpl(StartRecordingTask* aStartRecording);
|
|
|
|
nsresult StopRecordingImpl(StopRecordingTask* aStopRecording);
|
2012-09-05 05:01:56 +04:00
|
|
|
nsresult PushParametersImpl();
|
|
|
|
nsresult PullParametersImpl();
|
2012-07-31 01:59:05 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsFallbackCameraControl(const nsFallbackCameraControl&) MOZ_DELETE;
|
|
|
|
nsFallbackCameraControl& operator=(const nsFallbackCameraControl&) MOZ_DELETE;
|
|
|
|
};
|
|
|
|
|
2012-09-05 05:01:56 +04:00
|
|
|
/**
|
|
|
|
* Stub implementation of the DOM-facing camera control constructor.
|
|
|
|
*
|
|
|
|
* This should never get called--it exists to keep the linker happy; if
|
|
|
|
* implemented, it should construct (e.g.) nsFallbackCameraControl and
|
|
|
|
* store a reference in the 'mCameraControl' member (which is why it is
|
|
|
|
* defined here).
|
|
|
|
*/
|
2012-10-01 04:37:47 +04:00
|
|
|
nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId, nsIThread* aCameraThread, nsICameraGetCameraCallback* onSuccess, nsICameraErrorCallback* onError, uint64_t aWindowId)
|
2012-09-05 05:01:56 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-07-31 01:59:05 +04:00
|
|
|
/**
|
|
|
|
* Stub implemetations of the fallback camera control.
|
|
|
|
*
|
|
|
|
* None of these should ever get called--they exist to keep the linker happy,
|
|
|
|
* and may be used as templates for new camera support classes.
|
|
|
|
*/
|
2012-10-01 04:37:47 +04:00
|
|
|
nsFallbackCameraControl::nsFallbackCameraControl(uint32_t aCameraId, nsIThread* aCameraThread, nsDOMCameraControl* aDOMCameraControl, nsICameraGetCameraCallback* onSuccess, nsICameraErrorCallback* onError, uint64_t aWindowId)
|
|
|
|
: CameraControlImpl(aCameraId, aCameraThread, aWindowId)
|
2012-09-05 05:01:56 +04:00
|
|
|
{
|
|
|
|
}
|
2012-07-31 01:59:05 +04:00
|
|
|
|
|
|
|
nsFallbackCameraControl::~nsFallbackCameraControl()
|
2012-09-05 05:01:56 +04:00
|
|
|
{
|
|
|
|
}
|
2012-07-31 01:59:05 +04:00
|
|
|
|
|
|
|
const char*
|
|
|
|
nsFallbackCameraControl::GetParameter(const char* aKey)
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char*
|
2012-08-22 19:56:38 +04:00
|
|
|
nsFallbackCameraControl::GetParameterConstChar(uint32_t aKey)
|
2012-07-31 01:59:05 +04:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
double
|
2012-08-22 19:56:38 +04:00
|
|
|
nsFallbackCameraControl::GetParameterDouble(uint32_t aKey)
|
2012-07-31 01:59:05 +04:00
|
|
|
{
|
|
|
|
return NAN;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
nsFallbackCameraControl::GetParameter(uint32_t aKey, nsTArray<dom::CameraRegion>& aRegions)
|
2012-07-31 01:59:05 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsFallbackCameraControl::SetParameter(const char* aKey, const char* aValue)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
nsFallbackCameraControl::SetParameter(uint32_t aKey, const char* aValue)
|
2012-07-31 01:59:05 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
nsFallbackCameraControl::SetParameter(uint32_t aKey, double aValue)
|
2012-07-31 01:59:05 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
nsFallbackCameraControl::SetParameter(uint32_t aKey, const nsTArray<dom::CameraRegion>& aRegions)
|
2012-07-31 01:59:05 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-09-05 05:01:56 +04:00
|
|
|
nsresult
|
2012-07-31 01:59:05 +04:00
|
|
|
nsFallbackCameraControl::PushParameters()
|
|
|
|
{
|
2012-09-05 05:01:56 +04:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2012-07-31 01:59:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsFallbackCameraControl::GetPreviewStreamImpl(GetPreviewStreamTask* aGetPreviewStream)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2012-09-05 05:01:56 +04:00
|
|
|
nsresult
|
|
|
|
nsFallbackCameraControl::StartPreviewImpl(StartPreviewTask* aGetPreviewStream)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsFallbackCameraControl::StopPreviewImpl(StopPreviewTask* aGetPreviewStream)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2012-07-31 01:59:05 +04:00
|
|
|
nsresult
|
|
|
|
nsFallbackCameraControl::AutoFocusImpl(AutoFocusTask* aAutoFocus)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsFallbackCameraControl::TakePictureImpl(TakePictureTask* aTakePicture)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsFallbackCameraControl::StartRecordingImpl(StartRecordingTask* aStartRecording)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsFallbackCameraControl::StopRecordingImpl(StopRecordingTask* aStopRecording)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2012-09-05 05:01:56 +04:00
|
|
|
nsFallbackCameraControl::PushParametersImpl()
|
2012-07-31 01:59:05 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2012-09-05 05:01:56 +04:00
|
|
|
nsFallbackCameraControl::PullParametersImpl()
|
2012-07-31 01:59:05 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|