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

Skip to content

Commit e0cf87b

Browse files
committed
Enabled resID input/output parameter to NewMovieFromFile. This changes
the Python interface, unfortunately. Added a few calls that were blacklisted for no apparent reason.
1 parent 3ccd2f1 commit e0cf87b

3 files changed

Lines changed: 192 additions & 13 deletions

File tree

Mac/Modules/qt/Qtmodule.c

Lines changed: 179 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,37 @@ static PyObject *MovieCtlObj_MCIsControllerAttached(_self, _args)
232232
return _res;
233233
}
234234

235+
static PyObject *MovieCtlObj_MCSetControllerPort(_self, _args)
236+
MovieControllerObject *_self;
237+
PyObject *_args;
238+
{
239+
PyObject *_res = NULL;
240+
ComponentResult _rv;
241+
CGrafPtr gp;
242+
if (!PyArg_ParseTuple(_args, "O&",
243+
GrafObj_Convert, &gp))
244+
return NULL;
245+
_rv = MCSetControllerPort(_self->ob_itself,
246+
gp);
247+
_res = Py_BuildValue("l",
248+
_rv);
249+
return _res;
250+
}
251+
252+
static PyObject *MovieCtlObj_MCGetControllerPort(_self, _args)
253+
MovieControllerObject *_self;
254+
PyObject *_args;
255+
{
256+
PyObject *_res = NULL;
257+
CGrafPtr _rv;
258+
if (!PyArg_ParseTuple(_args, ""))
259+
return NULL;
260+
_rv = MCGetControllerPort(_self->ob_itself);
261+
_res = Py_BuildValue("O&",
262+
GrafObj_New, _rv);
263+
return _res;
264+
}
265+
235266
static PyObject *MovieCtlObj_MCSetVisible(_self, _args)
236267
MovieControllerObject *_self;
237268
PyObject *_args;
@@ -761,6 +792,10 @@ static PyMethodDef MovieCtlObj_methods[] = {
761792
"(Boolean attach) -> (ComponentResult _rv)"},
762793
{"MCIsControllerAttached", (PyCFunction)MovieCtlObj_MCIsControllerAttached, 1,
763794
"() -> (ComponentResult _rv)"},
795+
{"MCSetControllerPort", (PyCFunction)MovieCtlObj_MCSetControllerPort, 1,
796+
"(CGrafPtr gp) -> (ComponentResult _rv)"},
797+
{"MCGetControllerPort", (PyCFunction)MovieCtlObj_MCGetControllerPort, 1,
798+
"() -> (CGrafPtr _rv)"},
764799
{"MCSetVisible", (PyCFunction)MovieCtlObj_MCSetVisible, 1,
765800
"(Boolean visible) -> (ComponentResult _rv)"},
766801
{"MCGetVisible", (PyCFunction)MovieCtlObj_MCGetVisible, 1,
@@ -1432,6 +1467,34 @@ static PyObject *MediaObj_GetMediaTrack(_self, _args)
14321467
return _res;
14331468
}
14341469

1470+
static PyObject *MediaObj_GetMediaCreationTime(_self, _args)
1471+
MediaObject *_self;
1472+
PyObject *_args;
1473+
{
1474+
PyObject *_res = NULL;
1475+
unsigned long _rv;
1476+
if (!PyArg_ParseTuple(_args, ""))
1477+
return NULL;
1478+
_rv = GetMediaCreationTime(_self->ob_itself);
1479+
_res = Py_BuildValue("l",
1480+
_rv);
1481+
return _res;
1482+
}
1483+
1484+
static PyObject *MediaObj_GetMediaModificationTime(_self, _args)
1485+
MediaObject *_self;
1486+
PyObject *_args;
1487+
{
1488+
PyObject *_res = NULL;
1489+
unsigned long _rv;
1490+
if (!PyArg_ParseTuple(_args, ""))
1491+
return NULL;
1492+
_rv = GetMediaModificationTime(_self->ob_itself);
1493+
_res = Py_BuildValue("l",
1494+
_rv);
1495+
return _res;
1496+
}
1497+
14351498
static PyObject *MediaObj_GetMediaTimeScale(_self, _args)
14361499
MediaObject *_self;
14371500
PyObject *_args;
@@ -2248,6 +2311,10 @@ static PyMethodDef MediaObj_methods[] = {
22482311
"(TimeValue time, TimeValue duration, long flags) -> None"},
22492312
{"GetMediaTrack", (PyCFunction)MediaObj_GetMediaTrack, 1,
22502313
"() -> (Track _rv)"},
2314+
{"GetMediaCreationTime", (PyCFunction)MediaObj_GetMediaCreationTime, 1,
2315+
"() -> (unsigned long _rv)"},
2316+
{"GetMediaModificationTime", (PyCFunction)MediaObj_GetMediaModificationTime, 1,
2317+
"() -> (unsigned long _rv)"},
22512318
{"GetMediaTimeScale", (PyCFunction)MediaObj_GetMediaTimeScale, 1,
22522319
"() -> (TimeScale _rv)"},
22532320
{"SetMediaTimeScale", (PyCFunction)MediaObj_SetMediaTimeScale, 1,
@@ -2571,6 +2638,34 @@ static PyObject *TrackObj_GetTrackMovie(_self, _args)
25712638
return _res;
25722639
}
25732640

