【发布时间】:2014-11-07 09:29:09
【问题描述】:
我正在努力弄清楚如何在 python 中使用 MLT 的 GTK2 Consumer。 消费者被概述here。
Doxygen API 中没有关于使用此消费者的任何内容,我能找到的唯一详细信息是 C code itself。
我根据play.py 示例尝试了以下代码,但它给了我错误
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)
代码:
#!/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"
你们能告诉我如何使用这个消费者,或者就如何解决这个问题提供一些建议吗?或者,关于如何在我的 GTK2 应用程序中嵌入由 MLT SDL 消费者生成的 SDL 屏幕的一些建议会很棒:)
非常感谢!
【问题讨论】:
-
我也试过“gtk2_preview”和“gtk+_preview”
标签: python multimedia mlt