I'm stuggling to figure out how to use MLT's GTK2 Consumer in python. The consumer is outlined here.
There's nothing in the Doxygen API about using this consumer and the only details I could find was the C code itself.
I tried the following code based on the play.py example, but it gives me the error
NotImplementedError: Wrong number or type of arguments for overloaded function 'new_Consumer'.
Possible C/C++ prototypes are:
Mlt::Consumer::Consumer()
Mlt::Consumer::Consumer(Mlt::Profile &)
Mlt::Consumer::Consumer(Mlt::Profile &,char const *,char const *)
Mlt::Consumer::Consumer(Mlt::Profile &,char const *)
Mlt::Consumer::Consumer(Mlt::Service &)
Mlt::Consumer::Consumer(Mlt::Consumer &)
Mlt::Consumer::Consumer(mlt_consumer)
Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import required modules
import mlt
import time
import sys
import gtk
# Start the mlt system
mlt.Factory().init( )
# Establish a profile
mlt_profile = mlt.Profile( )
# Create the producer
p = mlt.Producer( mlt_profile, "video_file" )
self.mltwidget = gtk.HBox()
fp.add(self.mltwidget)
if p:
# Create the consumer
c = mlt.Consumer( mlt_profile, "gtk_preview", self.mltwidget)
# Turn off the default rescaling
c.set( "rescale", "none" )
# Connect the producer to the consumer
c.connect( p )
# Start the consumer
c.start( )
# Wait until the user stops the consumer
while c.is_stopped( ) == 0:
time.sleep( 1 )
else:
# Diagnostics
print "Unable to open ", "video_file"
Can you guys let me know how I can use this consumer, or give some advice on how to figure it out? Alternately, some advice on how to embed the SDL screen produced by the MLT SDL consumer in my GTK2 application would be great :)
Many Thanks!
So after some further investigation, it appears that the GTK+ Consumer uses the SDL WINDOWID Hack, so the standard SDL consumer can be embedded manually using the code outlined at http://faq.pygtk.org/index.py?file=faq23.042.htp&req=show
This was unfortunately not suitable for my application that required multiple screens so I'll be looking at alternate options.