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 * ...@@ -71,9 +71,12 @@ static PyObject *
QtTimeRecord_New(itself) QtTimeRecord_New(itself)
TimeRecord *itself; TimeRecord *itself;
{ {
if (itself->base)
return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale, return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
TimeBaseObj_New, itself->base); TimeBaseObj_New, itself->base);
else
return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
Py_None);
} }
static int static int
...@@ -81,9 +84,14 @@ QtTimeRecord_Convert(v, p_itself) ...@@ -81,9 +84,14 @@ QtTimeRecord_Convert(v, p_itself)
PyObject *v; PyObject *v;
TimeRecord *p_itself; TimeRecord *p_itself;
{ {
PyObject *base = NULL;
if( !PyArg_ParseTuple(v, "O&lO&", PyMac_Getwide, &p_itself->value, &p_itself->scale, if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
TimeBaseObj_Convert, &p_itself->base) ) &base) )
return 0;
if ( base == NULL || base == Py_None )
p_itself->base = NULL;
else
if ( !TimeBaseObj_Convert(base, &p_itself->base) )
return 0; return 0;
return 1; return 1;
} }
......
...@@ -53,9 +53,12 @@ static PyObject * ...@@ -53,9 +53,12 @@ static PyObject *
QtTimeRecord_New(itself) QtTimeRecord_New(itself)
TimeRecord *itself; TimeRecord *itself;
{ {
if (itself->base)
return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale, return Py_BuildValue("O&lO&", PyMac_Buildwide, &itself->value, itself->scale,
TimeBaseObj_New, itself->base); TimeBaseObj_New, itself->base);
else
return Py_BuildValue("O&lO", PyMac_Buildwide, &itself->value, itself->scale,
Py_None);
} }
static int static int
...@@ -63,9 +66,14 @@ QtTimeRecord_Convert(v, p_itself) ...@@ -63,9 +66,14 @@ QtTimeRecord_Convert(v, p_itself)
PyObject *v; PyObject *v;
TimeRecord *p_itself; TimeRecord *p_itself;
{ {
PyObject *base = NULL;
if( !PyArg_ParseTuple(v, "O&lO&", PyMac_Getwide, &p_itself->value, &p_itself->scale, if( !PyArg_ParseTuple(v, "O&l|O", PyMac_Getwide, &p_itself->value, &p_itself->scale,
TimeBaseObj_Convert, &p_itself->base) ) &base) )
return 0;
if ( base == NULL || base == Py_None )
p_itself->base = NULL;
else
if ( !TimeBaseObj_Convert(base, &p_itself->base) )
return 0; return 0;
return 1; 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