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

Skip to content

Commit c59996e

Browse files
committed
Added a method GetMediaNextInterestingTimeOnly, which is like GetMediaNextInterestingTime without asking for the duration (which is, according to qt docs, expensive).
1 parent 1966004 commit c59996e

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

Mac/Modules/qt/Qtmodule.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ staticforward int MovieCtlObj_Convert(PyObject *, TimeBase *);
6464
staticforward PyObject *TimeBaseObj_New(TimeBase);
6565
staticforward int TimeBaseObj_Convert(PyObject *, TimeBase *);
6666

67+
/* Macro to allow us to GetNextInterestingTime without duration */
68+
#define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL)
69+
6770
/*
6871
** Parse/generate time records
6972
*/
@@ -2746,6 +2749,30 @@ static PyObject *MediaObj_GetMediaPlayHints(_self, _args)
27462749
return _res;
27472750
}
27482751

2752+
static PyObject *MediaObj_GetMediaNextInterestingTimeOnly(_self, _args)
2753+
MediaObject *_self;
2754+
PyObject *_args;
2755+
{
2756+
PyObject *_res = NULL;
2757+
short interestingTimeFlags;
2758+
TimeValue time;
2759+
Fixed rate;
2760+
TimeValue interestingTime;
2761+
if (!PyArg_ParseTuple(_args, "hlO&",
2762+
&interestingTimeFlags,
2763+
&time,
2764+
PyMac_GetFixed, &rate))
2765+
return NULL;
2766+
GetMediaNextInterestingTimeOnly(_self->ob_itself,
2767+
interestingTimeFlags,
2768+
time,
2769+
rate,
2770+
&interestingTime);
2771+
_res = Py_BuildValue("l",
2772+
interestingTime);
2773+
return _res;
2774+
}
2775+
27492776
static PyMethodDef MediaObj_methods[] = {
27502777
{"LoadMediaIntoRam", (PyCFunction)MediaObj_LoadMediaIntoRam, 1,
27512778
"(TimeValue time, TimeValue duration, long flags) -> None"},
@@ -2837,6 +2864,8 @@ static PyMethodDef MediaObj_methods[] = {
28372864
"(long flags, long flagsMask) -> None"},
28382865
{"GetMediaPlayHints", (PyCFunction)MediaObj_GetMediaPlayHints, 1,
28392866
"() -> (long flags)"},
2867+
{"GetMediaNextInterestingTimeOnly", (PyCFunction)MediaObj_GetMediaNextInterestingTimeOnly, 1,
2868+
"(short interestingTimeFlags, TimeValue time, Fixed rate) -> (TimeValue interestingTime)"},
28402869
{NULL, NULL, 0}
28412870
};
28422871

Mac/Modules/qt/qtsupport.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
staticforward PyObject *TimeBaseObj_New(TimeBase);
4747
staticforward int TimeBaseObj_Convert(PyObject *, TimeBase *);
4848
49+
/* Macro to allow us to GetNextInterestingTime without duration */
50+
#define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) \
51+
GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL)
52+
4953
/*
5054
** Parse/generate time records
5155
*/
@@ -261,6 +265,15 @@ def outputFreeIt(self, itselfname):
261265
)
262266
functions.append(f)
263267

268+
# And we want a GetMediaNextInterestingTime without duration
269+
f = Method(void, 'GetMediaNextInterestingTimeOnly',
270+
(Media, 'theMedia', InMode),
271+
(short, 'interestingTimeFlags', InMode),
272+
(TimeValue, 'time', InMode),
273+
(Fixed, 'rate', InMode),
274+
(TimeValue, 'interestingTime', OutMode),
275+
)
276+
Media_methods.append(f)
264277

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

0 commit comments

Comments
 (0)