Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public struct Picture
- {
- public int width;
- public int height;
- public uint8[] data;
- }
- /***/
- public Picture current_picture {
- owned get {
- Picture pic = Picture();
- var caps = Gst.Caps.from_string("video/x-raw, format=(string)RGB, pixel-aspect-ratio=(fraction)1/1");
- Gst.Sample sample;
- Signal.emit_by_name(playbin, "convert-sample", caps, out sample);
- if(sample == null)
- return pic;
- var sample_caps = sample.get_caps ();
- if(sample_caps == null)
- return pic;
- var structure = sample_caps.get_structure(0).copy ();
- pic.width = (int)structure.get_value ("width");
- pic.height = (int)structure.get_value ("height");
- var memory = sample.get_buffer ().get_memory (0);
- Gst.MapInfo info;
- memory.map (out info, Gst.MapFlags.READ);
- pic.data = info.data;
- return pic;
- }
- }
Advertisement
RAW Paste Data
Copied
Advertisement