def convert(self, input, dstdir, filename, profilenum=20): if self._writing: return file = os.path.splitext(filename)[0] + '.wmv' output = os.path.join(dstdir, file) self._writer = self.createWMWriter(profilenum) self._writer.SetOutputFilename(output) self.findPins(self._writer) self._videopeer = dshow.CreatePyRenderingListener(self) self._audiofilter = Filter(self, self._writer, self._audiopinix, self._audiopinprops) self._audiopeer = dshow.CreatePyRenderingListener(self._audiofilter) # this call will set indirectly self._writer format fg = self.createFilterGraph(input) if not fg: return None mc = fg.QueryIMediaControl() mc.Run() import win32ui while fg.WaitForCompletion(0) == 0: win32ui.PumpWaitingMessages() mc.Stop() win32ui.PumpWaitingMessages() return output
def __init__(self, exporter, dds, profile=20): self._exporter = exporter self._dds = dds self._writer = None self._filename = None self._sample = None self._lasttm = 0 self._writing = 0 if not wmfapi: return profman = wmfapi.CreateProfileManager() prof = profman.LoadSystemProfile(profile) writer = wmfapi.CreateDDWriter(prof) wmtype = wmfapi.CreateDDVideoWMType(self._dds) writer.SetVideoFormat(wmtype) self._writer = writer self._audiopeer = dshow.CreatePyRenderingListener(self)
def __init__(self, writer, url): self._audiopeer = dshow.CreatePyRenderingListener(self) self._writer = writer # this call will set indirectly self._writer format fg = self.__createFilterGraph(url)