File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ void VideoCaptureWrap::Init(Local<Object> target) {
3333 Nan::SetPrototypeMethod (ctor, " setHeight" , SetHeight);
3434 Nan::SetPrototypeMethod (ctor, " setPosition" , SetPosition);
3535 Nan::SetPrototypeMethod (ctor, " getFrameAt" , GetFrameAt);
36+ Nan::SetPrototypeMethod (ctor, " getFrameCount" , GetFrameCount);
3637 Nan::SetPrototypeMethod (ctor, " close" , Close);
3738 Nan::SetPrototypeMethod (ctor, " ReadSync" , ReadSync);
3839 Nan::SetPrototypeMethod (ctor, " grab" , Grab);
@@ -94,6 +95,15 @@ NAN_METHOD(VideoCaptureWrap::SetWidth) {
9495 return ;
9596}
9697
98+ NAN_METHOD (VideoCaptureWrap::GetFrameCount) {
99+ Nan::HandleScope scope;
100+ VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This ());
101+
102+ int cnt = int (v->cap .get (CV_CAP_PROP_FRAME_COUNT));
103+
104+ info.GetReturnValue ().Set (Nan::New<Number>(cnt));
105+ }
106+
97107NAN_METHOD (VideoCaptureWrap::SetHeight) {
98108 Nan::HandleScope scope;
99109 VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This ());
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ class VideoCaptureWrap: public Nan::ObjectWrap {
2323
2424 // to set frame position
2525 static NAN_METHOD (SetPosition);
26+ static NAN_METHOD (GetFrameCount);
2627
2728 static NAN_METHOD (GetFrameAt);
2829
You can’t perform that action at this time.
0 commit comments