コード例 #1
0
 def __init__(self, **kwargs):
     # auxiliary string for debugging output
     self.pre = self.__class__.__name__ + " : "
     # checks kwargs agains parameter_defs, attach ok'd parameters to this
     # object as attributes
     parameterInitCheck(ValkkaFSWriterThread.parameter_defs, kwargs, self)
     self.core = core.ValkkaFSWriterThread(self.name, self.valkkafs)
     self.core.setAffinity(self.affinity)
     self.input_filter = self.core.getFrameFilter()
     self.active = True
     self.core.startCall()
コード例 #2
0
    def __init__(self, valkkafs: ValkkaFS, write=True, read=True, cache=True):
        """ValkkaFSReaderThread --> FileCacheThread
        """
        self.pre = __name__ + "." + self.__class__.__name__
        self.logger = getLogger(self.pre)
        setLogger(self.pre, logging.DEBUG)
        # self.logger.setLevel(logging.INFO)
        # self.logger.setLevel(logging.WARNING)

        self.valkkafs = valkkafs

        self.timecallback = None
        self.timelimitscallback = None

        self.timerange = (
        )  # filesystem timerange.  empty tuple implies no frames

        self.readBlockTable()

        self.cacherthread = core.FileCacheThread("cacher")
        self.readerthread = core.ValkkaFSReaderThread(
            "reader", self.valkkafs.core, self.cacherthread.getFrameFilter())
        self.writerthread = core.ValkkaFSWriterThread("writer",
                                                      self.valkkafs.core)

        self.currentmstime = None  # None means there's no reference point (no seek has succeeded so far)
        self.current_blocks = []
        self.current_timerange = (0, 0)  # time limits of current blocks

        # callback coming from cpp, informing about the current time
        self.cacherthread.setPyCallback(self.timeCallback__)
        self.cacherthread.setPyCallback2(self.timeLimitsCallback__)

        # use these for debugging
        if cache:
            self.cacherthread.startCall()
        if read:
            self.readerthread.startCall()
        if write:
            self.writerthread.startCall()

        self.active = True
        self.playing = False