public BufferDataAppSink(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. getElementByName() returns a BaseSink which // cannot be casted to AppSink. sink = (AppSink) element; sink.set("emit-signals", true); sink.set("sync", true); sink.connect(new AppSinkNewBufferListener()); } else { sink = null; throw new RuntimeException("Element with name " + name + " not found in the pipeline"); } }
public ByteDataAppSink(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. getElementByName() returns a BaseSink which // cannot be casted to AppSink. sink = (AppSink) element; sink.set("emit-signals", true); sink.set("sync", true); sink.connect(new AppSinkNewBufferListener()); } else { sink = null; throw new RuntimeException("Element with name " + name + " not found in the pipeline"); } }
public RGBDataAppSink(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. getElementByName() returns a BaseSink which // cannot be casted to AppSink. sink = (AppSink) element; sink.set("emit-signals", true); sink.set("sync", true); sink.connect(new AppSinkNewBufferListener()); } else { sink = null; throw new RuntimeException("Element with name " + name + " not found in the pipeline"); } }
private void initSink(String name, String mask) { sink = (AppSink) ElementFactory.make("appsink", name); sink.set("emit-signals", true); sink.set("sync", true); sink.connect(new AppSinkNewBufferListener()); // // 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"))); }
public RGBDataAppSink(String name, Listener listener) { super(initializer(gst.ptr_gst_bin_new(name))); this.listener = listener; sink = (AppSink) ElementFactory.make("appsink", name); sink.set("emit-signals", true); sink.set("sync", true); sink.connect(new AppSinkNewBufferListener()); // // 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, "); // JNA creates ByteBuffer using native byte order, set masks according to that. if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) caps.append("red_mask=(int)0xFF00, green_mask=(int)0xFF0000, blue_mask=(int)0xFF000000"); else caps.append("red_mask=(int)0xFF0000, green_mask=(int)0xFF00, blue_mask=(int)0xFF"); 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"))); }
public ByteDataAppSink(String name, Listener listener) { super(initializer(gst.ptr_gst_bin_new(name))); this.listener = listener; sink = (AppSink) ElementFactory.make("appsink", name); sink.set("emit-signals", true); sink.set("sync", true); sink.connect(new AppSinkNewBufferListener()); // // 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"))); }