/** * Set the final sink's properties (or cache it until it'll be created). * * @param property * @param data */ public void set(String property, Object data) { properties.put(property, data); if (videosink != null) videosink.set(property, data); }
public void elementAdded(Bin bin, Element element) { if (element instanceof BaseSink) { videosink = (BaseSink)element; for (Map.Entry<String, Object> e : properties.entrySet()) videosink.set(e.getKey(), e.getValue()); // according to gstreamer docs: // http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstxoverlay.html // the overlay should have to be set from bus's SyncHandler, // but we use autosink and in element-added the pipe already // created so the windows must be prepared so we simple call // the setOverlay and not the comment code bellow // Bus bus = videosink.getBus(); // oldSyncHandler = bus.getSyncHandler(); // bus.setSyncHandler(VideoComponent.this); // for prepare-xwindow-id setOverlay(); autosink.disconnect(this); // from element-added sinkListener = null; // no longer needed } } };
public BufferDataSink(String name, Pipeline pipeline, Listener listener) { super(initializer(gst.ptr_gst_bin_new(name))); this.listener = listener; Element element = pipeline.getElementByName(name); if (element != null) { // TODO: Fix. This doesn't work as it should. getElementByName() returns a // BaseSink which cannot be casted to FakeSink. sink = (BaseSink) element; sink.set("signal-handoffs", true); sink.set("sync", true); sink.set("preroll-queue-len", 1); sink.connect((BaseSink.HANDOFF) new SinkNewBufferListener()); sink.connect((BaseSink.PREROLL_HANDOFF) new SinkNewBufferListener()); } else { sink = null; throw new RuntimeException("Element with name " + name + " not found in the pipeline"); } }
public ByteDataSink(String name, Pipeline pipeline, Listener listener) { super(initializer(gst.ptr_gst_bin_new(name))); this.listener = listener; Element element = pipeline.getElementByName(name); if (element != null) { // TODO: Fix. This doesn't work as it should. getElementByName() returns a // BaseSink which cannot be casted to FakeSink. sink = (BaseSink) element; sink.set("signal-handoffs", true); sink.set("sync", true); sink.set("preroll-queue-len", 1); sink.connect((BaseSink.HANDOFF) new DataHandoffListener()); sink.connect((BaseSink.PREROLL_HANDOFF) new DataHandoffListener()); } else { sink = null; throw new RuntimeException("Element with name " + name + " not found in the pipeline"); } }
public RGBDataSink(String name, Pipeline pipeline, Listener listener) { super(initializer(gst.ptr_gst_bin_new(name))); this.listener = listener; Element element = pipeline.getElementByName(name); if (element != null) { // TODO: Fix. This doesn't work as it should. getElementByName() returns a // BaseSink which cannot be casted to FakeSink. videosink = (BaseSink) element; videosink.set("signal-handoffs", true); videosink.set("sync", true); videosink.set("preroll-queue-len", 1); videosink.connect((BaseSink.HANDOFF) new VideoHandoffListener()); videosink.connect((BaseSink.PREROLL_HANDOFF) new VideoHandoffListener()); } else { videosink = null; throw new RuntimeException("Element with name " + name + " not found in the pipeline"); } }
private void initSink(String name, String mask) { sink = (FakeSink) ElementFactory.make("fakesink", name); sink.set("signal-handoffs", true); sink.set("sync", true); sink.set("preroll-queue-len", 1); sink.connect((BaseSink.HANDOFF) new SinkNewBufferListener()); sink.connect((BaseSink.PREROLL_HANDOFF) new SinkNewBufferListener()); // // Convert the input into 32bit RGB so it can be fed directly to a BufferedImage // Element conv = ElementFactory.make("ffmpegcolorspace", "ColorConverter"); Element videofilter = ElementFactory.make("capsfilter", "ColorFilter"); StringBuilder caps = new StringBuilder("video/x-raw-rgb, bpp=32, depth=24, endianness=(int)4321, "); caps.append(mask); videofilter.setCaps(new Caps(caps.toString())); addMany(conv, videofilter, sink); Element.linkMany(conv, videofilter, sink); // // Link the ghost pads on the bin to the sink pad on the convertor // addPad(new GhostPad("sink", conv.getStaticPad("sink"))); }
this.listener = listener; videosink = (FakeSink) ElementFactory.make("fakesink", name); videosink.set("signal-handoffs", true); videosink.set("sync", true); videosink.set("preroll-queue-len", 1); videosink.connect((BaseSink.HANDOFF) new VideoHandoffListener()); videosink.connect((BaseSink.PREROLL_HANDOFF) new VideoHandoffListener());
videosink.set("handle-events", !x11Events); overlay.handleEvent(!x11Events); watcherRunning = true;
/** * Creates a new instance of RGBDataSink with the given name. * * @param name The name used to identify this pipeline. */ public ByteDataSink(String name, Listener listener) { super(initializer(gst.ptr_gst_bin_new(name))); this.listener = listener; sink = (FakeSink) ElementFactory.make("fakesink", name); sink.set("signal-handoffs", true); sink.set("sync", true); sink.set("preroll-queue-len", 1); sink.connect((BaseSink.HANDOFF) new DataHandoffListener()); sink.connect((BaseSink.PREROLL_HANDOFF) new DataHandoffListener()); // // Adding identity element // Element conv = ElementFactory.make("identity", "Data"); addMany(conv, sink); Element.linkMany(conv, sink); // // Link the ghost pads on the bin to the sink pad on the convertor // addPad(new GhostPad("sink", conv.getStaticPad("sink"))); }