/usr/lib/python2.7/dist-packages/xcffib/xvmc.py is in python-xcffib 0.3.6-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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 1
key = xcffib.ExtensionKey("XVideo-MotionCompensation")
_events = {}
_errors = {}
from . import xv
class SurfaceInfo(xcffib.Struct):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Struct.__init__(self, unpacker)
base = unpacker.offset
self.id, self.chroma_format, self.pad0, self.max_width, self.max_height, self.subpicture_max_width, self.subpicture_max_height, self.mc_type, self.flags = unpacker.unpack("IHHHHHHII")
self.bufsize = unpacker.offset - base
def pack(self):
buf = six.BytesIO()
buf.write(struct.pack("=IHHHHHHII", self.id, self.chroma_format, self.pad0, self.max_width, self.max_height, self.subpicture_max_width, self.subpicture_max_height, self.mc_type, self.flags))
return buf.getvalue()
fixed_size = 24
class QueryVersionReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
self.major, self.minor = unpacker.unpack("xx2x4xII")
self.bufsize = unpacker.offset - base
class QueryVersionCookie(xcffib.Cookie):
reply_type = QueryVersionReply
class ListSurfaceTypesReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
self.num, = unpacker.unpack("xx2x4xI20x")
self.surfaces = xcffib.List(unpacker, SurfaceInfo, self.num)
self.bufsize = unpacker.offset - base
class ListSurfaceTypesCookie(xcffib.Cookie):
reply_type = ListSurfaceTypesReply
class CreateContextReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
self.width_actual, self.height_actual, self.flags_return = unpacker.unpack("xx2x4xHHI20x")
self.priv_data = xcffib.List(unpacker, "I", self.length)
self.bufsize = unpacker.offset - base
class CreateContextCookie(xcffib.Cookie):
reply_type = CreateContextReply
class CreateSurfaceReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
unpacker.unpack("xx2x4x24x")
self.priv_data = xcffib.List(unpacker, "I", self.length)
self.bufsize = unpacker.offset - base
class CreateSurfaceCookie(xcffib.Cookie):
reply_type = CreateSurfaceReply
class CreateSubpictureReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
self.width_actual, self.height_actual, self.num_palette_entries, self.entry_bytes = unpacker.unpack("xx2x4xHHHH")
self.component_order = xcffib.List(unpacker, "B", 4)
unpacker.unpack("12x")
unpacker.pad("I")
self.priv_data = xcffib.List(unpacker, "I", self.length)
self.bufsize = unpacker.offset - base
class CreateSubpictureCookie(xcffib.Cookie):
reply_type = CreateSubpictureReply
class ListSubpictureTypesReply(xcffib.Reply):
def __init__(self, unpacker):
if isinstance(unpacker, xcffib.Protobj):
unpacker = xcffib.MemoryUnpacker(unpacker.pack())
xcffib.Reply.__init__(self, unpacker)
base = unpacker.offset
self.num, = unpacker.unpack("xx2x4xI20x")
self.types = xcffib.List(unpacker, xv.ImageFormatInfo, self.num)
self.bufsize = unpacker.offset - base
class ListSubpictureTypesCookie(xcffib.Cookie):
reply_type = ListSubpictureTypesReply
class xvmcExtension(xcffib.Extension):
def QueryVersion(self, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2x"))
return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked)
def ListSurfaceTypes(self, port_id, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", port_id))
return self.send_request(1, buf, ListSurfaceTypesCookie, is_checked=is_checked)
def CreateContext(self, context_id, port_id, surface_id, width, height, flags, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIIIHHI", context_id, port_id, surface_id, width, height, flags))
return self.send_request(2, buf, CreateContextCookie, is_checked=is_checked)
def DestroyContext(self, context_id, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", context_id))
return self.send_request(3, buf, is_checked=is_checked)
def CreateSurface(self, surface_id, context_id, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", surface_id, context_id))
return self.send_request(4, buf, CreateSurfaceCookie, is_checked=is_checked)
def DestroySurface(self, surface_id, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", surface_id))
return self.send_request(5, buf, is_checked=is_checked)
def CreateSubpicture(self, subpicture_id, context, xvimage_id, width, height, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xIIIHH", subpicture_id, context, xvimage_id, width, height))
return self.send_request(6, buf, CreateSubpictureCookie, is_checked=is_checked)
def DestroySubpicture(self, subpicture_id, is_checked=False):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xI", subpicture_id))
return self.send_request(7, buf, is_checked=is_checked)
def ListSubpictureTypes(self, port_id, surface_id, is_checked=True):
buf = six.BytesIO()
buf.write(struct.pack("=xx2xII", port_id, surface_id))
return self.send_request(8, buf, ListSubpictureTypesCookie, is_checked=is_checked)
xcffib._add_ext(key, xvmcExtension, _events, _errors)
|