Отображать изображение без gtk

Я хотел бы отображать изображение в Python с использованием привязок gstreamer, но без использования GTK + (я использую ARM).

Я знаю, как слушать музыку с помощью python и gstreamer:

#!/usr/bin/python
# Simply initiates a gstreamer pipeline without gtk
import gst
import gobject
import sys

mainloop = gobject.MainLoop()
my_bin = gst.element_factory_make("playbin")
my_bin.set_property("uri", "file:///home/Lumme-Badloop.ogg")
my_bin.set_state(gst.STATE_PLAYING)

try:
    mainloop.run()
except KeyboardInterrupt:
    sys.exit(0)    

Я знаю, как отображать изображение с помощью gstreamer в командной строке:

gst-launch-0.10 filesrc location=image.jpeg ! jpegdec ! freeze ! videoscale ! ffmpegcolorspace ! autovideosink

Я бы хотел то же самое, но с использованием Python.

Я пробовал кое-что, код работает без ошибок, но на экране ничего не отображается.

pipe = gst.Pipeline("mypipe")

source = gst.element_factory_make("filesrc", "filesource")
demuxer = gst.element_factory_make("jpegdec", "demuxer")
freeze = gst.element_factory_make("freeze", "freeze")
video = gst.element_factory_make("videoscale", "scaling")
ffm = gst.element_factory_make("ffmpegcolorspace", "muxer")
sink = gst.element_factory_make("autovideosink", "output")

pipe.add(source, demuxer, freeze, video, ffm, sink)

filepath = "file:///home/image.jpeg"
pipe.get_by_name("filesource").set_property("location", filepath)

pipe.set_state(gst.STATE_PLAYING)

Не могли бы вы мне помочь?

Заранее спасибо!

Кстати, у меня тоже работают аудиотест и видеотест. Вот пример, который работает нормально:

# Create GStreamer pipeline
pipeline = gst.Pipeline("mypipeline")
# Set up our video test source
videotestsrc = gst.element_factory_make("videotestsrc", "video")
# Add it to the pipeline
pipeline.add(videotestsrc)
# Now we need somewhere to send the video
sink = gst.element_factory_make("xvimagesink", "sink")
# Add it to the pipeline
pipeline.add(sink)
# Link the video source to the sink-xv
videotestsrc.link(sink)

pipeline.set_state(gst.STATE_PLAYING)
7
задан jlengrand 9 January 2012 в 15:16
поделиться