Created
February 26, 2015 13:13
-
-
Save aborilov/37bd9bc1ee5b879dac2e to your computer and use it in GitHub Desktop.
appsink test
This file contains hidden or 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 sys | |
| import pygst | |
| pygst.require("0.10") | |
| import gst | |
| import gobject | |
| def main(url): | |
| print url | |
| gobject.threads_init() | |
| command = 'rtspsrc location=%s' % url | |
| command += ' ! appsink name=app enable-last-buffer=true emit-signals=true' | |
| print command | |
| pipeline = gst.parse_launch(command) | |
| app = pipeline.get_by_name('app') | |
| def on_new_buffer(appsink): | |
| buf = appsink.get_property('last-buffer') | |
| print str(buf.data) | |
| app.connect('new-buffer', on_new_buffer) | |
| mainloop = gobject.MainLoop() | |
| pipeline.set_state(gst.STATE_PAUSED) | |
| pipeline.set_state(gst.STATE_PLAYING) | |
| mainloop.run() | |
| if __name__ == "__main__": | |
| main(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment