Skip to content

Instantly share code, notes, and snippets.

@markwingerd
Last active August 29, 2015 14:10
Show Gist options
  • Save markwingerd/46237b789b782baefc40 to your computer and use it in GitHub Desktop.
Save markwingerd/46237b789b782baefc40 to your computer and use it in GitHub Desktop.
GStreamer Tutorial 3: Part 2/4 - Streams and splits multimedia using Playbin2
# Add elements to our bin
output_bin.add(decode, convert, tee, audio_queue, audio_sink, wavescope_queue,
wavescope_visual, wavescope_convert, wavescope_sink, file_queue,
file_encode, file_sink)
# Link decodebin with autoconvert when its source pad has been created.
decode.connect('new-decoded-pad', on_new_decoded_pad)
# Callback function to link decodebin to autoconvert.
def on_new_decoded_pad(dbin, pad, islast):
decode = pad.get_parent()
pipeline = decode.get_parent()
convert = pipeline.get_by_name('convert')
decode.link(convert)
print 'linked!'
# Link the rest of our elements together.
if (not gst.element_link_many(convert, tee) or
not gst.element_link_many(audio_queue, audio_sink) or
not gst.element_link_many(wavescope_queue, wavescope_visual,
wavescope_convert, wavescope_sink) or
not gst.element_link_many(file_queue, file_encode, file_sink)):
print 'Not all elements could link.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment