Package org.gstreamer.elements

Examples of org.gstreamer.elements.FakeSrc


        args = Gst.init("FakeSrcTest", args);
        final int width = 320, height = 200;
        /* setup pipeline */
        pipeline = new Pipeline("pipeline");
        final FakeSrc fakesrc = (FakeSrc) ElementFactory.make("fakesrc", "source");
        //fakesrc = ElementFactory.make("videotestsrc", "source");
        final Element srcfilter = ElementFactory.make("capsfilter", "srcfilter");
      
        Caps fltcaps = new Caps("video/x-raw-rgb, framerate=2/1"
                + ", width=" + width + ", height=" + height
                + ", bpp=16, depth=16");
        srcfilter.setCaps(fltcaps);
        final Element videorate = ElementFactory.make("videorate", "videorate");
        final Element ratefilter = ElementFactory.make("capsfilter", "RateFilter");
        ratefilter.setCaps(Caps.fromString("video/x-raw-rgb, framerate=2/1"));
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                JFrame frame = new JFrame("FakeSrcTest");
                VideoComponent panel = new VideoComponent();
                panel.setPreferredSize(new Dimension(width, height));
                frame.add(panel, BorderLayout.CENTER);
                Element videosink = panel.getElement();
                pipeline.addMany(fakesrc, srcfilter, videorate, ratefilter, videosink);
                Element.linkMany(fakesrc, srcfilter, videorate, ratefilter, videosink);
                fakesrc.set("signal-handoffs", true);
                fakesrc.set("sizemax", width * height * 2);
                fakesrc.set("sizetype", 2);
                fakesrc.set("sync", true);
                fakesrc.set("is-live", true);
                fakesrc.set("filltype", 1); // Don't fill the buffer before handoff
                fakesrc.connect(new BaseSrc.HANDOFF() {
                    byte color = 0;
                    byte[] data = new byte[width * height * 2];
                    public void handoff(BaseSrc src, Buffer buffer, Pad pad) {
                        System.out.println("HANDOFF: Element=" + src.getNativeAddress()
                                + " buffer=" + buffer.getNativeAddress()
                                + " pad=" + pad.getNativeAddress());
                        Arrays.fill(data, color++);
                        buffer.getByteBuffer().put(data, 0, data.length);
                    }
                });
                fakesrc.connect("handoff", new Closure() {
                    @SuppressWarnings("unused")
                    public void invoke(Element element, Buffer buffer, Pad pad) {
                        System.out.println("Closure: Element=" + element.getNativeAddress()
                                + " buffer=" + buffer.getNativeAddress()
                                + " pad=" + pad.getNativeAddress());
View Full Code Here

TOP

Related Classes of org.gstreamer.elements.FakeSrc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.