mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 899210 - convert camera control to WebIDL r=bz
This commit is contained in:
parent
dace19ab2b
commit
6d4bc4993b
@ -612,7 +612,7 @@ MediaEngineWebRTCVideoSource::AllocImpl() {
|
|||||||
mCameraThread,
|
mCameraThread,
|
||||||
this,
|
this,
|
||||||
this,
|
this,
|
||||||
mWindowId);
|
nsGlobalWindow::GetInnerWindowWithId(mWindowId));
|
||||||
mCameraManager->Register(mDOMCameraControl);
|
mCameraManager->Register(mDOMCameraControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -662,7 +662,7 @@ MediaEngineWebRTCVideoSource::SnapshotImpl() {
|
|||||||
|
|
||||||
// nsICameraGetCameraCallback
|
// nsICameraGetCameraCallback
|
||||||
nsresult
|
nsresult
|
||||||
MediaEngineWebRTCVideoSource::HandleEvent(nsICameraControl* camera) {
|
MediaEngineWebRTCVideoSource::HandleEvent(nsISupports* /* unused */) {
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
|
ReentrantMonitorAutoEnter sync(mCallbackMonitor);
|
||||||
mNativeCameraControl = static_cast<nsGonkCameraControl*>(mDOMCameraControl->GetNativeCameraControl().get());
|
mNativeCameraControl = static_cast<nsGonkCameraControl*>(mDOMCameraControl->GetNativeCameraControl().get());
|
||||||
|
@ -554,8 +554,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||||||
EVENTTARGET_SCRIPTABLE_FLAGS)
|
EVENTTARGET_SCRIPTABLE_FLAGS)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_DEFINE_CLASSINFO_DATA(CameraControl, nsDOMGenericSH,
|
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
|
||||||
NS_DEFINE_CLASSINFO_DATA(CameraCapabilities, nsDOMGenericSH,
|
NS_DEFINE_CLASSINFO_DATA(CameraCapabilities, nsDOMGenericSH,
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||||
|
|
||||||
@ -1432,10 +1430,6 @@ nsDOMClassInfo::Init()
|
|||||||
DOM_CLASSINFO_MAP_END
|
DOM_CLASSINFO_MAP_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(CameraControl, nsICameraControl)
|
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsICameraControl)
|
|
||||||
DOM_CLASSINFO_MAP_END
|
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(CameraCapabilities, nsICameraCapabilities)
|
DOM_CLASSINFO_MAP_BEGIN(CameraCapabilities, nsICameraCapabilities)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsICameraCapabilities)
|
DOM_CLASSINFO_MAP_ENTRY(nsICameraCapabilities)
|
||||||
DOM_CLASSINFO_MAP_END
|
DOM_CLASSINFO_MAP_END
|
||||||
|
@ -140,7 +140,6 @@ DOMCI_CLASS(FMRadio)
|
|||||||
DOMCI_CLASS(BluetoothDevice)
|
DOMCI_CLASS(BluetoothDevice)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DOMCI_CLASS(CameraControl)
|
|
||||||
DOMCI_CLASS(CameraCapabilities)
|
DOMCI_CLASS(CameraCapabilities)
|
||||||
|
|
||||||
DOMCI_CLASS(LockedFile)
|
DOMCI_CLASS(LockedFile)
|
||||||
|
@ -176,6 +176,14 @@ DOMInterfaces = {
|
|||||||
'headerFile': 'CallsList.h',
|
'headerFile': 'CallsList.h',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'CameraControl': {
|
||||||
|
'nativeType': 'mozilla::nsDOMCameraControl',
|
||||||
|
'headerFile': 'DOMCameraControl.h',
|
||||||
|
'binaryNames': {
|
||||||
|
"release": "ReleaseHardware"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
'CameraManager': {
|
'CameraManager': {
|
||||||
'nativeType': 'nsDOMCameraManager',
|
'nativeType': 'nsDOMCameraManager',
|
||||||
'headerFile': 'DOMCameraManager.h'
|
'headerFile': 'DOMCameraManager.h'
|
||||||
@ -1815,3 +1823,13 @@ addExternalIface('XULCommandDispatcher')
|
|||||||
addExternalIface('DataTransfer', notflattened=True)
|
addExternalIface('DataTransfer', notflattened=True)
|
||||||
addExternalIface('GetCameraCallback', nativeType='nsICameraGetCameraCallback', headerFile='nsIDOMCameraManager.h')
|
addExternalIface('GetCameraCallback', nativeType='nsICameraGetCameraCallback', headerFile='nsIDOMCameraManager.h')
|
||||||
addExternalIface('CameraErrorCallback', nativeType='nsICameraErrorCallback', headerFile='nsIDOMCameraManager.h')
|
addExternalIface('CameraErrorCallback', nativeType='nsICameraErrorCallback', headerFile='nsIDOMCameraManager.h')
|
||||||
|
addExternalIface('CameraCapabilities', nativeType='nsICameraCapabilities', headerFile='nsIDOMCameraManager.h')
|
||||||
|
addExternalIface('CameraAutoFocusCallback', nativeType='nsICameraAutoFocusCallback', headerFile='nsIDOMCameraManager.h')
|
||||||
|
addExternalIface('CameraShutterCallback', nativeType='nsICameraShutterCallback', headerFile='nsIDOMCameraManager.h')
|
||||||
|
addExternalIface('CameraClosedCallback', nativeType='nsICameraClosedCallback', headerFile='nsIDOMCameraManager.h')
|
||||||
|
addExternalIface('CameraTakePictureCallback', nativeType='nsICameraTakePictureCallback', headerFile='nsIDOMCameraManager.h')
|
||||||
|
addExternalIface('CameraReleaseCallback', nativeType='nsICameraReleaseCallback', headerFile='nsIDOMCameraManager.h')
|
||||||
|
addExternalIface('CameraStartRecordingCallback', nativeType='nsICameraStartRecordingCallback', headerFile='nsIDOMCameraManager.h')
|
||||||
|
addExternalIface('CameraPreviewStateChange', nativeType='nsICameraPreviewStateChange', headerFile='nsIDOMCameraManager.h')
|
||||||
|
addExternalIface('CameraPreviewStreamCallback', nativeType='nsICameraPreviewStreamCallback', headerFile='nsIDOMCameraManager.h')
|
||||||
|
addExternalIface('CameraRecorderStateChange', nativeType='nsICameraRecorderStateChange', headerFile='nsIDOMCameraManager.h')
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "nsDOMClassInfo.h"
|
#include "nsDOMClassInfo.h"
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "nsThread.h"
|
#include "nsThread.h"
|
||||||
|
#include "DeviceStorage.h"
|
||||||
|
#include "mozilla/dom/CameraControlBinding.h"
|
||||||
#include "mozilla/dom/ContentChild.h"
|
#include "mozilla/dom/ContentChild.h"
|
||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
#include "mozilla/unused.h"
|
#include "mozilla/unused.h"
|
||||||
@ -23,15 +25,11 @@
|
|||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
DOMCI_DATA(CameraControl, nsICameraControl)
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(nsDOMCameraControl, mDOMCapabilities, mWindow)
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_1(nsDOMCameraControl,
|
|
||||||
mDOMCapabilities)
|
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCameraControl)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCameraControl)
|
||||||
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsICameraControl)
|
|
||||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CameraControl)
|
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCameraControl)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCameraControl)
|
||||||
@ -42,235 +40,242 @@ nsDOMCameraControl::~nsDOMCameraControl()
|
|||||||
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
|
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute nsICameraCapabilities capabilities; */
|
JSObject*
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||||
nsDOMCameraControl::GetCapabilities(nsICameraCapabilities** aCapabilities)
|
{
|
||||||
|
return CameraControlBinding::Wrap(aCx, aScope, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsICameraCapabilities*
|
||||||
|
nsDOMCameraControl::Capabilities()
|
||||||
{
|
{
|
||||||
if (!mDOMCapabilities) {
|
if (!mDOMCapabilities) {
|
||||||
mDOMCapabilities = new DOMCameraCapabilities(mCameraControl);
|
mDOMCapabilities = new DOMCameraCapabilities(mCameraControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsICameraCapabilities> capabilities = mDOMCapabilities;
|
return mDOMCapabilities;
|
||||||
capabilities.forget(aCapabilities);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute DOMString effect; */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetEffect(nsString& aEffect, ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetEffect(nsAString& aEffect)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_EFFECT, aEffect);
|
aRv = mCameraControl->Get(CAMERA_PARAM_EFFECT, aEffect);
|
||||||
}
|
}
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsDOMCameraControl::SetEffect(const nsAString& aEffect)
|
nsDOMCameraControl::SetEffect(const nsAString& aEffect, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->Set(CAMERA_PARAM_EFFECT, aEffect);
|
aRv = mCameraControl->Set(CAMERA_PARAM_EFFECT, aEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute DOMString whiteBalanceMode; */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetWhiteBalanceMode(nsString& aWhiteBalanceMode, ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetWhiteBalanceMode(nsAString& aWhiteBalanceMode)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_WHITEBALANCE, aWhiteBalanceMode);
|
aRv = mCameraControl->Get(CAMERA_PARAM_WHITEBALANCE, aWhiteBalanceMode);
|
||||||
}
|
}
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsDOMCameraControl::SetWhiteBalanceMode(const nsAString& aWhiteBalanceMode)
|
nsDOMCameraControl::SetWhiteBalanceMode(const nsAString& aWhiteBalanceMode, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->Set(CAMERA_PARAM_WHITEBALANCE, aWhiteBalanceMode);
|
aRv = mCameraControl->Set(CAMERA_PARAM_WHITEBALANCE, aWhiteBalanceMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute DOMString sceneMode; */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetSceneMode(nsString& aSceneMode, ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetSceneMode(nsAString& aSceneMode)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_SCENEMODE, aSceneMode);
|
aRv = mCameraControl->Get(CAMERA_PARAM_SCENEMODE, aSceneMode);
|
||||||
}
|
}
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsDOMCameraControl::SetSceneMode(const nsAString& aSceneMode)
|
nsDOMCameraControl::SetSceneMode(const nsAString& aSceneMode, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->Set(CAMERA_PARAM_SCENEMODE, aSceneMode);
|
aRv = mCameraControl->Set(CAMERA_PARAM_SCENEMODE, aSceneMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute DOMString flashMode; */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetFlashMode(nsString& aFlashMode, ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetFlashMode(nsAString& aFlashMode)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_FLASHMODE, aFlashMode);
|
aRv = mCameraControl->Get(CAMERA_PARAM_FLASHMODE, aFlashMode);
|
||||||
}
|
}
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsDOMCameraControl::SetFlashMode(const nsAString& aFlashMode)
|
nsDOMCameraControl::SetFlashMode(const nsAString& aFlashMode, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->Set(CAMERA_PARAM_FLASHMODE, aFlashMode);
|
aRv = mCameraControl->Set(CAMERA_PARAM_FLASHMODE, aFlashMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute DOMString focusMode; */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetFocusMode(nsString& aFocusMode, ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetFocusMode(nsAString& aFocusMode)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_FOCUSMODE, aFocusMode);
|
aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSMODE, aFocusMode);
|
||||||
}
|
}
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsDOMCameraControl::SetFocusMode(const nsAString& aFocusMode)
|
nsDOMCameraControl::SetFocusMode(const nsAString& aFocusMode, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->Set(CAMERA_PARAM_FOCUSMODE, aFocusMode);
|
aRv = mCameraControl->Set(CAMERA_PARAM_FOCUSMODE, aFocusMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute double zoom; */
|
double
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetZoom(ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetZoom(double* aZoom)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_ZOOM, aZoom);
|
double zoom;
|
||||||
|
aRv = mCameraControl->Get(CAMERA_PARAM_ZOOM, &zoom);
|
||||||
|
return zoom;
|
||||||
}
|
}
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMCameraControl::SetZoom(double aZoom)
|
void
|
||||||
|
nsDOMCameraControl::SetZoom(double aZoom, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->Set(CAMERA_PARAM_ZOOM, aZoom);
|
aRv = mCameraControl->Set(CAMERA_PARAM_ZOOM, aZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute jsval meteringAreas; */
|
/* attribute jsval meteringAreas; */
|
||||||
NS_IMETHODIMP
|
JS::Value
|
||||||
nsDOMCameraControl::GetMeteringAreas(JSContext* cx, JS::Value* aMeteringAreas)
|
nsDOMCameraControl::GetMeteringAreas(JSContext* cx, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(cx, CAMERA_PARAM_METERINGAREAS, aMeteringAreas);
|
JS::Rooted<JS::Value> areas(cx);
|
||||||
}
|
aRv = mCameraControl->Get(cx, CAMERA_PARAM_METERINGAREAS, areas.address());
|
||||||
NS_IMETHODIMP
|
return areas;
|
||||||
nsDOMCameraControl::SetMeteringAreas(JSContext* cx, const JS::Value& aMeteringAreas)
|
|
||||||
{
|
|
||||||
return mCameraControl->SetMeteringAreas(cx, aMeteringAreas);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute jsval focusAreas; */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::SetMeteringAreas(JSContext* cx, JS::Handle<JS::Value> aMeteringAreas, ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetFocusAreas(JSContext* cx, JS::Value* aFocusAreas)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(cx, CAMERA_PARAM_FOCUSAREAS, aFocusAreas);
|
aRv = mCameraControl->SetMeteringAreas(cx, aMeteringAreas);
|
||||||
}
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMCameraControl::SetFocusAreas(JSContext* cx, const JS::Value& aFocusAreas)
|
|
||||||
{
|
|
||||||
return mCameraControl->SetFocusAreas(cx, aFocusAreas);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute double focalLength; */
|
JS::Value
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetFocusAreas(JSContext* cx, ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetFocalLength(double* aFocalLength)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_FOCALLENGTH, aFocalLength);
|
JS::Rooted<JS::Value> value(cx);
|
||||||
|
aRv = mCameraControl->Get(cx, CAMERA_PARAM_FOCUSAREAS, value.address());
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
void
|
||||||
|
nsDOMCameraControl::SetFocusAreas(JSContext* cx, JS::Handle<JS::Value> aFocusAreas, ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
aRv = mCameraControl->SetFocusAreas(cx, aFocusAreas);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute double focusDistanceNear; */
|
double
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetFocalLength(ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetFocusDistanceNear(double* aFocusDistanceNear)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCENEAR, aFocusDistanceNear);
|
double focalLength;
|
||||||
|
aRv = mCameraControl->Get(CAMERA_PARAM_FOCALLENGTH, &focalLength);
|
||||||
|
return focalLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute double focusDistanceOptimum; */
|
double
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetFocusDistanceNear(ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetFocusDistanceOptimum(double* aFocusDistanceOptimum)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCEOPTIMUM, aFocusDistanceOptimum);
|
double distance;
|
||||||
|
aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCENEAR, &distance);
|
||||||
|
return distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute double focusDistanceFar; */
|
double
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetFocusDistanceOptimum(ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetFocusDistanceFar(double* aFocusDistanceFar)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCEFAR, aFocusDistanceFar);
|
double distance;
|
||||||
|
aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCEOPTIMUM, &distance);
|
||||||
|
return distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void setExposureCompensation (const JS::Value& aCompensation, JSContext* cx); */
|
double
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetFocusDistanceFar(ErrorResult& aRv)
|
||||||
nsDOMCameraControl::SetExposureCompensation(const JS::Value& aCompensation, JSContext* cx)
|
|
||||||
{
|
{
|
||||||
if (aCompensation.isNullOrUndefined()) {
|
double distance;
|
||||||
|
aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCEFAR, &distance);
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDOMCameraControl::SetExposureCompensation(const Optional<double>& aCompensation, ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
if (!aCompensation.WasPassed()) {
|
||||||
// use NaN to switch the camera back into auto mode
|
// use NaN to switch the camera back into auto mode
|
||||||
return mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, NAN);
|
aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, NAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, aCompensation.Value());
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
nsDOMCameraControl::GetExposureCompensation(ErrorResult& aRv)
|
||||||
|
{
|
||||||
double compensation;
|
double compensation;
|
||||||
if (!JS_ValueToNumber(cx, aCompensation, &compensation)) {
|
aRv = mCameraControl->Get(CAMERA_PARAM_EXPOSURECOMPENSATION, &compensation);
|
||||||
return NS_ERROR_INVALID_ARG;
|
return compensation;
|
||||||
}
|
|
||||||
|
|
||||||
return mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, compensation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute double exposureCompensation; */
|
already_AddRefed<nsICameraShutterCallback>
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetOnShutter(ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetExposureCompensation(double* aExposureCompensation)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(CAMERA_PARAM_EXPOSURECOMPENSATION, aExposureCompensation);
|
nsCOMPtr<nsICameraShutterCallback> cb;
|
||||||
|
aRv = mCameraControl->Get(getter_AddRefs(cb));
|
||||||
|
return cb.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute nsICameraShutterCallback onShutter; */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::SetOnShutter(nsICameraShutterCallback* aOnShutter,
|
||||||
nsDOMCameraControl::GetOnShutter(nsICameraShutterCallback** aOnShutter)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(aOnShutter);
|
aRv = mCameraControl->Set(aOnShutter);
|
||||||
}
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMCameraControl::SetOnShutter(nsICameraShutterCallback* aOnShutter)
|
|
||||||
{
|
|
||||||
return mCameraControl->Set(aOnShutter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute nsICameraClosedCallback onClosed; */
|
/* attribute nsICameraClosedCallback onClosed; */
|
||||||
NS_IMETHODIMP
|
already_AddRefed<nsICameraClosedCallback>
|
||||||
nsDOMCameraControl::GetOnClosed(nsICameraClosedCallback** aOnClosed)
|
nsDOMCameraControl::GetOnClosed(ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(aOnClosed);
|
nsCOMPtr<nsICameraClosedCallback> onClosed;
|
||||||
}
|
aRv = mCameraControl->Get(getter_AddRefs(onClosed));
|
||||||
NS_IMETHODIMP
|
return onClosed.forget();
|
||||||
nsDOMCameraControl::SetOnClosed(nsICameraClosedCallback* aOnClosed)
|
|
||||||
{
|
|
||||||
return mCameraControl->Set(aOnClosed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute nsICameraRecorderStateChange onRecorderStateChange; */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::SetOnClosed(nsICameraClosedCallback* aOnClosed,
|
||||||
nsDOMCameraControl::GetOnRecorderStateChange(nsICameraRecorderStateChange** aOnRecorderStateChange)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(aOnRecorderStateChange);
|
aRv = mCameraControl->Set(aOnClosed);
|
||||||
}
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMCameraControl::SetOnRecorderStateChange(nsICameraRecorderStateChange* aOnRecorderStateChange)
|
|
||||||
{
|
|
||||||
return mCameraControl->Set(aOnRecorderStateChange);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* attribute nsICameraPreviewStateChange onPreviewStateChange; */
|
already_AddRefed<nsICameraRecorderStateChange>
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetOnRecorderStateChange(ErrorResult& aRv)
|
||||||
nsDOMCameraControl::GetOnPreviewStateChange(nsICameraPreviewStateChange** aOnPreviewStateChange)
|
|
||||||
{
|
{
|
||||||
return mCameraControl->Get(aOnPreviewStateChange);
|
nsCOMPtr<nsICameraRecorderStateChange> cb;
|
||||||
}
|
aRv = mCameraControl->Get(getter_AddRefs(cb));
|
||||||
NS_IMETHODIMP
|
return cb.forget();
|
||||||
nsDOMCameraControl::SetOnPreviewStateChange(nsICameraPreviewStateChange* aOnPreviewStateChange)
|
|
||||||
{
|
|
||||||
return mCameraControl->Set(aOnPreviewStateChange);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [implicit_jscontext] void startRecording (in jsval aOptions, in nsIDOMDeviceStorage storageArea, in DOMString filename, in nsICameraStartRecordingCallback onSuccess, [optional] in nsICameraErrorCallback onError); */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::SetOnRecorderStateChange(nsICameraRecorderStateChange* aOnRecorderStateChange,
|
||||||
nsDOMCameraControl::StartRecording(const JS::Value& aOptions, nsIDOMDeviceStorage* storageArea, const nsAString& filename, nsICameraStartRecordingCallback* onSuccess, nsICameraErrorCallback* onError, JSContext* cx)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(onSuccess, NS_ERROR_INVALID_ARG);
|
aRv = mCameraControl->Set(aOnRecorderStateChange);
|
||||||
NS_ENSURE_TRUE(storageArea, NS_ERROR_INVALID_ARG);
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDOMCameraControl::StartRecording(JSContext* aCx,
|
||||||
|
JS::Handle<JS::Value> aOptions,
|
||||||
|
nsDOMDeviceStorage& storageArea,
|
||||||
|
const nsAString& filename,
|
||||||
|
nsICameraStartRecordingCallback* onSuccess,
|
||||||
|
const Optional<nsICameraErrorCallback*>& onError,
|
||||||
|
ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(onSuccess, "no onSuccess handler passed");
|
||||||
mozilla::idl::CameraStartRecordingOptions options;
|
mozilla::idl::CameraStartRecordingOptions options;
|
||||||
|
|
||||||
// Default values, until the dictionary parser can handle them.
|
// Default values, until the dictionary parser can handle them.
|
||||||
options.rotation = 0;
|
options.rotation = 0;
|
||||||
options.maxFileSizeBytes = 0;
|
options.maxFileSizeBytes = 0;
|
||||||
options.maxVideoLengthMs = 0;
|
options.maxVideoLengthMs = 0;
|
||||||
nsresult rv = options.Init(cx, &aOptions);
|
aRv = options.Init(aCx, aOptions.address());
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (aRv.Failed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||||
if (!obs) {
|
if (!obs) {
|
||||||
NS_WARNING("Could not get the Observer service for CameraControl::StartRecording.");
|
NS_WARNING("Could not get the Observer service for CameraControl::StartRecording.");
|
||||||
return NS_ERROR_FAILURE;
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
obs->NotifyObservers(nullptr,
|
obs->NotifyObservers(nullptr,
|
||||||
@ -296,19 +301,21 @@ nsDOMCameraControl::StartRecording(const JS::Value& aOptions, nsIDOMDeviceStorag
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> folder;
|
nsCOMPtr<nsIFile> folder;
|
||||||
rv = storageArea->GetRootDirectoryForFile(filename, getter_AddRefs(folder));
|
aRv = storageArea.GetRootDirectoryForFile(filename, getter_AddRefs(folder));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (aRv.Failed()) {
|
||||||
return mCameraControl->StartRecording(&options, folder, filename, onSuccess, onError);
|
return;
|
||||||
|
}
|
||||||
|
aRv = mCameraControl->StartRecording(&options, folder, filename, onSuccess,
|
||||||
|
onError.WasPassed() ? onError.Value() : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void stopRecording (); */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::StopRecording(ErrorResult& aRv)
|
||||||
nsDOMCameraControl::StopRecording()
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||||
if (!obs) {
|
if (!obs) {
|
||||||
NS_WARNING("Could not get the Observer service for CameraControl::StopRecording.");
|
NS_WARNING("Could not get the Observer service for CameraControl::StopRecording.");
|
||||||
return NS_ERROR_FAILURE;
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
obs->NotifyObservers(nullptr,
|
obs->NotifyObservers(nullptr,
|
||||||
@ -327,55 +334,71 @@ nsDOMCameraControl::StopRecording()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return mCameraControl->StopRecording();
|
aRv = mCameraControl->StopRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [implicit_jscontext] void getPreviewStream (in jsval aOptions, in nsICameraPreviewStreamCallback onSuccess, [optional] in nsICameraErrorCallback onError); */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetPreviewStream(JSContext* aCx,
|
||||||
nsDOMCameraControl::GetPreviewStream(const JS::Value& aOptions, nsICameraPreviewStreamCallback* onSuccess, nsICameraErrorCallback* onError, JSContext* cx)
|
JS::Handle<JS::Value> aOptions,
|
||||||
|
nsICameraPreviewStreamCallback* onSuccess,
|
||||||
|
const Optional<nsICameraErrorCallback*>& onError,
|
||||||
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(onSuccess, NS_ERROR_INVALID_ARG);
|
|
||||||
|
|
||||||
mozilla::idl::CameraSize size;
|
mozilla::idl::CameraSize size;
|
||||||
nsresult rv = size.Init(cx, &aOptions);
|
aRv = size.Init(aCx, aOptions.address());
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (aRv.Failed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return mCameraControl->GetPreviewStream(size, onSuccess, onError);
|
aRv = mCameraControl->GetPreviewStream(size, onSuccess,
|
||||||
|
onError.WasPassed()
|
||||||
|
? onError.Value() : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void resumePreview(); */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::ResumePreview(ErrorResult& aRv)
|
||||||
nsDOMCameraControl::ResumePreview()
|
|
||||||
{
|
{
|
||||||
return mCameraControl->StartPreview(nullptr);
|
aRv = mCameraControl->StartPreview(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void autoFocus (in nsICameraAutoFocusCallback onSuccess, [optional] in nsICameraErrorCallback onError); */
|
already_AddRefed<nsICameraPreviewStateChange>
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetOnPreviewStateChange() const
|
||||||
nsDOMCameraControl::AutoFocus(nsICameraAutoFocusCallback* onSuccess, nsICameraErrorCallback* onError)
|
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(onSuccess, NS_ERROR_INVALID_ARG);
|
nsCOMPtr<nsICameraPreviewStateChange> cb;
|
||||||
return mCameraControl->AutoFocus(onSuccess, onError);
|
mCameraControl->Get(getter_AddRefs(cb));
|
||||||
|
return cb.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void takePicture (in jsval aOptions, in nsICameraTakePictureCallback onSuccess, [optional] in nsICameraErrorCallback onError); */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::SetOnPreviewStateChange(nsICameraPreviewStateChange* aCb)
|
||||||
nsDOMCameraControl::TakePicture(const JS::Value& aOptions, nsICameraTakePictureCallback* onSuccess, nsICameraErrorCallback* onError, JSContext* cx)
|
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(onSuccess, NS_ERROR_INVALID_ARG);
|
mCameraControl->Set(aCb);
|
||||||
|
}
|
||||||
|
|
||||||
RootedDictionary<CameraPictureOptions> options(cx);
|
void
|
||||||
|
nsDOMCameraControl::AutoFocus(nsICameraAutoFocusCallback* onSuccess,
|
||||||
|
const Optional<nsICameraErrorCallback*>& onError,
|
||||||
|
ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
aRv = mCameraControl->AutoFocus(onSuccess,
|
||||||
|
onError.WasPassed() ? onError.Value() : nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDOMCameraControl::TakePicture(JSContext* aCx,
|
||||||
|
const CameraPictureOptions& aOptions,
|
||||||
|
nsICameraTakePictureCallback* onSuccess,
|
||||||
|
const Optional<nsICameraErrorCallback*>& aOnError,
|
||||||
|
ErrorResult& aRv)
|
||||||
|
{
|
||||||
mozilla::idl::CameraSize size;
|
mozilla::idl::CameraSize size;
|
||||||
mozilla::idl::CameraPosition pos;
|
mozilla::idl::CameraPosition pos;
|
||||||
|
|
||||||
JS::Rooted<JS::Value> optionVal(cx, aOptions);
|
aRv = size.Init(aCx, &aOptions.mPictureSize);
|
||||||
if (!options.Init(cx, optionVal)) {
|
if (aRv.Failed()) {
|
||||||
return NS_ERROR_FAILURE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = size.Init(cx, &options.mPictureSize);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default values, until the dictionary parser can handle them.
|
* Default values, until the dictionary parser can handle them.
|
||||||
* NaN indicates no value provided.
|
* NaN indicates no value provided.
|
||||||
@ -384,29 +407,45 @@ nsDOMCameraControl::TakePicture(const JS::Value& aOptions, nsICameraTakePictureC
|
|||||||
pos.longitude = NAN;
|
pos.longitude = NAN;
|
||||||
pos.altitude = NAN;
|
pos.altitude = NAN;
|
||||||
pos.timestamp = NAN;
|
pos.timestamp = NAN;
|
||||||
rv = pos.Init(cx, &options.mPosition);
|
aRv = pos.Init(aCx, &aOptions.mPosition);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (aRv.Failed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return mCameraControl->TakePicture(size, options.mRotation, options.mFileFormat, pos, options.mDateTime, onSuccess, onError);
|
nsICameraErrorCallback* onError =
|
||||||
|
aOnError.WasPassed() ? aOnError.Value() : nullptr;
|
||||||
|
aRv = mCameraControl->TakePicture(size, aOptions.mRotation,
|
||||||
|
aOptions.mFileFormat, pos,
|
||||||
|
aOptions.mDateTime, onSuccess, onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* [implicit_jscontext] void GetPreviewStreamVideoMode (in jsval aOptions, in nsICameraPreviewStreamCallback onSuccess, [optional] in nsICameraErrorCallback onError); */
|
void
|
||||||
NS_IMETHODIMP
|
nsDOMCameraControl::GetPreviewStreamVideoMode(JSContext* aCx,
|
||||||
nsDOMCameraControl::GetPreviewStreamVideoMode(const JS::Value& aOptions, nsICameraPreviewStreamCallback* onSuccess, nsICameraErrorCallback* onError, JSContext* cx)
|
JS::Handle<JS::Value> aOptions,
|
||||||
|
nsICameraPreviewStreamCallback* onSuccess,
|
||||||
|
const Optional<nsICameraErrorCallback*>& onError,
|
||||||
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(onSuccess, NS_ERROR_INVALID_ARG);
|
|
||||||
|
|
||||||
mozilla::idl::CameraRecorderOptions options;
|
mozilla::idl::CameraRecorderOptions options;
|
||||||
nsresult rv = options.Init(cx, &aOptions);
|
aRv = options.Init(aCx, aOptions.address());
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (aRv.Failed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return mCameraControl->GetPreviewStreamVideoMode(&options, onSuccess, onError);
|
aRv = mCameraControl->GetPreviewStreamVideoMode(&options, onSuccess,
|
||||||
|
onError.WasPassed()
|
||||||
|
? onError.Value() : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsDOMCameraControl::ReleaseHardware(nsICameraReleaseCallback* onSuccess, nsICameraErrorCallback* onError)
|
nsDOMCameraControl::ReleaseHardware(const Optional<nsICameraReleaseCallback*>& onSuccess,
|
||||||
|
const Optional<nsICameraErrorCallback*>& onError,
|
||||||
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
return mCameraControl->ReleaseHardware(onSuccess, onError);
|
aRv =
|
||||||
|
mCameraControl->ReleaseHardware(
|
||||||
|
onSuccess.WasPassed() ? onSuccess.Value() : nullptr,
|
||||||
|
onError.WasPassed() ? onError.Value() : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetCameraResult : public nsRunnable
|
class GetCameraResult : public nsRunnable
|
||||||
|
@ -16,19 +16,27 @@
|
|||||||
#include "AudioChannelAgent.h"
|
#include "AudioChannelAgent.h"
|
||||||
#include "nsProxyRelease.h"
|
#include "nsProxyRelease.h"
|
||||||
|
|
||||||
|
class nsDOMDeviceStorage;
|
||||||
|
class nsPIDOMWindow;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
class CameraPictureOptions;
|
||||||
|
template<typename T> class Optional;
|
||||||
|
}
|
||||||
|
class ErrorResult;
|
||||||
|
|
||||||
// Main camera control.
|
// Main camera control.
|
||||||
class nsDOMCameraControl : public nsICameraControl
|
class nsDOMCameraControl MOZ_FINAL : public nsISupports,
|
||||||
|
public nsWrapperCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMCameraControl)
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMCameraControl)
|
||||||
NS_DECL_NSICAMERACONTROL
|
|
||||||
|
|
||||||
nsDOMCameraControl(uint32_t aCameraId, nsIThread* aCameraThread,
|
nsDOMCameraControl(uint32_t aCameraId, nsIThread* aCameraThread,
|
||||||
nsICameraGetCameraCallback* onSuccess,
|
nsICameraGetCameraCallback* onSuccess,
|
||||||
nsICameraErrorCallback* onError, uint64_t aWindowId);
|
nsICameraErrorCallback* onError, nsPIDOMWindow* aWindow);
|
||||||
nsresult Result(nsresult aResult,
|
nsresult Result(nsresult aResult,
|
||||||
const nsMainThreadPtrHandle<nsICameraGetCameraCallback>& onSuccess,
|
const nsMainThreadPtrHandle<nsICameraGetCameraCallback>& onSuccess,
|
||||||
const nsMainThreadPtrHandle<nsICameraErrorCallback>& onError,
|
const nsMainThreadPtrHandle<nsICameraErrorCallback>& onError,
|
||||||
@ -37,6 +45,52 @@ public:
|
|||||||
|
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
|
nsPIDOMWindow* GetParentObject() const { return mWindow; }
|
||||||
|
|
||||||
|
// WebIDL
|
||||||
|
nsICameraCapabilities* Capabilities();
|
||||||
|
void GetEffect(nsString& aEffect, ErrorResult& aRv);
|
||||||
|
void SetEffect(const nsAString& aEffect, ErrorResult& aRv);
|
||||||
|
void GetWhiteBalanceMode(nsString& aMode, ErrorResult& aRv);
|
||||||
|
void SetWhiteBalanceMode(const nsAString& aMode, ErrorResult& aRv);
|
||||||
|
void GetSceneMode(nsString& aMode, ErrorResult& aRv);
|
||||||
|
void SetSceneMode(const nsAString& aMode, ErrorResult& aRv);
|
||||||
|
void GetFlashMode(nsString& aMode, ErrorResult& aRv);
|
||||||
|
void SetFlashMode(const nsAString& aMode, ErrorResult& aRv);
|
||||||
|
void GetFocusMode(nsString& aMode, ErrorResult& aRv);
|
||||||
|
void SetFocusMode(const nsAString& aMode, ErrorResult& aRv);
|
||||||
|
double GetZoom(ErrorResult& aRv);
|
||||||
|
void SetZoom(double aZoom, ErrorResult& aRv);
|
||||||
|
JS::Value GetMeteringAreas(JSContext* aCx, ErrorResult& aRv);
|
||||||
|
void SetMeteringAreas(JSContext* aCx, JS::Handle<JS::Value> aAreas, ErrorResult& aRv);
|
||||||
|
JS::Value GetFocusAreas(JSContext* aCx, ErrorResult& aRv);
|
||||||
|
void SetFocusAreas(JSContext* aCx, JS::Handle<JS::Value> aAreas, ErrorResult& aRv);
|
||||||
|
double GetFocalLength(ErrorResult& aRv);
|
||||||
|
double GetFocusDistanceNear(ErrorResult& aRv);
|
||||||
|
double GetFocusDistanceOptimum(ErrorResult& aRv);
|
||||||
|
double GetFocusDistanceFar(ErrorResult& aRv);
|
||||||
|
void SetExposureCompensation(const dom::Optional<double>& aCompensation, ErrorResult& aRv);
|
||||||
|
double GetExposureCompensation(ErrorResult& aRv);
|
||||||
|
already_AddRefed<nsICameraShutterCallback> GetOnShutter(ErrorResult& aRv);
|
||||||
|
void SetOnShutter(nsICameraShutterCallback* aCb, ErrorResult& aRv);
|
||||||
|
already_AddRefed<nsICameraClosedCallback> GetOnClosed(ErrorResult& aRv);
|
||||||
|
void SetOnClosed(nsICameraClosedCallback* aCb, ErrorResult& aRv);
|
||||||
|
already_AddRefed<nsICameraRecorderStateChange> GetOnRecorderStateChange(ErrorResult& aRv);
|
||||||
|
void SetOnRecorderStateChange(nsICameraRecorderStateChange* aCb, ErrorResult& aRv);
|
||||||
|
void AutoFocus(nsICameraAutoFocusCallback* aOnSuccess, const dom::Optional<nsICameraErrorCallback*>& aOnErro, ErrorResult& aRvr);
|
||||||
|
void TakePicture(JSContext* aCx, const dom::CameraPictureOptions& aOptions,
|
||||||
|
nsICameraTakePictureCallback* onSuccess,
|
||||||
|
const dom::Optional<nsICameraErrorCallback* >& onError,
|
||||||
|
ErrorResult& aRv);
|
||||||
|
already_AddRefed<nsICameraPreviewStateChange> GetOnPreviewStateChange() const;
|
||||||
|
void SetOnPreviewStateChange(nsICameraPreviewStateChange* aOnStateChange);
|
||||||
|
void GetPreviewStreamVideoMode(JSContext* cx, JS::Handle<JS::Value> aOptions, nsICameraPreviewStreamCallback* onSuccess, const dom::Optional<nsICameraErrorCallback* >& onError, ErrorResult& aRv);
|
||||||
|
void StartRecording(JSContext* cx, JS::Handle<JS::Value> aOptions, nsDOMDeviceStorage& storageArea, const nsAString& filename, nsICameraStartRecordingCallback* onSuccess, const dom::Optional<nsICameraErrorCallback* >& onError, ErrorResult& aRv);
|
||||||
|
void StopRecording(ErrorResult& aRv);
|
||||||
|
void GetPreviewStream(JSContext* cx, JS::Handle<JS::Value> aOptions, nsICameraPreviewStreamCallback* onSuccess, const dom::Optional<nsICameraErrorCallback* >& onError, ErrorResult& aRv);
|
||||||
|
void ResumePreview(ErrorResult& aRv);
|
||||||
|
void ReleaseHardware(const dom::Optional<nsICameraReleaseCallback* >& onSuccess, const dom::Optional<nsICameraErrorCallback* >& onError, ErrorResult& aRv);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsDOMCameraControl();
|
virtual ~nsDOMCameraControl();
|
||||||
|
|
||||||
@ -44,12 +98,15 @@ private:
|
|||||||
nsDOMCameraControl(const nsDOMCameraControl&) MOZ_DELETE;
|
nsDOMCameraControl(const nsDOMCameraControl&) MOZ_DELETE;
|
||||||
nsDOMCameraControl& operator=(const nsDOMCameraControl&) MOZ_DELETE;
|
nsDOMCameraControl& operator=(const nsDOMCameraControl&) MOZ_DELETE;
|
||||||
|
|
||||||
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* additional members */
|
/* additional members */
|
||||||
nsRefPtr<ICameraControl> mCameraControl; // non-DOM camera control
|
nsRefPtr<ICameraControl> mCameraControl; // non-DOM camera control
|
||||||
nsCOMPtr<nsICameraCapabilities> mDOMCapabilities;
|
nsCOMPtr<nsICameraCapabilities> mDOMCapabilities;
|
||||||
// An agent used to join audio channel service.
|
// An agent used to join audio channel service.
|
||||||
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
|
nsCOMPtr<nsIAudioChannelAgent> mAudioChannelAgent;
|
||||||
|
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -127,9 +127,9 @@ nsDOMCameraManager::GetCamera(const CameraSelector& aOptions,
|
|||||||
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
|
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
|
||||||
|
|
||||||
// Creating this object will trigger the onSuccess handler
|
// Creating this object will trigger the onSuccess handler
|
||||||
nsCOMPtr<nsDOMCameraControl> cameraControl =
|
nsRefPtr<nsDOMCameraControl> cameraControl =
|
||||||
new nsDOMCameraControl(cameraId, mCameraThread,
|
new nsDOMCameraControl(cameraId, mCameraThread,
|
||||||
onSuccess, onError.WasPassed() ? onError.Value() : nullptr, mWindowId);
|
onSuccess, onError.WasPassed() ? onError.Value() : nullptr, mWindow);
|
||||||
|
|
||||||
Register(cameraControl);
|
Register(cameraControl);
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,10 @@ private:
|
|||||||
* store a reference in the 'mCameraControl' member (which is why it is
|
* store a reference in the 'mCameraControl' member (which is why it is
|
||||||
* defined here).
|
* defined here).
|
||||||
*/
|
*/
|
||||||
nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId, nsIThread* aCameraThread, nsICameraGetCameraCallback* onSuccess, nsICameraErrorCallback* onError, uint64_t aWindowId)
|
nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId, nsIThread* aCameraThread, nsICameraGetCameraCallback* onSuccess, nsICameraErrorCallback* onError, nsPIDOMWindow* aWindow) :
|
||||||
|
mWindow(aWindow)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(aWindow, "shouldn't be created with null window!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,9 +143,10 @@ static const char* getKeyText(uint32_t aKey)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// nsDOMCameraControl implementation-specific constructor
|
// nsDOMCameraControl implementation-specific constructor
|
||||||
nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId, nsIThread* aCameraThread, nsICameraGetCameraCallback* onSuccess, nsICameraErrorCallback* onError, uint64_t aWindowId)
|
nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId, nsIThread* aCameraThread, nsICameraGetCameraCallback* onSuccess, nsICameraErrorCallback* onError, nsPIDOMWindow* aWindow)
|
||||||
: mDOMCapabilities(nullptr)
|
: mDOMCapabilities(nullptr), mWindow(aWindow)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(aWindow, "shouldn't be created with null window!");
|
||||||
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
|
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,8 +161,8 @@ nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId, nsIThread* aCameraThr
|
|||||||
* nsDOMCameraControl or memory will leak!
|
* nsDOMCameraControl or memory will leak!
|
||||||
*/
|
*/
|
||||||
NS_ADDREF_THIS();
|
NS_ADDREF_THIS();
|
||||||
nsRefPtr<nsGonkCameraControl> control = new nsGonkCameraControl(aCameraId, aCameraThread, this, onSuccess, onError, aWindowId);
|
nsRefPtr<nsGonkCameraControl> control = new nsGonkCameraControl(aCameraId, aCameraThread, this, onSuccess, onError, aWindow->WindowID());
|
||||||
control->DispatchInit(this, onSuccess, onError, aWindowId);
|
control->DispatchInit(this, onSuccess, onError, aWindow->WindowID());
|
||||||
mCameraControl = control;
|
mCameraControl = control;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,171 +217,8 @@ interface nsICameraErrorCallback : nsISupports
|
|||||||
void handleEvent(in DOMString error);
|
void handleEvent(in DOMString error);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
attributes here affect the preview, any pictures taken, and/or
|
|
||||||
any video recorded by the camera.
|
|
||||||
*/
|
|
||||||
[scriptable, uuid(74dc7f1f-c88f-4774-860b-44aef9de5dc8)]
|
|
||||||
interface nsICameraControl : nsISupports
|
|
||||||
{
|
|
||||||
readonly attribute nsICameraCapabilities capabilities;
|
|
||||||
|
|
||||||
/* one of the vales chosen from capabilities.effects;
|
|
||||||
default is "none" */
|
|
||||||
attribute DOMString effect;
|
|
||||||
|
|
||||||
/* one of the values chosen from capabilities.whiteBalanceModes;
|
|
||||||
default is "auto" */
|
|
||||||
attribute DOMString whiteBalanceMode;
|
|
||||||
|
|
||||||
/* one of the valus chosen from capabilities.sceneModes;
|
|
||||||
default is "auto" */
|
|
||||||
attribute DOMString sceneMode;
|
|
||||||
|
|
||||||
/* one of the values chosen from capabilities.flashModes;
|
|
||||||
default is "auto" */
|
|
||||||
attribute DOMString flashMode;
|
|
||||||
|
|
||||||
/* one of the values chosen from capabilities.focusModes;
|
|
||||||
default is "auto", if supported, or "fixed" */
|
|
||||||
attribute DOMString focusMode;
|
|
||||||
|
|
||||||
/* one of the values chosen from capabilities.zoomRatios; other
|
|
||||||
values will be rounded to the nearest supported value;
|
|
||||||
default is 1.0 */
|
|
||||||
attribute double zoom;
|
|
||||||
|
|
||||||
/* an array of one or more objects that define where the
|
|
||||||
camera will perform light metering, each defining the properties:
|
|
||||||
{
|
|
||||||
top: -1000,
|
|
||||||
left: -1000,
|
|
||||||
bottom: 1000,
|
|
||||||
right: 1000,
|
|
||||||
weight: 1000
|
|
||||||
}
|
|
||||||
|
|
||||||
'top', 'left', 'bottom', and 'right' all range from -1000 at
|
|
||||||
the top-/leftmost of the sensor to 1000 at the bottom-/rightmost
|
|
||||||
of the sensor.
|
|
||||||
|
|
||||||
objects missing one or more of these properties will be ignored;
|
|
||||||
if the array contains more than capabilities.maxMeteringAreas,
|
|
||||||
extra areas will be ignored.
|
|
||||||
|
|
||||||
this attribute can be set to null to allow the camera to determine
|
|
||||||
where to perform light metering. */
|
|
||||||
[implicit_jscontext]
|
|
||||||
attribute jsval meteringAreas;
|
|
||||||
|
|
||||||
/* an array of one or more objects that define where the camera will
|
|
||||||
perform auto-focusing, with the same definition as meteringAreas.
|
|
||||||
|
|
||||||
if the array contains more than capabilities.maxFocusAreas, extra
|
|
||||||
areas will be ignored.
|
|
||||||
|
|
||||||
this attribute can be set to null to allow the camera to determine
|
|
||||||
where to focus. */
|
|
||||||
[implicit_jscontext]
|
|
||||||
attribute jsval focusAreas;
|
|
||||||
|
|
||||||
/* focal length in millimetres */
|
|
||||||
readonly attribute double focalLength;
|
|
||||||
|
|
||||||
/* the distances in metres to where the image subject appears to be
|
|
||||||
in focus. 'focusDistanceOptimum' is where the subject will appear
|
|
||||||
sharpest; the difference between 'focusDistanceFar' and
|
|
||||||
'focusDistanceNear' is the image's depth of field.
|
|
||||||
|
|
||||||
'focusDistanceFar' may be infinity. */
|
|
||||||
readonly attribute double focusDistanceNear;
|
|
||||||
readonly attribute double focusDistanceOptimum;
|
|
||||||
readonly attribute double focusDistanceFar;
|
|
||||||
|
|
||||||
/* 'compensation' is optional, and if missing, will
|
|
||||||
set the camera to use automatic exposure compensation.
|
|
||||||
|
|
||||||
acceptable values must range from minExposureCompensation
|
|
||||||
to maxExposureCompensation in steps of stepExposureCompensation;
|
|
||||||
invalid values will be rounded to the nearest valid value. */
|
|
||||||
[implicit_jscontext]
|
|
||||||
void setExposureCompensation([optional] in jsval compensation);
|
|
||||||
readonly attribute double exposureCompensation;
|
|
||||||
|
|
||||||
/* the function to call on the camera's shutter event, to trigger
|
|
||||||
a shutter sound and/or a visual shutter indicator. */
|
|
||||||
attribute nsICameraShutterCallback onShutter;
|
|
||||||
|
|
||||||
/* the function to call when the camera hardware is closed
|
|
||||||
by the underlying framework, e.g. when another app makes a more
|
|
||||||
recent call to get the camera. */
|
|
||||||
attribute nsICameraClosedCallback onClosed;
|
|
||||||
|
|
||||||
/* the function to call when the recorder changes state, either because
|
|
||||||
the recording process encountered an error, or because one of the
|
|
||||||
recording limits (see CameraStartRecordingOptions) was reached. */
|
|
||||||
attribute nsICameraRecorderStateChange onRecorderStateChange;
|
|
||||||
|
|
||||||
/* the function to call when the preview stream is actually started and
|
|
||||||
stopped; this is usually used to enable and disable the camera UI,
|
|
||||||
since the low-level hardware often does not support taking pictures
|
|
||||||
unless the preview is running. */
|
|
||||||
attribute nsICameraPreviewStateChange onPreviewStateChange;
|
|
||||||
|
|
||||||
/* tell the camera to attempt to focus the image */
|
|
||||||
void autoFocus(in nsICameraAutoFocusCallback onSuccess, [optional] in nsICameraErrorCallback onError);
|
|
||||||
|
|
||||||
/* capture an image and return it as a blob to the 'onSuccess' callback;
|
|
||||||
if the camera supports it, this may be invoked while the camera is
|
|
||||||
already recording video.
|
|
||||||
|
|
||||||
invoking this function will stop the preview stream, which must be
|
|
||||||
manually restarted (e.g. by calling .play() on it). */
|
|
||||||
[implicit_jscontext]
|
|
||||||
void takePicture(in jsval aOptions, in nsICameraTakePictureCallback onSuccess, [optional] in nsICameraErrorCallback onError);
|
|
||||||
|
|
||||||
/* get a media stream to be used as a camera viewfinder in video mode;
|
|
||||||
'aOptions' is an CameraRecorderOptions object. */
|
|
||||||
[implicit_jscontext]
|
|
||||||
void getPreviewStreamVideoMode(in jsval aOptions, in nsICameraPreviewStreamCallback onSuccess, [optional] in nsICameraErrorCallback onError);
|
|
||||||
|
|
||||||
/* start recording video; 'aOptions' is a
|
|
||||||
CameraStartRecordingOptions object. */
|
|
||||||
[implicit_jscontext]
|
|
||||||
void startRecording(in jsval aOptions, in nsIDOMDeviceStorage storageArea, in DOMString filename, in nsICameraStartRecordingCallback onSuccess, [optional] in nsICameraErrorCallback onError);
|
|
||||||
|
|
||||||
/* stop precording video. */
|
|
||||||
void stopRecording();
|
|
||||||
|
|
||||||
/* get a media stream to be used as a camera viewfinder; the options
|
|
||||||
define the desired frame size of the preview, chosen from
|
|
||||||
capabilities.previewSizes, e.g.:
|
|
||||||
{
|
|
||||||
height: 640,
|
|
||||||
width: 480,
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
[implicit_jscontext]
|
|
||||||
void getPreviewStream(in jsval aOptions, in nsICameraPreviewStreamCallback onSuccess, [optional] in nsICameraErrorCallback onError);
|
|
||||||
|
|
||||||
/* call in or after the takePicture() onSuccess callback to
|
|
||||||
resume the camera preview stream. */
|
|
||||||
void resumePreview();
|
|
||||||
|
|
||||||
/* release the camera so that other applications can use it; you should
|
|
||||||
probably call this whenever the camera is not longer in the foreground
|
|
||||||
(depending on your usage model).
|
|
||||||
|
|
||||||
the callbacks are optional, unless you really need to know when
|
|
||||||
the hardware is ultimately released.
|
|
||||||
|
|
||||||
once this is called, the camera control object is to be considered
|
|
||||||
defunct; a new instance will need to be created to access the camera. */
|
|
||||||
[binaryname(ReleaseHardware)] void release([optional] in nsICameraReleaseCallback onSuccess, [optional] in nsICameraErrorCallback onError);
|
|
||||||
};
|
|
||||||
|
|
||||||
[scriptable, function, uuid(a267afbc-d91c-413a-8de5-0b94aecffa3e)]
|
[scriptable, function, uuid(a267afbc-d91c-413a-8de5-0b94aecffa3e)]
|
||||||
interface nsICameraGetCameraCallback : nsISupports
|
interface nsICameraGetCameraCallback : nsISupports
|
||||||
{
|
{
|
||||||
void handleEvent(in nsICameraControl camera);
|
void handleEvent(in nsISupports camera);
|
||||||
};
|
};
|
||||||
|
195
dom/webidl/CameraControl.webidl
Normal file
195
dom/webidl/CameraControl.webidl
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set ts=2 et sw=2 tw=80: */
|
||||||
|
/* 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface CameraCapabilities;
|
||||||
|
interface GetCameraCallback;
|
||||||
|
interface CameraErrorCallback;
|
||||||
|
interface CameraShutterCallback;
|
||||||
|
interface CameraClosedCallback;
|
||||||
|
interface CameraRecorderStateChange;
|
||||||
|
interface CameraAutoFocusCallback;
|
||||||
|
interface CameraTakePictureCallback;
|
||||||
|
interface CameraPreviewStateChange;
|
||||||
|
interface CameraPreviewStreamCallback;
|
||||||
|
interface CameraStartRecordingCallback;
|
||||||
|
interface CameraReleaseCallback;
|
||||||
|
|
||||||
|
/*
|
||||||
|
attributes here affect the preview, any pictures taken, and/or
|
||||||
|
any video recorded by the camera.
|
||||||
|
*/
|
||||||
|
interface CameraControl {
|
||||||
|
readonly attribute CameraCapabilities capabilities;
|
||||||
|
|
||||||
|
/* one of the values chosen from capabilities.effects;
|
||||||
|
default is "none" */
|
||||||
|
[Throws]
|
||||||
|
attribute DOMString effect;
|
||||||
|
|
||||||
|
/* one of the values chosen from capabilities.whiteBalanceModes;
|
||||||
|
default is "auto" */
|
||||||
|
[Throws]
|
||||||
|
attribute DOMString whiteBalanceMode;
|
||||||
|
|
||||||
|
/* one of the values chosen from capabilities.sceneModes;
|
||||||
|
default is "auto" */
|
||||||
|
[Throws]
|
||||||
|
attribute DOMString sceneMode;
|
||||||
|
|
||||||
|
/* one of the values chosen from capabilities.flashModes;
|
||||||
|
default is "auto" */
|
||||||
|
[Throws]
|
||||||
|
attribute DOMString flashMode;
|
||||||
|
|
||||||
|
/* one of the values chosen from capabilities.focusModes;
|
||||||
|
default is "auto", if supported, or "fixed" */
|
||||||
|
[Throws]
|
||||||
|
attribute DOMString focusMode;
|
||||||
|
|
||||||
|
/* one of the values chosen from capabilities.zoomRatios; other
|
||||||
|
values will be rounded to the nearest supported value;
|
||||||
|
default is 1.0 */
|
||||||
|
[Throws]
|
||||||
|
attribute double zoom;
|
||||||
|
|
||||||
|
/* an array of one or more objects that define where the
|
||||||
|
camera will perform light metering, each defining the properties:
|
||||||
|
{
|
||||||
|
top: -1000,
|
||||||
|
left: -1000,
|
||||||
|
bottom: 1000,
|
||||||
|
right: 1000,
|
||||||
|
weight: 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
'top', 'left', 'bottom', and 'right' all range from -1000 at
|
||||||
|
the top-/leftmost of the sensor to 1000 at the bottom-/rightmost
|
||||||
|
of the sensor.
|
||||||
|
|
||||||
|
objects missing one or more of these properties will be ignored;
|
||||||
|
if the array contains more than capabilities.maxMeteringAreas,
|
||||||
|
extra areas will be ignored.
|
||||||
|
|
||||||
|
this attribute can be set to null to allow the camera to determine
|
||||||
|
where to perform light metering. */
|
||||||
|
[Throws]
|
||||||
|
attribute any meteringAreas;
|
||||||
|
|
||||||
|
/* an array of one or more objects that define where the camera will
|
||||||
|
perform auto-focusing, with the same definition as meteringAreas.
|
||||||
|
|
||||||
|
if the array contains more than capabilities.maxFocusAreas, extra
|
||||||
|
areas will be ignored.
|
||||||
|
|
||||||
|
this attribute can be set to null to allow the camera to determine
|
||||||
|
where to focus. */
|
||||||
|
[Throws]
|
||||||
|
attribute any focusAreas;
|
||||||
|
|
||||||
|
/* focal length in millimetres */
|
||||||
|
[Throws]
|
||||||
|
readonly attribute double focalLength;
|
||||||
|
|
||||||
|
/* the distances in metres to where the image subject appears to be
|
||||||
|
in focus. 'focusDistanceOptimum' is where the subject will appear
|
||||||
|
sharpest; the difference between 'focusDistanceFar' and
|
||||||
|
'focusDistanceNear' is the image's depth of field.
|
||||||
|
|
||||||
|
'focusDistanceFar' may be infinity. */
|
||||||
|
[Throws]
|
||||||
|
readonly attribute double focusDistanceNear;
|
||||||
|
[Throws]
|
||||||
|
readonly attribute double focusDistanceOptimum;
|
||||||
|
[Throws]
|
||||||
|
readonly attribute unrestricted double focusDistanceFar;
|
||||||
|
|
||||||
|
/* 'compensation' is optional, and if missing, will
|
||||||
|
set the camera to use automatic exposure compensation.
|
||||||
|
|
||||||
|
acceptable values must range from minExposureCompensation
|
||||||
|
to maxExposureCompensation in steps of stepExposureCompensation;
|
||||||
|
invalid values will be rounded to the nearest valid value. */
|
||||||
|
[Throws]
|
||||||
|
void setExposureCompensation(optional double compensation);
|
||||||
|
[Throws]
|
||||||
|
readonly attribute unrestricted double exposureCompensation;
|
||||||
|
|
||||||
|
/* the function to call on the camera's shutter event, to trigger
|
||||||
|
a shutter sound and/or a visual shutter indicator. */
|
||||||
|
[Throws]
|
||||||
|
attribute CameraShutterCallback? onShutter;
|
||||||
|
|
||||||
|
/* the function to call when the camera hardware is closed
|
||||||
|
by the underlying framework, e.g. when another app makes a more
|
||||||
|
recent call to get the camera. */
|
||||||
|
[Throws]
|
||||||
|
attribute CameraClosedCallback? onClosed;
|
||||||
|
|
||||||
|
/* the function to call when the recorder changes state, either because
|
||||||
|
the recording process encountered an error, or because one of the
|
||||||
|
recording limits (see CameraStartRecordingOptions) was reached. */
|
||||||
|
[Throws]
|
||||||
|
attribute CameraRecorderStateChange? onRecorderStateChange;
|
||||||
|
attribute CameraPreviewStateChange? onPreviewStateChange;
|
||||||
|
|
||||||
|
/* tell the camera to attempt to focus the image */
|
||||||
|
[Throws]
|
||||||
|
void autoFocus(CameraAutoFocusCallback onSuccess, optional CameraErrorCallback onError);
|
||||||
|
|
||||||
|
/* capture an image and return it as a blob to the 'onSuccess' callback;
|
||||||
|
if the camera supports it, this may be invoked while the camera is
|
||||||
|
already recording video.
|
||||||
|
|
||||||
|
invoking this function will stop the preview stream, which must be
|
||||||
|
manually restarted (e.g. by calling .play() on it). */
|
||||||
|
[Throws]
|
||||||
|
void takePicture(CameraPictureOptions aOptions,
|
||||||
|
CameraTakePictureCallback onSuccess,
|
||||||
|
optional CameraErrorCallback onError);
|
||||||
|
|
||||||
|
/* get a media stream to be used as a camera viewfinder in video mode;
|
||||||
|
'aOptions' is an CameraRecorderOptions object. */
|
||||||
|
[Throws]
|
||||||
|
void getPreviewStreamVideoMode(any aOptions, CameraPreviewStreamCallback onSuccess, optional CameraErrorCallback onError);
|
||||||
|
|
||||||
|
/* start recording video; 'aOptions' is a
|
||||||
|
CameraStartRecordingOptions object. */
|
||||||
|
[Throws]
|
||||||
|
void startRecording(any aOptions, DeviceStorage storageArea, DOMString filename, CameraStartRecordingCallback onSuccess, optional CameraErrorCallback onError);
|
||||||
|
|
||||||
|
/* stop precording video. */
|
||||||
|
[Throws]
|
||||||
|
void stopRecording();
|
||||||
|
|
||||||
|
/* get a media stream to be used as a camera viewfinder; the options
|
||||||
|
define the desired frame size of the preview, chosen from
|
||||||
|
capabilities.previewSizes, e.g.:
|
||||||
|
{
|
||||||
|
height: 640,
|
||||||
|
width: 480,
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
[Throws]
|
||||||
|
void getPreviewStream(any aOptions, CameraPreviewStreamCallback onSuccess, optional CameraErrorCallback onError);
|
||||||
|
|
||||||
|
/* call in or after the takePicture() onSuccess callback to
|
||||||
|
resume the camera preview stream. */
|
||||||
|
[Throws]
|
||||||
|
void resumePreview();
|
||||||
|
|
||||||
|
/* release the camera so that other applications can use it; you should
|
||||||
|
probably call this whenever the camera is not longer in the foreground
|
||||||
|
(depending on your usage model).
|
||||||
|
|
||||||
|
the callbacks are optional, unless you really need to know when
|
||||||
|
the hardware is ultimately released.
|
||||||
|
|
||||||
|
once this is called, the camera control object is to be considered
|
||||||
|
defunct; a new instance will need to be created to access the camera. */
|
||||||
|
[Throws]
|
||||||
|
void release(optional CameraReleaseCallback onSuccess, optional CameraErrorCallback onError);
|
||||||
|
};
|
@ -19,7 +19,6 @@ interface DummyInterface {
|
|||||||
void funcDNSLookupDict(optional DNSLookupDict arg);
|
void funcDNSLookupDict(optional DNSLookupDict arg);
|
||||||
void funcConnStatusDict(optional ConnStatusDict arg);
|
void funcConnStatusDict(optional ConnStatusDict arg);
|
||||||
void frameRequestCallback(FrameRequestCallback arg);
|
void frameRequestCallback(FrameRequestCallback arg);
|
||||||
void CameraPictureOptions(optional CameraPictureOptions arg);
|
|
||||||
void MmsParameters(optional MmsParameters arg);
|
void MmsParameters(optional MmsParameters arg);
|
||||||
void MmsAttachment(optional MmsAttachment arg);
|
void MmsAttachment(optional MmsAttachment arg);
|
||||||
void AsyncScrollEventDetail(optional AsyncScrollEventDetail arg);
|
void AsyncScrollEventDetail(optional AsyncScrollEventDetail arg);
|
||||||
|
@ -34,6 +34,7 @@ webidl_files = \
|
|||||||
BiquadFilterNode.webidl \
|
BiquadFilterNode.webidl \
|
||||||
Blob.webidl \
|
Blob.webidl \
|
||||||
BrowserElementDictionaries.webidl \
|
BrowserElementDictionaries.webidl \
|
||||||
|
CameraControl.webidl \
|
||||||
CameraManager.webidl \
|
CameraManager.webidl \
|
||||||
CanvasRenderingContext2D.webidl \
|
CanvasRenderingContext2D.webidl \
|
||||||
CaretPosition.webidl \
|
CaretPosition.webidl \
|
||||||
|
Loading…
Reference in New Issue
Block a user