0

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!

4

1 回答 1

1

因此,经过进一步调查,GTK+ Consumer 似乎使用了 SDL WINDOWID Hack,因此可以使用http://faq.pygtk.org/index.py?file=faq23 中概述的代码手动嵌入标准 SDL consumer。 042.htp&req=显示

不幸的是,这不适合我需要多个屏幕的应用程序,因此我将研究替代选项。

于 2014-11-10T12:59:19.450 回答