2641+
static PyObject *TrackObj_GetTrackCreationTime(_self, _args)
2642+
TrackObject *_self;
2643+
PyObject *_args;
2644+
{
2645+
PyObject *_res = NULL;
2646+
unsigned long _rv;
2647+
if (!PyArg_ParseTuple(_args, ""))
2648+
return NULL;
2649+
_rv = GetTrackCreationTime(_self->ob_itself);
2650+
_res = Py_BuildValue("l",
2651+
_rv);
2652+
return _res;
2653+
}
2654+
2655+
static PyObject *TrackObj_GetTrackModificationTime(_self, _args)
2656+
TrackObject *_self;
2657+
PyObject *_args;
2658+
{
2659+
PyObject *_res = NULL;
2660+
unsigned long _rv;
2661+
if (!PyArg_ParseTuple(_args, ""))
2662+
return NULL;
2663+
_rv = GetTrackModificationTime(_self->ob_itself);
2664+
_res = Py_BuildValue("l",
2665+
_rv);
2666+
return _res;
2667+
}
2668+
25742669
static PyObject *TrackObj_GetTrackEnabled(_self, _args)
25752670
TrackObject *_self;
25762671
PyObject *_args;
@@ -3343,6 +3438,10 @@ static PyMethodDef TrackObj_methods[] = {
33433438
"() -> (long _rv)"},
33443439
{"GetTrackMovie", (PyCFunction)TrackObj_GetTrackMovie, 1,
33453440
"() -> (Movie _rv)"},
3441+
{"GetTrackCreationTime", (PyCFunction)TrackObj_GetTrackCreationTime, 1,
3442+
"() -> (unsigned long _rv)"},
3443+
{"GetTrackModificationTime", (PyCFunction)TrackObj_GetTrackModificationTime, 1,
3444+
"() -> (unsigned long _rv)"},
33463445
{"GetTrackEnabled", (PyCFunction)TrackObj_GetTrackEnabled, 1,
33473446
"() -> (Boolean _rv)"},
33483447
{"SetTrackEnabled", (PyCFunction)TrackObj_SetTrackEnabled, 1,
@@ -3711,6 +3810,43 @@ static PyObject *MovieObj_GetMovieTimeBase(_self, _args)
37113810
return _res;
37123811
}
37133812

3813+
static PyObject *MovieObj_GetMovieGWorld(_self, _args)
3814+
MovieObject *_self;
3815+
PyObject *_args;
3816+
{
3817+
PyObject *_res = NULL;
3818+
CGrafPtr port;
3819+
GDHandle gdh;
3820+
if (!PyArg_ParseTuple(_args, ""))
3821+
return NULL;
3822+
GetMovieGWorld(_self->ob_itself,
3823+
&port,
3824+
&gdh);
3825+
_res = Py_BuildValue("O&O&",
3826+
GrafObj_New, port,
3827+
ResObj_New, gdh);
3828+
return _res;
3829+
}
3830+
3831+
static PyObject *MovieObj_SetMovieGWorld(_self, _args)
3832+
MovieObject *_self;
3833+
PyObject *_args;
3834+
{
3835+
PyObject *_res = NULL;
3836+
CGrafPtr port;
3837+
GDHandle gdh;
3838+
if (!PyArg_ParseTuple(_args, "O&O&",
3839+
GrafObj_Convert, &port,
3840+
ResObj_Convert, &gdh))
3841+
return NULL;
3842+
SetMovieGWorld(_self->ob_itself,
3843+
port,
3844+
gdh);
3845+
Py_INCREF(Py_None);
3846+
_res = Py_None;
3847+
return _res;
3848+
}
3849+
37143850
static PyObject *MovieObj_GetNextTrackForCompositing(_self, _args)
37153851
MovieObject *_self;
37163852
PyObject *_args;
@@ -3952,6 +4088,34 @@ static PyObject *MovieObj_PutMovieIntoDataFork(_self, _args)
39524088
return _res;
39534089
}
39544090

