python - acehippo/slowmotion GitHub Wiki

tips

  • ctypes
from ctypes import *

class fp_element_struct(Structure):
    _fields_ = [("fp_hash", c_int),
                ("time_index", c_int)]

class fp_array(Structure):
    _fields_ = [("fp_elements", POINTER(fp_element_struct)),
                ("length", c_int)]

class mrc():
    def __init__ (self, serverNum):
        """
         load libfp so library
        """
        self.libc = CDLL("./lib/libfpnative.so")
        self.generateFp = self.libc.generate_fp
        self.generateFp.restype = fp_array