Package org.gstreamer

Examples of org.gstreamer.Element


public class ColorBalance {
  public static void main(String[] args) {
    args = Gst.init("ColorBalance video test", args);

    Pipeline pipe = new Pipeline("pipeline");
    final Element videosrc = ElementFactory.make("v4l2src", "source");
    videosrc.set("device", "/dev/video1");
    final Element videosink = ElementFactory.make("xvimagesink", "xv");

    pipe.addMany(videosrc, videosink);
    Element.linkMany(videosrc, videosink);

    pipe.play();
View Full Code Here


        args = Gst.init("AppSrcTest", args);
        final int width = 320, height = 200;
        /* setup pipeline */
        pipeline = new Pipeline("pipeline");
        final AppSrc appsrc = (AppSrc) ElementFactory.make("appsrc", "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(appsrc, srcfilter, videorate, ratefilter, videosink);
                Element.linkMany(appsrc, srcfilter, videorate, ratefilter, videosink);
                appsrc.set("emit-signals", true);
                appsrc.connect(new AppSrc.NEED_DATA() {
                    byte color = 0;
View Full Code Here

        if (pipe == null) {
            throw new RuntimeException("Failed to create Pipeline");
        }
        System.out.println(PREFIX + "Pipeline created successfully");
        System.out.flush();
        final Element videosrc = ElementFactory.make("videotestsrc", "source");
        System.out.println(PREFIX + "videotestsrc created successfully");
        System.out.flush();
        final Element videofilter = ElementFactory.make("capsfilter", "flt");
        System.out.println(PREFIX + "capsfilter created successfully");
        System.out.flush();
        final int width = 400, height = 300;
        videofilter.setCaps(Caps.fromString("video/x-raw-yuv, width=" + width
                + ", height=" + height
                + ", bpp=32, depth=32, framerate=25/1"));
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                // Create the video component and link it in
                VideoComponent videoComponent = new VideoComponent();
                System.out.println(PREFIX + "VideoComponent created successfully");
                System.out.flush();
                Element videosink = videoComponent.getElement();
                pipe.addMany(videosrc, videofilter, videosink);
                Element.linkMany(videosrc, videofilter, videosink);

                // Now create a JFrame to display the video output
                JFrame frame = new JFrame("Swing Video Test");
View Full Code Here

    }
    public static void main(String[] args) {
        // Load some gstreamer dependencies
        args = Gst.init("foo", args);
        System.out.println("Creating fakesrc element");
        Element fakesrc = ElementFactory.make("fakesrc", "fakesrc");
        System.out.println("fakesrc element created");
        System.out.println("Element name = " + fakesrc.getName());
        System.out.println("Creating fakesink element");
        Element fakesink = ElementFactory.make("fakesink", "fakesink");
        System.out.println("fakesink element created");
        System.out.println("Element name = " + fakesink.getName());
    }
View Full Code Here

public class TunerTest {
  public static void main(String[] args) {
    args = Gst.init("ColorBalance video test", args);

    Pipeline pipe = new Pipeline("pipeline");
    final Element videosrc = ElementFactory.make("v4l2src", "source");
    videosrc.set("device", "/dev/video0");
    final Element videosink = ElementFactory.make("xvimagesink", "xv");

    pipe.addMany(videosrc, videosink);
    Element.linkMany(videosrc, videosink);
           
    pipe.play();
View Full Code Here

        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);
View Full Code Here

            playbin.setAudioSink(sink);
            pipe = playbin;
        } else {
            pipe = new Pipeline("AudioPanorama");

            Element src = ElementFactory.make("audiotestsrc", "src");
            src.set("wave", 2);
            Element convert = ElementFactory.make("audioconvert", "convert");
            pipe.addMany(src, convert, sink);
            Element.linkMany(src, convert, sink);
        }
        Gst.getScheduledExecutorService().scheduleAtFixedRate(new Panner(sink),
                100, PERIOD / 100, TimeUnit.MILLISECONDS);
View Full Code Here

        // line flags it is interested in.
        //
        args = Gst.init("SimplePipeline", args);
       
        Pipeline pipe = new Pipeline("SimplePipeline");
        Element src = ElementFactory.make("fakesrc", "Source");
        Element sink = ElementFactory.make("fakesink", "Destination");
       
       
        // Add the elements to the Bin
        pipe.addMany(src, sink);
       
View Full Code Here

      shell.setLayout(new GridLayout(1, false));

      shell.setText("SWT Video Test");

      Pipeline pipe = new Pipeline("SWT Overlay Test");
      Element src = ElementFactory.make("videotestsrc", "videotest");
      VideoComponent component = new VideoComponent(shell, SWT.NONE, true);
      component.getElement().setName("video");
      component.setKeepAspect(true);
      component.setLayoutData(new GridData(GridData.FILL_BOTH));
      Element sink = component.getElement();

      pipe.addMany(src, sink);
      Element.linkMany(src, sink);
      pipe.play();
View Full Code Here

        pipeline = new Pipeline("pipeline");
        System.out.println("Pipeline created");
        System.out.flush();
       
        System.out.println("Creating videotestsrc");
        final Element fakesrc = ElementFactory.make("videotestsrc", "source");
        System.out.println("Creating capsfilter");
        final Element flt = ElementFactory.make("capsfilter", "flt");
       
        System.out.println("Creating caps");
        Caps fltcaps = new Caps("video/x-raw-yuv, width=" + width + ", height=" + height +
                ", bpp=32, depth=24, framerate=30/1");
        System.out.println("Setting caps");
        flt.setCaps(fltcaps);
        final Element navtest = ElementFactory.make("navigationtest", "navtest");
        SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                System.out.println("Creating GstVideoComponent");
                final VideoComponent videoComponent = new VideoComponent();
                videoComponent.setPreferredSize(new Dimension(width, height));
                JFrame frame = new JFrame("Swing Video Test");
                frame.add(videoComponent, BorderLayout.CENTER);
                //
                // Propagate key events.  This could be done with focus, but this
                // test uses the same code as used in VideoPlayer.
                //
                frame.addKeyListener(new KeyAdapter() {

                    public void keyPressed(KeyEvent evt) {
                        for (KeyListener l : videoComponent.getKeyListeners()) {
                            l.keyPressed(evt);
                        }
                    }

                    @Override
                    public void keyReleased(KeyEvent evt) {
                        for (KeyListener l : videoComponent.getKeyListeners()) {
                            l.keyReleased(evt);
                        }
                    }
                   
                });
               
                Element videosink = videoComponent.getElement();

                System.out.println("Adding elements to pipeline");
                pipeline.addMany(fakesrc, flt, navtest, videosink);
                Element.linkMany(fakesrc, flt, navtest, videosink);
                pipeline.play();
View Full Code Here

TOP

Related Classes of org.gstreamer.Element

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.