PDA

View Full Version : pyQt4 QAxWidget quicktime control Movie InsertSegment "IDispatch*" Error



gloupi
23rd April 2014, 07:45
I need to add several quicktime movie to build a 'edited' version (say movie A + movie B...). I have done the same thing successfully in CSharp.

I initiate 2 QAxObject (Apple QuickTime Control 2.0 / {24BA3CAF-4BE8-4AEC-A7C8-6F47D5684602}). Load an Url/Filename in QAx one.(strange thing that i need to load it twice in URL and FileName)

Create a NewMovie in the second, and try to "InsertSegment" in the second Ax Movie, this is where i get this error message :

"Movie.InsertSegment(Movie_source,0,duration_source ,duration) TypeError: unable to convert argument 0 of QAxObject.InsertSegment from 'QAxObject' to 'IDispatch*'".

Already looked at "QuickTime for .NET and COM Developers".

How could i make the "InsertSegment" method accept the QuicktimeControl.Movie as a 'IDispatch*' ?
Is there any other way to do that ?

See Full Code Below:



from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4 import QAxContainer

class Example(QtGui.QMainWindow):
def __init__(self):
super(Example, self).__init__()
self.initUI()

def initUI(self):
self.frame = QtGui.QFrame()
self.setCentralWidget(self.frame)
self.mainLayout = QtGui.QGridLayout(self)
self.frame.setLayout(self.mainLayout)

self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('QuicktimeTest')

QAx_quicktime_control = QAxContainer.QAxWidget(self)
QAx_quicktime_control_source = QAxContainer.QAxWidget(self)

self.mainLayout.addWidget(QAx_quicktime_control)
self.mainLayout.addWidget(QAx_quicktime_control_so urce)

QAx_quicktime_control.setControl('{24BA3CAF-4BE8-4AEC-A7C8-6F47D5684602}')
QAx_quicktime_control_source.setControl('{24BA3CAF-4BE8-4AEC-A7C8-6F47D5684602}')
QAx_quicktime_control_source.setVisible(False)

textbrower = QtGui.QTextBrowser()
self.mainLayout.addWidget(textbrower)

textbrower.setHtml(QAx_quicktime_control.generateD ocumentation())

QAx_quicktime_control_source.QuickTimeInitialize(0 ,1)
QAx_quicktime_control_source.CreateNewMovie(False)
QAx_quicktime_control_source.setProperty('Sizing', 0)
QAx_quicktime_control_source.setProperty('URL' ,'C:\\Whatever.mov')
QAx_quicktime_control_source.setProperty('FileName ' ,'C:\\Whatever.mov')
QAx_quicktime_control_source.setProperty('Sizing', 2)

Movie_source = QAx_quicktime_control_source.querySubObject('Movie ')
#textbrower.setHtml(Movie_source.generateDocumenta tion())
duration_source = Movie_source.dynamicCall('Duration').toInt()

#QAx_quicktime_control.QuickTimeInitialize(0,1)
QAx_quicktime_control.CreateNewMovie(False)
Movie = QAx_quicktime_control.querySubObject('Movie')
Movie.SetActive(True)
Movie.SetAllowEditing(True)
duration = Movie.dynamicCall('Duration').toInt()

#Does not workt with InsertSegment or the dynamicCall
Movie.InsertSegment(Movie_source,0,duration_source ,duration)
#Movie.dynamicCall('InsertSegment',Movie_source,0, duration_source,duration)

self.show()

def main():

app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())


if __name__ == '__main__':
main()