mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
VideoCaptureWrap: Add setFPS - returns FPS read back.
This commit is contained in:
parent
a58656270f
commit
f2e1fc3e1e
@ -38,6 +38,7 @@ void VideoCaptureWrap::Init(Local<Object> target) {
|
||||
Nan::SetPrototypeMethod(ctor, "getFrameAt", GetFrameAt);
|
||||
Nan::SetPrototypeMethod(ctor, "getFrameCount", GetFrameCount);
|
||||
Nan::SetPrototypeMethod(ctor, "getFPS", GetFPS);
|
||||
Nan::SetPrototypeMethod(ctor, "setFPS", SetFPS);
|
||||
Nan::SetPrototypeMethod(ctor, "release", Release);
|
||||
Nan::SetPrototypeMethod(ctor, "ReadSync", ReadSync);
|
||||
Nan::SetPrototypeMethod(ctor, "grab", Grab);
|
||||
@ -127,6 +128,21 @@ NAN_METHOD(VideoCaptureWrap::GetFPS) {
|
||||
info.GetReturnValue().Set(Nan::New<Number>(fps));
|
||||
}
|
||||
|
||||
NAN_METHOD(VideoCaptureWrap::SetFPS) {
|
||||
Nan::HandleScope scope;
|
||||
VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This());
|
||||
|
||||
if (info.Length() > 0) {
|
||||
if (info[0]->IsNumber()) {
|
||||
int fps = info[0]->IntegerValue();
|
||||
v->cap.set(CV_CAP_PROP_FPS, fps);
|
||||
}
|
||||
}
|
||||
|
||||
int fps = int(v->cap.get(CV_CAP_PROP_FPS));
|
||||
|
||||
info.GetReturnValue().Set(Nan::New<Number>(fps));
|
||||
}
|
||||
|
||||
NAN_METHOD(VideoCaptureWrap::GetHeight) {
|
||||
Nan::HandleScope scope;
|
||||
|
||||
@ -32,6 +32,7 @@ public:
|
||||
static NAN_METHOD(GetFrameCount);
|
||||
|
||||
static NAN_METHOD(GetFPS);
|
||||
static NAN_METHOD(SetFPS);
|
||||
|
||||
static NAN_METHOD(GetFrameAt);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user