Sha256: d6bdd3ed05e0f459ac79cc52ea1a2bafbbe35f5091ceeaf4347a8e1d76e2be3b
Contents?: true
Size: 952 Bytes
Versions: 42
Compression:
Stored size: 952 Bytes
Contents
#!/usr/bin/env ruby require 'gst' def type_find(file) pipeline = Gst::Pipeline.new("pipeline") source = Gst::ElementFactory.make("filesrc", "source") type_find = Gst::ElementFactory.make("typefind", "type-find") sink = Gst::ElementFactory.make("fakesink", "sink") pipeline.add(source, type_find, sink) source >> type_find >> sink found_caps = nil type_find.signal_connect("have-type") do |element, probability, caps| found_caps = caps end loop = GLib::MainLoop.new source.location = file bus = pipeline.bus bus.add_watch do |bus, message| case message.type when Gst::Message::STATE_CHANGED, Gst::Message::EOS loop.quit when Gst::Message::ERROR p message.parse loop.quit end true end pipeline.pause loop.run pipeline.stop if found_caps puts("#{file} - #{found_caps}") else puts("#{file} - No type found") end end ARGV.each do |file| type_find(file) end
Version data entries
42 entries across 42 versions & 1 rubygems
Version | Path |
---|---|
gstreamer-0.90.7 | sample/type-find.rb |
gstreamer-0.90.6 | sample/type-find.rb |