rotrevrep

Gstreamer video snapshot

Jun 6th, 2013
669
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.43 KB | None | 0 0
  1. public bool take_snapshot (string destination, string mime) {
  2.     var caps = Gst.Caps.from_string (mime);
  3.     Gst.Sample sample;
  4.     Signal.emit_by_name (playbin, "convert-sample", caps, out sample);
  5.     if (sample == null)
  6.         return false;
  7.     var buffer = sample.get_buffer();
  8.     if (buffer == null)
  9.         return false;
  10.     Gst.MapInfo info;
  11.     buffer.get_memory (0).map (out info, Gst.MapFlags.READ);
  12.     FileUtils.set_data (destination, info.data);
  13. }
Add Comment
Please, Sign In to add comment