added getFPS to VideoCapture

This commit is contained in:
Dennis Van Roeyen 2017-08-18 14:51:35 +02:00
parent 8a9c02a5e4
commit 4b7822b4df
2 changed files with 13 additions and 0 deletions

View File

@ -33,6 +33,7 @@ void VideoCaptureWrap::Init(Local<Object> target) {
Nan::SetPrototypeMethod(ctor, "setPosition", SetPosition);
Nan::SetPrototypeMethod(ctor, "getFrameAt", GetFrameAt);
Nan::SetPrototypeMethod(ctor, "getFrameCount", GetFrameCount);
Nan::SetPrototypeMethod(ctor, "getFPS", GetFPS);
Nan::SetPrototypeMethod(ctor, "release", Release);
Nan::SetPrototypeMethod(ctor, "ReadSync", ReadSync);
Nan::SetPrototypeMethod(ctor, "grab", Grab);
@ -103,6 +104,16 @@ NAN_METHOD(VideoCaptureWrap::GetFrameCount) {
info.GetReturnValue().Set(Nan::New<Number>(cnt));
}
NAN_METHOD(VideoCaptureWrap::GetFPS) {
Nan::HandleScope scope;
VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This());
int fps = int(v->cap.get(CV_CAP_PROP_FPS));
info.GetReturnValue().Set(Nan::New<Number>(fps));
}
NAN_METHOD(VideoCaptureWrap::SetHeight) {
Nan::HandleScope scope;
VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This());

View File

@ -25,6 +25,8 @@ public:
static NAN_METHOD(SetPosition);
static NAN_METHOD(GetFrameCount);
static NAN_METHOD(GetFPS);
static NAN_METHOD(GetFrameAt);
// release the stream