1 """high level QuickTime Movie wrapper"""
2 import qtlowlevel
3 import ctypes
4
5 qtlowlevel.InitializeQTML(0)
6 qtlowlevel.EnterMovies()
7
9 """create a Movie from filename"""
10 movieProps = (qtlowlevel.QTNewMoviePropertyElement * 5)()
11 filename = unicode(filename)
12
13 movieFilePathRef = qtlowlevel.CFStringRef()
14 movieFilePathRef.value = qtlowlevel.CFStringCreateWithCharacters(qtlowlevel.kCFAllocatorDefault,
15 filename,
16 len(filename))
17
18 moviePropCount = 0
19
20 movieProps[moviePropCount].propClass = qtlowlevel.kQTPropertyClass_DataLocation
21 movieProps[moviePropCount].propID = qtlowlevel.kQTDataLocationPropertyID_CFStringWindowsPath
22 movieProps[moviePropCount].propValueSize = ctypes.sizeof(ctypes.c_void_p)
23 movieProps[moviePropCount].propValueAddress = ctypes.cast(ctypes.byref(movieFilePathRef),ctypes.c_void_p)
24 movieProps[moviePropCount].propStatus = 0
25
26 moviePropCount += 1
27
28 boolTrue = ctypes.c_ubyte(1)
29 movieProps[moviePropCount].propClass = qtlowlevel.kQTPropertyClass_MovieInstantiation
30 movieProps[moviePropCount].propID = qtlowlevel.kQTMovieInstantiationPropertyID_DontAskUnresolvedDataRefs
31 movieProps[moviePropCount].propValueSize = ctypes.sizeof(boolTrue)
32 movieProps[moviePropCount].propValueAddress = ctypes.cast(ctypes.pointer(boolTrue),ctypes.c_void_p)
33 movieProps[moviePropCount].propStatus = 0
34
35 moviePropCount += 1
36
37 movieProps[moviePropCount].propClass = qtlowlevel.kQTPropertyClass_NewMovieProperty
38 movieProps[moviePropCount].propID = qtlowlevel.kQTNewMoviePropertyID_Active
39 movieProps[moviePropCount].propValueSize = ctypes.sizeof(boolTrue)
40 movieProps[moviePropCount].propValueAddress = ctypes.cast(ctypes.pointer(boolTrue),ctypes.c_void_p)
41 movieProps[moviePropCount].propStatus = 0
42
43 moviePropCount += 1
44
45 movieProps[moviePropCount].propClass = qtlowlevel.kQTPropertyClass_NewMovieProperty
46 movieProps[moviePropCount].propID = qtlowlevel.kQTNewMoviePropertyID_DontInteractWithUser
47 movieProps[moviePropCount].propValueSize = ctypes.sizeof(boolTrue)
48 movieProps[moviePropCount].propValueAddress = ctypes.cast(ctypes.pointer(boolTrue),ctypes.c_void_p)
49 movieProps[moviePropCount].propStatus = 0
50
51 moviePropCount += 1
52
53 theMovie = qtlowlevel.Movie()
54 qtlowlevel.NewMovieFromProperties( moviePropCount, movieProps, 0, None, ctypes.byref(theMovie))
55 return Movie(theMovie)
56
58 - def __init__(self,top=0,left=0,bottom=0,right=0):
63
65 """An encapsulated QuickTime Movie"""
67 self.theMovie = theMovie
75
77 if not isinstance(bounds,Rect):
78 raise ValueError('bounds argument must be instance of VisionEgg.qtmovie.Rect')
79 b = qtlowlevel.Rect()
80 (b.top, b.left, b.bottom, b.right) = (bounds.top, bounds.left,
81 bounds.bottom, bounds.right)
82 qtlowlevel.SetMovieBox(self.theMovie, ctypes.byref(b))
85
88
91
94