def test_createSourceNodeFromExternalSourceWithDownStreamConnection(self): sourceControl = captureManager.createSourceControl() mediaSource = self.test_createSource() sinkControl = captureManager.createSinkControl() XMLstring = sinkControl.getCollectionOfSinks() root = ElementTree.fromstring(XMLstring) sinkFactories = ElementPath.findall(root, "SinkFactory") fileSinkFactoreGUID = '' asfContainerGUID = '' for sinkFactory in sinkFactories: if (sinkFactory.get('GUID') == '{D6E342E3-7DDD-4858-AB91-4253643864C2}'): fileSinkFactoreGUID = '{D6E342E3-7DDD-4858-AB91-4253643864C2}' for valuePart in ElementPath.findall( sinkFactory, 'Value.ValueParts/ValuePart'): if (valuePart.get('GUID') == '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}'): asfContainerGUID = '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}' fileSinkFactory = SinkFactories.FileSinkFactory( sinkControl.createSinkFactory(asfContainerGUID, fileSinkFactoreGUID)) indexOfStream = 0 indexOfMediaType = 2 outputMediaType = sourceControl.getSourceOutputMediaTypeFromMediaSource( mediaSource, indexOfStream, indexOfMediaType) aArrayPtrCompressedMediaTypes = [] aArrayPtrCompressedMediaTypes.append(outputMediaType) outputNodes = fileSinkFactory.createOutputNodes( aArrayPtrCompressedMediaTypes, 'test.asf') sourceNode = sourceControl.createSourceNodeFromExternalSourceWithDownStreamConnection( mediaSource, indexOfStream, indexOfMediaType, outputNodes[0])
def startCaptureSession(self): XMLstring = self.sinkControl.getCollectionOfSinks() root = ElementTree.fromstring(XMLstring) sinkFactories = ElementPath.findall(root, "SinkFactory") EVRSinkFactoreGUID = '' defaultContainerGUID = '' for sinkFactory in sinkFactories: if (sinkFactory.get('GUID') == '{2F34AF87-D349-45AA-A5F1-E4104D5C458E}'): EVRSinkFactoreGUID = '{2F34AF87-D349-45AA-A5F1-E4104D5C458E}' for valuePart in ElementPath.findall( sinkFactory, 'Value.ValueParts/ValuePart'): if (valuePart.get('GUID') == '{71FBA544-3A8E-4D6C-B322-98184BC8DCEA}'): defaultContainerGUID = '{71FBA544-3A8E-4D6C-B322-98184BC8DCEA}' EVRSinkFactory = SinkFactories.EVRSinkFactory( self.sinkControl.createSinkFactory(defaultContainerGUID, EVRSinkFactoreGUID)) indexOfStream = 0 indexOfMediaType = int(self.prevSelectedMediaTypeIndex) outputNode = EVRSinkFactory.createOutputNode(self.frame.winfo_id()) sourceNode = self.sourceControl.createSourceNodeWithDownStreamConnection( self.symbolicLink, indexOfStream, indexOfMediaType, outputNode) sources = [] sources.append(sourceNode) self.session = self.sessionControl.createSession(sources) self.session.startSession(0, '{00000000-0000-0000-0000-000000000000}') self.controlBtnbox.subwidget('start').config(state='disabled') self.controlBtnbox.subwidget('stop').config(state='normal') self.controlBtnbox.subwidget('options').config(state='normal')
def initSession(self): if (self.session == None): fileSinkFactoreGUID = '{D6E342E3-7DDD-4858-AB91-4253643864C2}' fileSinkFactory = SinkFactories.FileSinkFactory( self.sinkControl.createSinkFactory( self.outputContainerTypeGUID, fileSinkFactoreGUID)) selectedMediaTypeIndex = self.mediaTypeComboBox.subwidget_list[ 'slistbox'].subwidget_list['listbox'].curselection() inputMediaType = self.sourceControl.getSourceOutputMediaType( self.symbolicLink, 0, int(selectedMediaTypeIndex[0])) encoderNodeFactory = self.encoderControl.createEncoderNodeFactory( self.encoderCLSID) encoderModeGUID = self.encoderModeGUIDlist[int( self.encoderModeComboBox.subwidget_list['slistbox']. subwidget_list['listbox'].curselection()[0])] compressedMediaTypeIndex = int( self.encoderOutputMediaTypeComboBox.subwidget_list['slistbox']. subwidget_list['listbox'].curselection()[0]) compressedMediaType = encoderNodeFactory.createCompressedMediaType( inputMediaType, encoderModeGUID, 80, compressedMediaTypeIndex) arrayPtrCompressedMediaTypes = [] arrayPtrCompressedMediaTypes.append(compressedMediaType) outputNode = fileSinkFactory.createOutputNodes( arrayPtrCompressedMediaTypes, self.filePath) encoderNode = encoderNodeFactory.createEncoderNode( inputMediaType, encoderModeGUID, 80, compressedMediaTypeIndex, outputNode[0]) sourceNode = self.sourceControl.createSourceNodeWithDownStreamConnection( self.symbolicLink, 0, int(selectedMediaTypeIndex[0]), encoderNode) sources = [] sources.append(sourceNode) self.session = self.sessionControl.createSession(sources) self.session.startSession( 0, '{00000000-0000-0000-0000-000000000000}') self.sessionBtn.config(text='stop') else: self.session.stopSession() self.session.closeSession()
def test_createSourceNodeWithDownStreamConnection(self): sourceControl = captureManager.createSourceControl() XMLstring = sourceControl.getCollectionOfSources() selfSources = ElementTree.fromstring(XMLstring) sources = ElementPath.findall(selfSources, "Source") symboliclink = '' for source in sources: state = False for attributes in ElementPath.findall(source, "Source.Attributes"): for attribute in ElementPath.findall(attributes, "Attribute"): if (attribute.get( 'Name' ) == 'MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK' ): symboliclink = attribute.find('SingleValue').get( 'Value') sinkControl = captureManager.createSinkControl() XMLstring = sinkControl.getCollectionOfSinks() root = ElementTree.fromstring(XMLstring) sinkFactories = ElementPath.findall(root, "SinkFactory") fileSinkFactoreGUID = '' asfContainerGUID = '' for sinkFactory in sinkFactories: if (sinkFactory.get('GUID') == '{D6E342E3-7DDD-4858-AB91-4253643864C2}'): fileSinkFactoreGUID = '{D6E342E3-7DDD-4858-AB91-4253643864C2}' for valuePart in ElementPath.findall( sinkFactory, 'Value.ValueParts/ValuePart'): if (valuePart.get('GUID') == '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}'): asfContainerGUID = '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}' fileSinkFactory = SinkFactories.FileSinkFactory( sinkControl.createSinkFactory(asfContainerGUID, fileSinkFactoreGUID)) indexOfStream = 0 indexOfMediaType = 2 outputMediaType = sourceControl.getSourceOutputMediaType( symboliclink, indexOfStream, indexOfMediaType) aArrayPtrCompressedMediaTypes = [] aArrayPtrCompressedMediaTypes.append(outputMediaType) outputNodes = fileSinkFactory.createOutputNodes( aArrayPtrCompressedMediaTypes, 'test.asf') sourceNode = sourceControl.createSourceNodeWithDownStreamConnection( symboliclink, indexOfStream, indexOfMediaType, outputNodes[0])
def test_createFileSinkFactory(self): sinkControl = captureManager.createSinkControl() XMLstring = sinkControl.getCollectionOfSinks() root = ElementTree.fromstring(XMLstring) sinkFactories = ElementPath.findall(root, "SinkFactory") fileSinkFactoreGUID = '' asfContainerGUID = '' for sinkFactory in sinkFactories: if (sinkFactory.get('GUID') == '{D6E342E3-7DDD-4858-AB91-4253643864C2}'): fileSinkFactoreGUID = '{D6E342E3-7DDD-4858-AB91-4253643864C2}' for valuePart in ElementPath.findall( sinkFactory, 'Value.ValueParts/ValuePart'): if (valuePart.get('GUID') == '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}'): asfContainerGUID = '{A2A56DA1-EB84-460E-9F05-FEE51D8C81E3}' fileSinkFactory = SinkFactories.FileSinkFactory( sinkControl.createSinkFactory(asfContainerGUID, fileSinkFactoreGUID)) return fileSinkFactory
def test_createSampleGrabberCallSinkFactory(self): sinkControl = captureManager.createSinkControl() XMLstring = sinkControl.getCollectionOfSinks() root = ElementTree.fromstring(XMLstring) sinkFactories = ElementPath.findall(root, "SinkFactory") SampleGrabberCallSinkFactoryGUID = '' defaultContainerGUID = '' for sinkFactory in sinkFactories: if (sinkFactory.get('GUID') == '{759D24FF-C5D6-4B65-8DDF-8A2B2BECDE39}'): SampleGrabberCallSinkFactoryGUID = '{759D24FF-C5D6-4B65-8DDF-8A2B2BECDE39}' for valuePart in ElementPath.findall( sinkFactory, 'Value.ValueParts/ValuePart'): if (valuePart.get('GUID') == '{C1864678-66C7-48EA-8ED4-48EF37054990}'): defaultContainerGUID = '{C1864678-66C7-48EA-8ED4-48EF37054990}' SampleGrabberCallSinkFactory = SinkFactories.SampleGrabberCallSinkFactory( sinkControl.createSinkFactory(defaultContainerGUID, SampleGrabberCallSinkFactoryGUID)) return SampleGrabberCallSinkFactory
def test_createEVRSinkFactory(self): sinkControl = captureManager.createSinkControl() XMLstring = sinkControl.getCollectionOfSinks() #print XMLstring root = ElementTree.fromstring(XMLstring) sinkFactories = ElementPath.findall(root, "SinkFactory") EVRSinkFactoreGUID = '' defaultContainerGUID = '' for sinkFactory in sinkFactories: if (sinkFactory.get('GUID') == '{2F34AF87-D349-45AA-A5F1-E4104D5C458E}'): EVRSinkFactoreGUID = '{2F34AF87-D349-45AA-A5F1-E4104D5C458E}' for valuePart in ElementPath.findall( sinkFactory, 'Value.ValueParts/ValuePart'): if (valuePart.get('GUID') == '{71FBA544-3A8E-4D6C-B322-98184BC8DCEA}'): defaultContainerGUID = '{71FBA544-3A8E-4D6C-B322-98184BC8DCEA}' EVRSinkFactory = SinkFactories.EVRSinkFactory( sinkControl.createSinkFactory(defaultContainerGUID, EVRSinkFactoreGUID)) return EVRSinkFactory