Examples of Pipeline


Examples of org.gstreamer.Pipeline

        }
       
        //
        // Construct a pipeline: filesrc ! OutputStreamSink
        //
        Pipeline inputPipe = new Pipeline("input pipeline");
        Element filesrc = ElementFactory.make("filesrc", "File source");
        filesrc.set("location", args[0]);
        Element outputstream = new WriteableByteChannelSink(pipeChannel.sink(), "output stream");
        inputPipe.addMany(filesrc, outputstream);
        Element.linkMany(filesrc, outputstream);
        inputPipe.play();
        //
        // Now construct the output pipeline to process the data
        //
       
        Element src = null;
        try {           
            src = new ReadableByteChannelSrc(pipeChannel.source(), "input file");
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new RuntimeException(ex);
        }
       
        DecodeBin2 decodeBin = (DecodeBin2) ElementFactory.make("decodebin2", "Decode Bin");
        Pipeline pipe = new Pipeline("main pipeline");
        pipe.addMany(src, decodeBin);
        src.link(decodeBin);
       
        /* create audio output */
        final Bin audioBin = new Bin("Audio Bin");
       
        Element conv = ElementFactory.make("audioconvert", "Audio Convert");
        Element sink = ElementFactory.make("autoaudiosink", "sink");
        audioBin.addMany(conv, sink);
        Element.linkMany(conv, sink);       
        audioBin.addPad(new GhostPad("sink", conv.getStaticPad("sink")));
       
        pipe.add(audioBin);

        decodeBin.connect(new DecodeBin2.NEW_DECODED_PAD() {
            public void newDecodedPad(DecodeBin2 elem, Pad pad, boolean last) {
                System.out.println("newDecodedPad");
                  /* only link once */
                Pad audioPad = audioBin.getStaticPad("sink");
                if (pad.isLinked()) {
                    return;
                }
 
                /* check media type */
                Caps caps = pad.getCaps();
                Structure struct = caps.getStructure(0);
                if (struct.getName().startsWith("audio/")) {
                    System.out.println("Got audio pad");
                    /* link'n'play */
                    pad.link(audioPad)
                }
               
            }
        });
        Bus bus = pipe.getBus();
        bus.connect(new Bus.TAG() {
            public void tagsFound(GstObject source, TagList tagList) {
                System.out.println("Got TAG event");               
                for (String tag : tagList.getTagNames()) {
                    System.out.println("Tag " + tag + " = " + tagList.getValue(tag, 0));
                }
            }
        });
        bus.connect(new Bus.ERROR() {
            public void errorMessage(GstObject source, int code, String message) {
                System.out.println("Error: code=" + code + " message=" + message);
            }
        });
        bus.connect(new Bus.EOS() {

            public void endOfStream(GstObject source) {
                System.out.println("Got EOS!");
            }
           
        });
        pipe.play();
        Gst.main();
    }
View Full Code Here

Examples of org.gstreamer.Pipeline

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();

    try {
      Thread.sleep(1000);
    } catch (Exception e) {
    }
View Full Code Here

Examples of org.gstreamer.Pipeline

    public static void main(String[] args) {

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

Examples of org.gstreamer.Pipeline

        args = Gst.init("unknown", args);
        Version v = Gst.getVersion();
        System.out.println(PREFIX + "Gst.init succeeded. gstreamer version " + v);
        System.out.flush();
        pipe = new Pipeline();
        if (pipe == null) {
            throw new RuntimeException("Failed to create Pipeline");
        }
        System.out.println(PREFIX + "Pipeline created successfully");
        System.out.flush();
View Full Code Here

Examples of org.gstreamer.Pipeline

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();

    Tuner tun = Tuner.wrap(videosrc);

    List<TunerNorm> normList = tun.getNormList();
    for (TunerNorm n : normList) {
View Full Code Here

Examples of org.gstreamer.Pipeline

    public static void main(String[] args) {

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

Examples of org.gstreamer.Pipeline

        // Initialize the gstreamer framework, and let it interpret any command
        // line flags it is interested in.
        //
        args = Gst.init("AudioPanorama", args);
        PanoramaSink sink = new PanoramaSink("panorama sink");
        Pipeline pipe;
        if (args.length > 0) {
            PlayBin2 playbin = new PlayBin2("AudioPanorama");

            playbin.setInputFile(new File(args[0]));
           
            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);
        // Start the pipeline playing
        pipe.play();

        Gst.main();

        // Clean up (gstreamer requires elements to be in State.NULL before disposal)
        pipe.stop();
    }
View Full Code Here

Examples of org.gstreamer.Pipeline

        // Initialize the gstreamer framework, and let it interpret any command
        // 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);
       
        // Link fakesrc to fakesink so data can flow
        src.link(sink);
       
        // Start the pipeline playing
        pipe.play();
        Gst.main();
        pipe.stop();
    }
View Full Code Here

Examples of org.gstreamer.Pipeline

      shell.setSize(640, 480);
      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();

      shell.open();
      while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
          display.sleep();
      }
      pipe.stop();
      display.dispose();

    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.gstreamer.Pipeline

        args = Gst.init("SwingVideoTest", args);       
        System.out.println("Creating MainLoop");
       
        /* setup pipeline */
        System.out.println("Creating pipeline");
        pipeline = new Pipeline("pipeline");
        System.out.println("Pipeline created");
        System.out.flush();
       
        System.out.println("Creating videotestsrc");
        final Element fakesrc = ElementFactory.make("videotestsrc", "source");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.