Implement getFrameAt

getFrameAt takes the position of the video in milliseconds
This commit is contained in:
Matthias Klan 2015-12-08 14:54:35 +01:00
parent c70ec49331
commit ca36b462ce

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());