Created
May 22, 2013 12:40
-
-
Save alumae/5627250 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gi | |
gi.require_version('Gst', '1.0') | |
from gi.repository import GObject, Gst | |
GObject.threads_init() | |
Gst.init(None) | |
appsrc = Gst.ElementFactory.make("appsrc", "appsrc") | |
filesink = Gst.ElementFactory.make("filesink", "filesink") | |
filesink.set_property("location", "test.dat") | |
pipeline = Gst.Pipeline() | |
pipeline.add(appsrc) | |
pipeline.add(filesink) | |
appsrc.link(filesink) | |
pipeline.set_state(Gst.State.PLAYING) | |
data = "1234" * 12 | |
print "Using data: %s" % data | |
buf = Gst.Buffer.new_allocate(None, len(data), None) | |
buf.fill(0, data, len(data)) | |
appsrc.emit("push-buffer", buf) | |
pipeline.send_event(Gst.Event.new_eos()) | |
result = open("test.dat").read() | |
print "Result : %s" % result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I fixed your errors in my fork and created a working version of your code. On Python 3