Merge pull request #344 from vaceta/patch-1

Implement getFrameAt
This commit is contained in:
Peter Braden 2015-12-09 14:02:05 +01:00
commit d45e74a0aa

View File

@ -32,6 +32,7 @@ void VideoCaptureWrap::Init(Local<Object> target) {
Nan::SetPrototypeMethod(ctor, "setWidth", SetWidth);
Nan::SetPrototypeMethod(ctor, "setHeight", SetHeight);
Nan::SetPrototypeMethod(ctor, "setPosition", SetPosition);
Nan::SetPrototypeMethod(ctor, "getFrameAt", GetFrameAt);
Nan::SetPrototypeMethod(ctor, "close", Close);
Nan::SetPrototypeMethod(ctor, "ReadSync", ReadSync);
Nan::SetPrototypeMethod(ctor, "grab", Grab);
@ -121,6 +122,20 @@ NAN_METHOD(VideoCaptureWrap::SetPosition) {
return;
}
NAN_METHOD(VideoCaptureWrap::GetFrameAt) {
Nan::HandleScope scope;
VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This());
if(info.Length() != 1)
return;
int pos = info[0]->IntegerValue();
v->cap.set(CV_CAP_PROP_POS_MSEC, pos);
return;
}
NAN_METHOD(VideoCaptureWrap::Close) {
Nan::HandleScope scope;
VideoCaptureWrap *v = Nan::ObjectWrap::Unwrap<VideoCaptureWrap>(info.This());