4091+
static PyObject *MovieObj_GetMovieCreationTime(_self, _args)
4092+
MovieObject *_self;
4093+
PyObject *_args;
4094+
{
4095+
PyObject *_res = NULL;
4096+
unsigned long _rv;
4097+
if (!PyArg_ParseTuple(_args, ""))
4098+
return NULL;
4099+
_rv = GetMovieCreationTime(_self->ob_itself);
4100+
_res = Py_BuildValue("l",
4101+
_rv);
4102+
return _res;
4103+
}
4104+
4105+
static PyObject *MovieObj_GetMovieModificationTime(_self, _args)
4106+
MovieObject *_self;
4107+
PyObject *_args;
4108+
{
4109+
PyObject *_res = NULL;
4110+
unsigned long _rv;
4111+
if (!PyArg_ParseTuple(_args, ""))
4112+
return NULL;
4113+
_rv = GetMovieModificationTime(_self->ob_itself);
4114+
_res = Py_BuildValue("l",
4115+
_rv);
4116+
return _res;
4117+
}
4118+
39554119
static PyObject *MovieObj_GetMovieTimeScale(_self, _args)
39564120
MovieObject *_self;
39574121
PyObject *_args;
@@ -5152,6 +5316,10 @@ static PyMethodDef MovieObj_methods[] = {
51525316
"() -> None"},
51535317
{"GetMovieTimeBase", (PyCFunction)MovieObj_GetMovieTimeBase, 1,
51545318
"() -> (TimeBase _rv)"},
5319+
{"GetMovieGWorld", (PyCFunction)MovieObj_GetMovieGWorld, 1,
5320+
"() -> (CGrafPtr port, GDHandle gdh)"},
5321+
{"SetMovieGWorld", (PyCFunction)MovieObj_SetMovieGWorld, 1,
5322+
"(CGrafPtr port, GDHandle gdh) -> None"},
51555323
{"GetNextTrackForCompositing", (PyCFunction)MovieObj_GetNextTrackForCompositing, 1,
51565324
"(Track theTrack) -> (Track _rv)"},
51575325
{"GetPrevTrackForCompositing", (PyCFunction)MovieObj_GetPrevTrackForCompositing, 1,
@@ -5182,6 +5350,10 @@ static PyMethodDef MovieObj_methods[] = {
51825350
"(Handle publicMovie) -> None"},
51835351
{"PutMovieIntoDataFork", (PyCFunction)MovieObj_PutMovieIntoDataFork, 1,
51845352
"(short fRefNum, long offset, long maxSize) -> None"},
5353+
{"GetMovieCreationTime", (PyCFunction)MovieObj_GetMovieCreationTime, 1,
5354+
"() -> (unsigned long _rv)"},
5355+
{"GetMovieModificationTime", (PyCFunction)MovieObj_GetMovieModificationTime, 1,
5356+
"() -> (unsigned long _rv)"},
51855357
{"GetMovieTimeScale", (PyCFunction)MovieObj_GetMovieTimeScale, 1,
51865358
"() -> (TimeScale _rv)"},
51875359
{"SetMovieTimeScale", (PyCFunction)MovieObj_SetMovieTimeScale, 1,
@@ -5638,21 +5810,24 @@ static PyObject *Qt_NewMovieFromFile(_self, _args)
56385810
OSErr _err;
56395811
Movie theMovie;
56405812
short resRefNum;
5813+
short resId;
56415814
short newMovieFlags;
56425815
Boolean dataRefWasChanged;
5643-
if (!PyArg_ParseTuple(_args, "hh",
5816+
if (!PyArg_ParseTuple(_args, "hhh",
56445817
&resRefNum,
5818+
&resId,
56455819
&newMovieFlags))
56465820
return NULL;
56475821
_err = NewMovieFromFile(&theMovie,
56485822
resRefNum,
5649-
(short *)0,
5823+
&resId,
56505824
(StringPtr)0,
56515825
newMovieFlags,
56525826
&dataRefWasChanged);
56535827
if (_err != noErr) return PyMac_Error(_err);
5654-
_res = Py_BuildValue("O&b",
5828+
_res = Py_BuildValue("O&hb",
56555829
MovieObj_New, theMovie,
5830+
resId,
56565831
dataRefWasChanged);
56575832
return _res;
56585833
}
@@ -5837,7 +6012,7 @@ static PyMethodDef Qt_methods[] = {
58376012
{"DeleteMovieFile", (PyCFunction)Qt_DeleteMovieFile, 1,
58386013
"(FSSpec fileSpec) -> None"},
58396014
{"NewMovieFromFile", (PyCFunction)Qt_NewMovieFromFile, 1,
5840-
"(short resRefNum, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)"},
6015+
"(short resRefNum, short resId, short newMovieFlags) -> (Movie theMovie, short resId, Boolean dataRefWasChanged)"},
58416016
{"NewMovieFromHandle", (PyCFunction)Qt_NewMovieFromHandle, 1,
58426017
"(Handle h, short newMovieFlags) -> (Movie theMovie, Boolean dataRefWasChanged)"},
58436018
{"NewMovieFromDataFork", (PyCFunction)Qt_NewMovieFromDataFork, 1,

Mac/Modules/qt/qtscan.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,18 @@ def makeblacklistnames(self):
4040
"DisposeUserData", # ditto
4141
"DisposeTimeBase", # ditto
4242
"DisposeMovieController", # ditto
43-
"GetMovieCreationTime", # type "unsigned long" in C, inparseable
44-
"GetMovieModificationTime", # Ditto
45-
"GetTrackCreationTime", # ditto
46-
"GetTrackModificationTime", # Ditto
47-
"GetMediaCreationTime", # ditto
48-
"GetMediaModificationTime", # Ditto
43+
# "GetMovieCreationTime", # type "unsigned long" in C, inparseable
44+
# "GetMovieModificationTime", # Ditto
45+
# "GetTrackCreationTime", # ditto
46+
# "GetTrackModificationTime", # Ditto
47+
# "GetMediaCreationTime", # ditto
48+
# "GetMediaModificationTime", # Ditto
4949
# The following 4 use 'void *' in an uncontrolled way
5050
# TBD when I've read the manual...
5151
"GetUserDataItem",
5252
"SetUserDataItem",
5353
"SetTextSampleData",
54+
"BeginFullScreen",
5455
# bgen gets the argument in/out wrong..
5556
"AddTextSample",
5657
"AddTESample",
@@ -105,8 +106,8 @@ def makeblacklisttypes(self):
105106
# "TextDescription",
106107
# "MusicDescription",
107108
# I dont know yet how to do these.
108-
"CGrafPtr",
109-
"GDHandle",
109+
# "CGrafPtr",
110+
# "GDHandle",
110111
# Routine pointers, not yet.
111112
"MoviesErrorUPP",
112113
"MoviePreviewCallOutUPP",
@@ -119,6 +120,7 @@ def makeblacklisttypes(self):
119120
"MCActionFilterWithRefConUPP",
120121
"GetMovieUPP",
121122
"ModalFilterUPP",
123+
"TrackTransferUPP",
122124
"QTAtomContainer",
123125
"SpriteWorld",
124126
"Sprite",
@@ -134,7 +136,7 @@ def makerepairinstructions(self):
134136

135137
# NewMovieFromFile
136138
([('short', 'resId', 'OutMode'), ('StringPtr', 'resName', 'InMode')],
137-
[('dummyshortptr', 'resId', 'InMode'), ('dummyStringPtr', 'resName', 'InMode')]),
139+
[('short', 'resId', 'InOutMode'), ('dummyStringPtr', 'resName', 'InMode')]),
138140

139141
# MCDoAction and more
140142
([('void', '*', 'OutMode')], [('mcactionparams', '*', 'InMode')]),

Mac/Modules/qt/qtsupport.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
SampleDescriptionHandle = OpaqueByValueType("SampleDescriptionHandle", "ResObj")
7272
ImageDescriptionHandle = OpaqueByValueType("ImageDescriptionHandle", "ResObj")
7373
TEHandle = OpaqueByValueType("TEHandle", "ResObj")
74+
CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
75+
GDHandle = OpaqueByValueType("GDHandle", "ResObj")
7476
# Silly Apple, passing an OStype by reference...
7577
OSType_ptr = OpaqueType("OSType", "PyMac_BuildOSType", "PyMac_GetOSType")
7678

0 commit comments

Comments
 (0)