2012-07-30 14:59:05 -07: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-04 18:01:56 -07:00
|
|
|
#include "DOMCameraControl.h"
|
|
|
|
#include "CameraControlImpl.h"
|
2012-07-30 14:59:05 -07:00
|
|
|
|
|
|
|
using namespace mozilla;
|
2012-11-10 07:45:52 -08:00
|
|
|
using namespace mozilla::dom;
|
2012-07-30 14:59:05 -07:00
|
|
|
|
2012-10-23 15:30:28 -07:00
|
|
|
namespace mozilla {
|
|
|
|
class RecorderProfileManager;
|
|
|
|
}
|
|
|
|
|
2012-07-30 14:59:05 -07:00
|
|
|
/**
|
|
|
|
* Fallback camera control subclass. Can be used as a template for the
|
|
|
|
* definition of new camera support classes.
|
|
|
|
*/
|
2012-09-04 18:01:56 -07:00
|
|
|
class nsFallbackCameraControl : public CameraControlImpl
|
2012-07-30 14:59:05 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-09-30 17:37:47 -07:00
|
|
|
nsFallbackCameraControl(uint32_t aCameraId, nsIThread* aCameraThread, nsDOMCameraControl* aDOMCameraControl, nsICameraGetCameraCallback* onSuccess, nsICameraErrorCallback* onError, uint64_t aWindowId);
|
2012-07-30 14:59:05 -07:00
|
|
|
|
|
|
|
const char* GetParameter(const char* aKey);
|
2012-08-22 08:56:38 -07:00
|
|
|
const char* GetParameterConstChar(uint32_t aKey);
|
|
|
|
double GetParameterDouble(uint32_t aKey);
|
2013-02-11 11:37:50 -08:00
|
|
|
void GetParameter(uint32_t aKey, nsTArray<idl::CameraRegion>& aRegions);
|
2012-07-30 14:59:05 -07:00
|
|
|
void SetParameter(const char* aKey, const char* aValue);
|
2012-08-22 08:56:38 -07:00
|
|
|
void SetParameter(uint32_t aKey, const char* aValue);
|
|
|
|
void SetParameter(uint32_t aKey, double aValue);
|
2013-02-11 11:37:50 -08:00
|
|
|
void SetParameter(uint32_t aKey, const nsTArray<idl::CameraRegion>& aRegions);
|
|
|
|
nsresult GetVideoSizes(nsTArray<idl::CameraSize>& aVideoSizes);
|
2012-09-04 18:01:56 -07:00
|
|
|
nsresult PushParameters();
|
2012-07-30 14:59:05 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
~nsFallbackCameraControl();
|
|
|
|
|
|
|
|
nsresult GetPreviewStreamImpl(GetPreviewStreamTask* aGetPreviewStream);
|
2012-09-04 18:01:56 -07:00
|
|
|
nsresult StartPreviewImpl(StartPreviewTask* aStartPreview);
|
|
|
|
nsresult StopPreviewImpl(StopPreviewTask* aStopPreview);
|
2012-07-30 14:59:05 -07:00
|
|
|
nsresult AutoFocusImpl(AutoFocusTask* aAutoFocus);
|
|
|
|
nsresult TakePictureImpl(TakePictureTask* aTakePicture);
|
|
|
|
nsresult StartRecordingImpl(StartRecordingTask* aStartRecording);
|
|
|
|
nsresult StopRecordingImpl(StopRecordingTask* aStopRecording);
|
2012-09-04 18:01:56 -07:00
|
|
|
nsresult PushParametersImpl();
|
|
|
|
nsresult PullParametersImpl();
|
2012-10-23 15:30:28 -07:00
|
|
|
already_AddRefed<RecorderProfileManager> GetRecorderProfileManagerImpl();
|
2012-07-30 14:59:05 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsFallbackCameraControl(const nsFallbackCameraControl&) MOZ_DELETE;
|
|
|
|
nsFallbackCameraControl& operator=(const nsFallbackCameraControl&) MOZ_DELETE;
|
|
|
|
};
|
|
|
|
|
2012-09-04 18:01:56 -07: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).
|
|
|
|
*/
|
2013-07-06 13:55:10 -07:00
|
|
|
nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId, nsIThread* aCameraThread, nsICameraGetCameraCallback* onSuccess, nsICameraErrorCallback* onError, nsPIDOMWindow* aWindow) :
|
|
|
|
mWindow(aWindow)
|
2012-09-04 18:01:56 -07:00
|
|
|
{
|
2013-07-06 13:55:10 -07:00
|
|
|
MOZ_ASSERT(aWindow, "shouldn't be created with null window!");
|
2013-08-29 06:57:53 -07:00
|
|
|
SetIsDOMBinding();
|
2012-09-04 18:01:56 -07:00
|
|
|
}
|
|
|
|
|
2012-07-30 14:59:05 -07: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-09-30 17:37:47 -07:00
|
|
|
nsFallbackCameraControl::nsFallbackCameraControl(uint32_t aCameraId, nsIThread* aCameraThread, nsDOMCameraControl* aDOMCameraControl, nsICameraGetCameraCallback* onSuccess, nsICameraErrorCallback* onError, uint64_t aWindowId)
|
|
|
|
: CameraControlImpl(aCameraId, aCameraThread, aWindowId)
|
2012-09-04 18:01:56 -07:00
|
|
|
{
|
|
|
|
}
|
2012-07-30 14:59:05 -07:00
|
|
|
|
|
|
|
nsFallbackCameraControl::~nsFallbackCameraControl()
|
2012-09-04 18:01:56 -07:00
|
|
|
{
|
|
|
|
}
|
2012-07-30 14:59:05 -07:00
|
|
|
|
|
|
|
const char*
|
|
|
|
nsFallbackCameraControl::GetParameter(const char* aKey)
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char*
|
2012-08-22 08:56:38 -07:00
|
|
|
nsFallbackCameraControl::GetParameterConstChar(uint32_t aKey)
|
2012-07-30 14:59:05 -07:00
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
double
|
2012-08-22 08:56:38 -07:00
|
|
|
nsFallbackCameraControl::GetParameterDouble(uint32_t aKey)
|
2012-07-30 14:59:05 -07:00
|
|
|
{
|
|
|
|
return NAN;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-02-11 11:37:50 -08:00
|
|
|
nsFallbackCameraControl::GetParameter(uint32_t aKey, nsTArray<idl::CameraRegion>& aRegions)
|
2012-07-30 14:59:05 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsFallbackCameraControl::SetParameter(const char* aKey, const char* aValue)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
nsFallbackCameraControl::SetParameter(uint32_t aKey, const char* aValue)
|
2012-07-30 14:59:05 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-22 08:56:38 -07:00
|
|
|
nsFallbackCameraControl::SetParameter(uint32_t aKey, double aValue)
|
2012-07-30 14:59:05 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-02-11 11:37:50 -08:00
|
|
|
nsFallbackCameraControl::SetParameter(uint32_t aKey, const nsTArray<idl::CameraRegion>& aRegions)
|
2012-07-30 14:59:05 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-09-04 18:01:56 -07:00
|
|
|
nsresult
|
2012-07-30 14:59:05 -07:00
|
|
|
nsFallbackCameraControl::PushParameters()
|
|
|
|
{
|
2012-09-04 18:01:56 -07:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2012-07-30 14:59:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsFallbackCameraControl::GetPreviewStreamImpl(GetPreviewStreamTask* aGetPreviewStream)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2012-09-04 18:01:56 -07:00
|
|
|
nsresult
|
|
|
|
nsFallbackCameraControl::StartPreviewImpl(StartPreviewTask* aGetPreviewStream)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsFallbackCameraControl::StopPreviewImpl(StopPreviewTask* aGetPreviewStream)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2012-07-30 14:59:05 -07: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-04 18:01:56 -07:00
|
|
|
nsFallbackCameraControl::PushParametersImpl()
|
2012-07-30 14:59:05 -07:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2012-09-04 18:01:56 -07:00
|
|
|
nsFallbackCameraControl::PullParametersImpl()
|
2012-07-30 14:59:05 -07:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
2012-10-23 15:30:28 -07:00
|
|
|
|
|
|
|
nsresult
|
2013-02-11 11:37:50 -08:00
|
|
|
nsFallbackCameraControl::GetVideoSizes(nsTArray<idl::CameraSize>& aVideoSizes)
|
2012-10-23 15:30:28 -07:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<RecorderProfileManager>
|
|
|
|
nsFallbackCameraControl::GetRecorderProfileManagerImpl()
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|