Package org.gstreamer

Examples of org.gstreamer.Pipeline$API


   * Example test method
   */

  @Test
  public void simple() {
    _stem_ impl = new _stem_Impl();
   
    impl.say("Hello World");
  }
View Full Code Here


        // Quartz is abysmally slow at scaling video for some reason, so turn it off.
        System.setProperty("apple.awt.graphics.UseQuartz", "false");
       
        args = Gst.init("SwingVideoTest", args);
       
        pipe = new Pipeline("pipeline");
        final Element videosrc = ElementFactory.make("videotestsrc", "source");
        final Element videofilter = ElementFactory.make("capsfilter", "flt");
        videofilter.setCaps(Caps.fromString("video/x-raw-yuv, width=720, height=576"
                + ", bpp=32, depth=32, framerate=25/1"));
        SwingUtilities.invokeLater(new Runnable() {
View Full Code Here

                    final VideoPlayer player = new VideoPlayer(uri);
                    player.setPreferredSize(new Dimension(200, 150));
                    player.setOpacity(0.4f);
                    player.setOpaque(false);
                    player.setControlsVisible(false);
                    Pipeline pipe = player.getMediaPlayer().getPipeline();
                    // Turn off sound - otherwise everything goes slow.
                    if (pipe instanceof PlayBin2) {
                        ((PlayBin2) pipe).setAudioSink(ElementFactory.make("fakesink", "audio"));
                    }
                    pip.add(player);
View Full Code Here

        for (String s: args) {
            sb.append(" ");
            sb.append(s);
        }
       
        Pipeline pipe = Pipeline.launch(sb.substring(1));

        pipe.play();

        Gst.main();

        pipe.stop();
    }
View Full Code Here

        }
        Element src = ElementFactory.make("filesrc", "Input File");
        src.set("location", args[0]);
       
        DecodeBin2 decodeBin = new DecodeBin2("Decode Bin");
        pipe = new Pipeline("main pipeline");
        Element decodeQueue = ElementFactory.make("queue", "Decode Queue");
        pipe.addMany(src, decodeQueue, decodeBin);
        Element.linkMany(src, decodeQueue, decodeBin);

        /* create audio output */
 
View Full Code Here

    public DynamicPadTest() {
    }
    public static void main(String[] args) {
        args = Gst.init("Dynamic Pad Test", args);
        /* create elements */
        Pipeline pipeline = new Pipeline("my_pipeline");
        Element source = ElementFactory.make("filesrc", "source");
        source.set("location", args[0]);
        Element demux = ElementFactory.make("oggdemux", "demuxer");
       
        /* you would normally check that the elements were created properly */
       
        /* put together a pipeline */
        pipeline.addMany(source, demux);
        Element.linkPads(source, "src", demux, "sink");
       
        /* listen for newly created pads */
        demux.connect(new Element.PAD_ADDED() {
            public void padAdded(Element element, Pad pad) {
               System.out.println("New Pad " + pad.getName() + " was created");
            }
        });
       
        /* start the pipeline */
        pipeline.play();
        Gst.main();
    }
View Full Code Here

        } else if (true) {
            src = ElementFactory.make("filesrc", "Input File");
            src.set("location", args[0]);
        }*/
        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) {
                  /* 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

        }
       
        //
        // 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

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

    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

TOP

Related Classes of org.gstreamer.Pipeline$API

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.