Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 493aa48

Browse files
committed
Added available() method, which checks whether quicktime is installed at all (by
testing whether EnterMovies points to an actual routine or is a null pointer).
1 parent 068bdb1 commit 493aa48

2 files changed

Lines changed: 104 additions & 0 deletions

File tree

Mac/Modules/qt/Qtmodule.c

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,12 @@ static PyObject *MovieCtlObj_getattr(self, name)
10211021

10221022
#define MovieCtlObj_setattr NULL
10231023

1024+
#define MovieCtlObj_compare NULL
1025+
1026+
#define MovieCtlObj_repr NULL
1027+
1028+
#define MovieCtlObj_hash NULL
1029+
10241030
PyTypeObject MovieController_Type = {
10251031
PyObject_HEAD_INIT(&PyType_Type)
10261032
0, /*ob_size*/
@@ -1032,6 +1038,12 @@ PyTypeObject MovieController_Type = {
10321038
0, /*tp_print*/
10331039
(getattrfunc) MovieCtlObj_getattr, /*tp_getattr*/
10341040
(setattrfunc) MovieCtlObj_setattr, /*tp_setattr*/
1041+
(cmpfunc) MovieCtlObj_compare, /*tp_compare*/
1042+
(reprfunc) MovieCtlObj_repr, /*tp_repr*/
1043+
(PyNumberMethods *)0, /* tp_as_number */
1044+
(PySequenceMethods *)0, /* tp_as_sequence */
1045+
(PyMappingMethods *)0, /* tp_as_mapping */
1046+
(hashfunc) MovieCtlObj_hash, /*tp_hash*/
10351047
};
10361048

10371049
/* ---------------- End object type MovieController ----------------- */
@@ -1446,6 +1458,12 @@ static PyObject *TimeBaseObj_getattr(self, name)
14461458

14471459
#define TimeBaseObj_setattr NULL
14481460

1461+
#define TimeBaseObj_compare NULL
1462+
1463+
#define TimeBaseObj_repr NULL
1464+
1465+
#define TimeBaseObj_hash NULL
1466+
14491467
PyTypeObject TimeBase_Type = {
14501468
PyObject_HEAD_INIT(&PyType_Type)
14511469
0, /*ob_size*/
@@ -1457,6 +1475,12 @@ PyTypeObject TimeBase_Type = {
14571475
0, /*tp_print*/
14581476
(getattrfunc) TimeBaseObj_getattr, /*tp_getattr*/
14591477
(setattrfunc) TimeBaseObj_setattr, /*tp_setattr*/
1478+
(cmpfunc) TimeBaseObj_compare, /*tp_compare*/
1479+
(reprfunc) TimeBaseObj_repr, /*tp_repr*/
1480+
(PyNumberMethods *)0, /* tp_as_number */
1481+
(PySequenceMethods *)0, /* tp_as_sequence */
1482+
(PyMappingMethods *)0, /* tp_as_mapping */
1483+
(hashfunc) TimeBaseObj_hash, /*tp_hash*/
14601484
};
14611485

14621486
/* -------------------- End object type TimeBase -------------------- */
@@ -1735,6 +1759,12 @@ static PyObject *UserDataObj_getattr(self, name)
17351759

17361760
#define UserDataObj_setattr NULL
17371761

1762+
#define UserDataObj_compare NULL
1763+
1764+
#define UserDataObj_repr NULL
1765+
1766+
#define UserDataObj_hash NULL
1767+
17381768
PyTypeObject UserData_Type = {
17391769
PyObject_HEAD_INIT(&PyType_Type)
17401770
0, /*ob_size*/
@@ -1746,6 +1776,12 @@ PyTypeObject UserData_Type = {
17461776
0, /*tp_print*/
17471777
(getattrfunc) UserDataObj_getattr, /*tp_getattr*/
17481778
(setattrfunc) UserDataObj_setattr, /*tp_setattr*/
1779+
(cmpfunc) UserDataObj_compare, /*tp_compare*/
1780+
(reprfunc) UserDataObj_repr, /*tp_repr*/
1781+
(PyNumberMethods *)0, /* tp_as_number */
1782+
(PySequenceMethods *)0, /* tp_as_sequence */
1783+
(PyMappingMethods *)0, /* tp_as_mapping */
1784+
(hashfunc) UserDataObj_hash, /*tp_hash*/
17491785
};
17501786

17511787
/* -------------------- End object type UserData -------------------- */
@@ -2806,6 +2842,12 @@ static PyObject *MediaObj_getattr(self, name)
28062842

28072843
#define MediaObj_setattr NULL
28082844

2845+
#define MediaObj_compare NULL
2846+
2847+
#define MediaObj_repr NULL
2848+
2849+
#define MediaObj_hash NULL
2850+
28092851
PyTypeObject Media_Type = {
28102852
PyObject_HEAD_INIT(&PyType_Type)
28112853
0, /*ob_size*/
@@ -2817,6 +2859,12 @@ PyTypeObject Media_Type = {
28172859
0, /*tp_print*/
28182860
(getattrfunc) MediaObj_getattr, /*tp_getattr*/
28192861
(setattrfunc) MediaObj_setattr, /*tp_setattr*/
2862+
(cmpfunc) MediaObj_compare, /*tp_compare*/
2863+
(reprfunc) MediaObj_repr, /*tp_repr*/
2864+
(PyNumberMethods *)0, /* tp_as_number */
2865+
(PySequenceMethods *)0, /* tp_as_sequence */
2866+
(PyMappingMethods *)0, /* tp_as_mapping */
2867+
(hashfunc) MediaObj_hash, /*tp_hash*/
28202868
};
28212869

28222870
/* --------------------- End object type Media ---------------------- */
@@ -3974,6 +4022,12 @@ static PyObject *TrackObj_getattr(self, name)
39744022

39754023
#define TrackObj_setattr NULL
39764024

4025+
#define TrackObj_compare NULL
4026+
4027+
#define TrackObj_repr NULL
4028+
4029+
#define TrackObj_hash NULL
4030+
39774031
PyTypeObject Track_Type = {
39784032
PyObject_HEAD_INIT(&PyType_Type)
39794033
0, /*ob_size*/
@@ -3985,6 +4039,12 @@ PyTypeObject Track_Type = {
39854039
0, /*tp_print*/
39864040
(getattrfunc) TrackObj_getattr, /*tp_getattr*/
39874041
(setattrfunc) TrackObj_setattr, /*tp_setattr*/
4042+
(cmpfunc) TrackObj_compare, /*tp_compare*/
4043+
(reprfunc) TrackObj_repr, /*tp_repr*/
4044+
(PyNumberMethods *)0, /* tp_as_number */
4045+
(PySequenceMethods *)0, /* tp_as_sequence */
4046+
(PyMappingMethods *)0, /* tp_as_mapping */
4047+
(hashfunc) TrackObj_hash, /*tp_hash*/
39884048
};
39894049

39904050
/* --------------------- End object type Track ---------------------- */
@@ -6109,6 +6169,12 @@ static PyObject *MovieObj_getattr(self, name)
61096169

61106170
#define MovieObj_setattr NULL
61116171

6172+
#define MovieObj_compare NULL
6173+
6174+
#define MovieObj_repr NULL
6175+
6176+
#define MovieObj_hash NULL
6177+
61126178
PyTypeObject Movie_Type = {
61136179
PyObject_HEAD_INIT(&PyType_Type)
61146180
0, /*ob_size*/
@@ -6120,6 +6186,12 @@ PyTypeObject Movie_Type = {
61206186
0, /*tp_print*/
61216187
(getattrfunc) MovieObj_getattr, /*tp_getattr*/
61226188
(setattrfunc) MovieObj_setattr, /*tp_setattr*/
6189+
(cmpfunc) MovieObj_compare, /*tp_compare*/
6190+
(reprfunc) MovieObj_repr, /*tp_repr*/
6191+
(PyNumberMethods *)0, /* tp_as_number */
6192+
(PySequenceMethods *)0, /* tp_as_sequence */
6193+
(PyMappingMethods *)0, /* tp_as_mapping */
6194+
(hashfunc) MovieObj_hash, /*tp_hash*/
61236195
};
61246196

61256197
/* --------------------- End object type Movie ---------------------- */
@@ -7666,6 +7738,21 @@ static PyObject *Qt_MoviesTask(_self, _args)
76667738
return _res;
76677739
}
76687740

7741+
static PyObject *Qt_available(_self, _args)
7742+
PyObject *_self;
7743+
PyObject *_args;
7744+
{
7745+
PyObject *_res = NULL;
7746+
7747+
void *ptr;
7748+
7749+
if ( !PyArg_ParseTuple(_args, "") )
7750+
return NULL;
7751+
ptr = (void *)&EnterMovies;
7752+
return Py_BuildValue("i", ((long)ptr != 0));
7753+
7754+
}
7755+
76697756
static PyMethodDef Qt_methods[] = {
76707757
{"EnterMovies", (PyCFunction)Qt_EnterMovies, 1,
76717758
"() -> None"},
@@ -7805,6 +7892,8 @@ static PyMethodDef Qt_methods[] = {
78057892
"(WindowPtr wp, Point startPt, Rect boundsRect) -> None"},
78067893
{"MoviesTask", (PyCFunction)Qt_MoviesTask, 1,
78077894
"(long maxMilliSecToUse) -> None"},
7895+
{"available", (PyCFunction)Qt_available, 1,
7896+
"Return true if Quicktime is available"},
78087897
{NULL, NULL, 0}
78097898
};
78107899

Mac/Modules/qt/qtsupport.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,21 @@ def outputFreeIt(self, itselfname):
253253
)
254254
functions.append(f)
255255

256+
# Add manual routines for testing quicktime availability
257+
available_body = """
258+
void *ptr;
259+
260+
if ( !PyArg_ParseTuple(_args, "") )
261+
return NULL;
262+
ptr = (void *)&EnterMovies;
263+
return Py_BuildValue("i", ((long)ptr != 0));
264+
"""
265+
266+
f = ManualGenerator("available", available_body)
267+
f.docstring = lambda : "Return true if Quicktime is available"
268+
269+
functions.append(f)
270+
256271

257272
# add the populated lists to the generator groups
258273
# (in a different wordl the scan program would generate this)

0 commit comments

Comments
 (0)