Commit 6f3fceb8 authored by Jack Jansen's avatar Jack Jansen

Allow None as TimeBase value in TimeValue records (becomes NULL in C structure,

used for delta-t values by quicktime).
parent bf325830
......@@ -71,9 +71,12 @@ static PyObject *
QtTimeRecord_New(itself)
TimeRecord *itself;
{
if (itself->base)
return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
TimeBaseObj_New, itself->base);
else
return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
Py_None);
}
static int
......@@ -81,9 +84,14 @@ QtTimeRecord_Convert(v, p_itself)
PyObject *v;
TimeRecord *p_itself;
{
if( !PyArg_ParseTuple(v, "O&lO&", PyMac_Getwide, &p_itself->value, &p_itself->scale,
TimeBaseObj_Convert, &p_itself->base) )
PyObject *base = NULL;
if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
&base) )
return 0;
if ( base == NULL || base == Py_None )
p_itself->base = NULL;
else
if ( !TimeBaseObj_Convert(base, &p_itself->base) )
return 0;
return 1;
}
......
......@@ -53,9 +53,12 @@ static PyObject *
QtTimeRecord_New(itself)
TimeRecord *itself;
{
if (itself->base)
return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
TimeBaseObj_New, itself->base);
else
return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
Py_None);
}
static int
......@@ -63,9 +66,14 @@ QtTimeRecord_Convert(v, p_itself)
PyObject *v;
TimeRecord *p_itself;
{
if( !PyArg_ParseTuple(v, "O&lO&", PyMac_Getwide, &p_itself->value, &p_itself->scale,
TimeBaseObj_Convert, &p_itself->base) )
PyObject *base = NULL;
if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
&base) )
return 0;
if ( base == NULL || base == Py_None )
p_itself->base = NULL;
else
if ( !TimeBaseObj_Convert(base, &p_itself->base) )
return 0;
return 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment