/usr/share/pyshared/Photon/Video.py is in photon 0.4.6-3.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 | """This small library load and identify some image format """
from Photon import QuickTime, AVI
from random import randrange
class Video:
format = None
size = (0,0)
mode = None
plugin = None
moviefile = None
privatedata = None
def __init__(self):
pass
def get_random_frame(self, pictfile):
frame = randrange(0, self.frames)
if self.plugin == 'QuickTime':
return QuickTime.extract_jpeg_file(self.moviefile,
self.privatedata,
pictfile,
frame)
elif self.plugin == 'AVI':
return AVI.extract_jpeg_file(self.moviefile,
self.privatedata,
pictfile,
frame)
else:
return None
def get_frame(self, pictfile, frame):
if self.plugin == 'QuickTime':
return QuickTime.extract_jpeg_file(self.moviefile,
self.privatedata,
pictfile,
frame)
elif self.plugin == 'AVI':
return AVI.extract_jpeg_file(self.moviefile,
self.privatedata,
pictfile,
frame)
else:
return None
def identify(filename):
info = AVI.identify(filename)
if info <> None:
video = Video()
video.privatedata = info
video.format = 'AVI (%s)' % info['format']
video.size = info['video_size']
video.frames = info['frames']
video.plugin = 'AVI'
video.moviefile = filename
return video
info = QuickTime.identify(filename)
if info <> None:
video = Video()
video.privatedata = info
video.format = 'QuickTime (%c%c%c%c)' % (((info['format']>>24)&255),((info['format']>>16)&255),((info['format']>>8)&255),((info['format'])&255))
video.size = (info['width'] , info['height'])
video.frames = info['frames']
video.plugin = 'QuickTime'
video.moviefile = filename
return video
raise IOError("Format not recognized")
if __name__ == "__main__":
import sys
import Video
if len(sys.argv) < 2:
print 'Usage: %s files...\n' % sys.argv[0]
sys.exit(0)
for filename in sys.argv[1:]:
im=Video.open(filename)
if im != None:
print "%s (format=%s size <%dx%d> mode=%s)" % (filename,im.format,im.size[0],im.size[1])
else:
print "%s is not recognized" % filename
|