Skip to content

Commit 7af09f3

Browse files
thompson318adamrankin
authored andcommitted
Added Python support for Polaris Vega. (#17)
Added ndiOpenNetwork, ndiCloseNetwork, ndiGetPHSRNumberOfHandles, ndiGetPHRQHandle to python module. Changed char to int in ndiPVWRFromFile.
1 parent c37d61d commit 7af09f3

1 file changed

Lines changed: 75 additions & 2 deletions

File tree

ndicapimodule.cxx

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,31 @@ static PyObject* Py_ndiOpen(PyObject* module, PyObject* args)
617617
return NULL;
618618
}
619619

620+
/* Open a networked tracker*/
621+
static PyObject* Py_ndiOpenNetwork(PyObject* module, PyObject* args)
622+
{
623+
ndicapi* pol;
624+
char* hostname;
625+
int port;
626+
PyNdicapi* self;
627+
628+
if (PyArg_ParseTuple(args, "si:plOpenNetwork", &hostname, &port))
629+
{
630+
pol = ndiOpenNetwork(hostname, port);
631+
if (pol == NULL)
632+
{
633+
Py_INCREF(Py_None);
634+
return Py_None;
635+
}
636+
self = PyObject_NEW(PyNdicapi, &PyNdicapiType);
637+
self->pl_ndicapi = pol;
638+
Py_INCREF(self);
639+
return (PyObject*)self;
640+
}
641+
642+
return NULL;
643+
}
644+
620645
static PyObject* Py_ndiGetDeviceName(PyObject* module, PyObject* args)
621646
{
622647
ndicapi* pol;
@@ -650,6 +675,21 @@ static PyObject* Py_ndiClose(PyObject* module, PyObject* args)
650675
return NULL;
651676
}
652677

678+
/* close a networked tracker */
679+
static PyObject* Py_ndiCloseNetwork(PyObject* module, PyObject* args)
680+
{
681+
ndicapi* pol;
682+
683+
if (PyArg_ParseTuple(args, "O&:plClose", &_ndiConverter, &pol))
684+
{
685+
ndiCloseNetwork(pol);
686+
Py_INCREF(Py_None);
687+
return Py_None;
688+
}
689+
690+
return NULL;
691+
}
692+
653693
static PyObject* Py_ndiSetThreadMode(PyObject* module, PyObject* args)
654694
{
655695
ndicapi* pol;
@@ -822,12 +862,12 @@ PyCommandMacro(ndi3D, "3D:%c%d")
822862

823863
static PyObject* Py_ndiPVWRFromFile(PyObject* module, PyObject* args)
824864
{
825-
char port;
865+
int port;
826866
int result;
827867
char* filename;
828868
ndicapi* pol;
829869

830-
if (PyArg_ParseTuple(args, "O&cs:plPVWRFromFile",
870+
if (PyArg_ParseTuple(args, "O&is:plPVWRFromFile",
831871
&_ndiConverter, &pol, &port, &filename))
832872
{
833873
result = ndiPVWRFromFile(pol, port, filename);
@@ -1297,6 +1337,34 @@ static PyObject* Py_ndiGetIRCHKSourceXY(PyObject* module, PyObject* args)
12971337
return NULL;
12981338
}
12991339

1340+
static PyObject* Py_ndiGetPHSRNumberOfHandles (PyObject* module, PyObject* args)
1341+
{
1342+
int result;
1343+
ndicapi* pol;
1344+
1345+
if (PyArg_ParseTuple(args, "O&:plGetPHSRNumberOfHandles",
1346+
&_ndiConverter, &pol))
1347+
{
1348+
result = ndiGetPHSRNumberOfHandles(pol);
1349+
return PyInt_FromLong(result);
1350+
}
1351+
return NULL;
1352+
}
1353+
1354+
static PyObject* Py_ndiGetPHRQHandle (PyObject* module, PyObject* args)
1355+
{
1356+
int result;
1357+
ndicapi* pol;
1358+
1359+
if (PyArg_ParseTuple(args, "O&:plGetPHRQHandle",
1360+
&_ndiConverter, &pol))
1361+
{
1362+
result = ndiGetPHRQHandle(pol);
1363+
return PyInt_FromLong(result);
1364+
}
1365+
return NULL;
1366+
}
1367+
13001368
static PyObject* Py_ndiRelativeTransform(PyObject* module, PyObject* args)
13011369
{
13021370
double a[8];
@@ -1446,8 +1514,10 @@ static PyMethodDef NdicapiMethods[] =
14461514
Py_NDIMethodMacro(ndiDeviceName),
14471515
Py_NDIMethodMacro(ndiProbe),
14481516
Py_NDIMethodMacro(ndiOpen),
1517+
Py_NDIMethodMacro(ndiOpenNetwork),
14491518
Py_NDIMethodMacro(ndiGetDeviceName),
14501519
Py_NDIMethodMacro(ndiClose),
1520+
Py_NDIMethodMacro(ndiCloseNetwork),
14511521
Py_NDIMethodMacro(ndiSetThreadMode),
14521522
Py_NDIMethodMacro(ndiCommand),
14531523

@@ -1530,6 +1600,9 @@ static PyMethodDef NdicapiMethods[] =
15301600
Py_NDIMethodMacro(ndiGetIRCHKNumberOfSources),
15311601
Py_NDIMethodMacro(ndiGetIRCHKSourceXY),
15321602

1603+
Py_NDIMethodMacro(ndiGetPHSRNumberOfHandles),
1604+
Py_NDIMethodMacro(ndiGetPHRQHandle),
1605+
15331606
Py_NDIMethodMacro(ndiIRED),
15341607
Py_NDIMethodMacro(ndi3D),
15351608

0 commit comments

Comments
 (0)