/usr/share/pyshared/VisionEgg/QuickTime.py is in python-visionegg 1.2.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | # The Vision Egg: QuickTime
#
# Copyright (C) 2001-2003, 2006 Andrew Straw.
# Author: Andrew Straw <astraw@users.sourceforge.net>
# URL: <http://www.visionegg.org/>
#
# Distributed under the terms of the GNU Lesser General Public License
# (LGPL). See LICENSE.TXT that came with this file.
"""
QuickTime movies in the Vision Egg.
"""
import VisionEgg
import VisionEgg.gl_qt # C implementation of GL/QT interface
import VisionEgg.qtmovie as qtmovie
import VisionEgg.Textures
import numpy.oldnumeric as Numeric
import os
import VisionEgg.GL as gl # get all OpenGL stuff in one namespace
__version__ = VisionEgg.release_name
__author__ = 'Andrew Straw <astraw@users.sourceforge.net>'
#######################################################
new_movie_from_filename = qtmovie.new_movie_from_filename
class MovieTexture(VisionEgg.Textures.Texture):
__slots__ = (
'movie',
'size',
'scale',
'gl_qt_renderer',
)
def __init__(self,
movie=None,
texture_size=None, # be default will be big enough for full movie, otherwise 2-tuple
):
if not isinstance(movie,qtmovie.Movie):
if isinstance(movie,str) or isinstance(movie,unicode):
movie = new_movie_from_filename(filename=movie)
self.movie = movie
bounds = self.movie.GetMovieBox()
height = bounds.bottom-bounds.top
width = bounds.right-bounds.left
self.movie.SetMovieBox(qtmovie.Rect(top=0,left=0,bottom=height,right=width))
self.size = (width,height)
self.scale = 1.0
def make_half_size(self):
self.size = self.size[0]/2, self.size[1]/2
self.scale = self.scale/2
def unload(self):
raise NotImplementedError('')
def get_texels_as_image(self):
raise NotImplementedError('')
def load(self, texture_object,
build_mipmaps=False,
rescale_original_to_fill_texture_object = False,
internal_format=gl.GL_RGB,
):
if build_mipmaps:
raise ValueError('cannot build mipmaps for QuickTime movies')
if rescale_original_to_fill_texture_object:
raise NotImplementedError('')
width,height = self.size
tex_shape = VisionEgg.Textures.next_power_of_2(max(width,height))
# fractional coverage
self.buf_lf = 0.0
self.buf_rf = float(width)/tex_shape
self.buf_bf = 0.0
self.buf_tf = float(height)/tex_shape
# absolute (texel units) coverage
self._buf_l = 0
self._buf_r = width
self._buf_b = 0
self._buf_t = height
buffer = Numeric.zeros( (tex_shape,tex_shape), Numeric.UInt8 )
texture_object.put_new_image( buffer,
internal_format=gl.GL_RGB,
mipmap_level=0 )
self.texture_object = texture_object
self.gl_qt_renderer = VisionEgg.gl_qt.gl_qt_renderer_create(self.movie,tex_shape,self.scale)
def update(self):
# only call this when my texture unit is active
VisionEgg.gl_qt.gl_qt_renderer_update(self.gl_qt_renderer)
def __del__(self):
VisionEgg.gl_qt.gl_qt_renderer_delete(self.gl_qt_renderer)
|