mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Merge pull request #142 from jhludwig/Video-SetPosition
Add SetPosition method
This commit is contained in:
commit
86560fd68b
@ -36,6 +36,7 @@ VideoCaptureWrap::Init(Handle<Object> target) {
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "read", Read);
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "setWidth", SetWidth);
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "setHeight", SetHeight);
|
||||
NODE_SET_PROTOTYPE_METHOD(constructor, "setPosition", SetPosition);
|
||||
|
||||
target->Set(String::NewSymbol("VideoCapture"), constructor->GetFunction());
|
||||
};
|
||||
@ -115,6 +116,22 @@ VideoCaptureWrap::SetHeight(const Arguments &args){
|
||||
return Undefined();
|
||||
}
|
||||
|
||||
Handle<Value>
|
||||
VideoCaptureWrap::SetPosition(const Arguments &args){
|
||||
|
||||
HandleScope scope;
|
||||
VideoCaptureWrap *v = ObjectWrap::Unwrap<VideoCaptureWrap>(args.This());
|
||||
|
||||
if(args.Length() != 1)
|
||||
return scope.Close(Undefined());
|
||||
|
||||
int pos = args[0]->IntegerValue();
|
||||
|
||||
v->cap.set(CV_CAP_PROP_POS_FRAMES, pos);
|
||||
|
||||
return Undefined();
|
||||
}
|
||||
|
||||
Handle<Value>
|
||||
VideoCaptureWrap::Read(const Arguments &args) {
|
||||
|
||||
|
||||
@ -14,8 +14,11 @@ class VideoCaptureWrap: public node::ObjectWrap {
|
||||
static Handle<Value> Read(const v8::Arguments&);
|
||||
|
||||
//(Optional) For setting width and height of the input video stream
|
||||
static Handle<Value> SetWidth(const v8::Arguments&);
|
||||
static Handle<Value> SetHeight(const v8::Arguments&);
|
||||
static Handle<Value> SetWidth(const v8::Arguments&);
|
||||
static Handle<Value> SetHeight(const v8::Arguments&);
|
||||
|
||||
// to set frame position
|
||||
static Handle<Value> SetPosition(const v8::Arguments&);
|
||||
|
||||
|
||||
static Handle<Value> GetFrameAt(const v8::Arguments&);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user