/** * Initialize webcam device. */ private synchronized void init() { if (!initialized.compareAndSet(false, true)) { return; } LOG.debug("GStreamer webcam device initialization"); pipe = new Pipeline(getName()); source = ElementFactory.make(GStreamerDriver.getSourceBySystem(), "source"); if (Platform.isWindows()) { source.set("device-index", deviceIndex); } else if (Platform.isLinux()) { source.set("device", videoFile.getAbsolutePath()); } else if (Platform.isMacOSX()) { throw new IllegalStateException("not yet implemented"); } sink = new RGBDataSink(getName(), this); sink.setPassDirectBuffer(true); sink.getSinkElement().setMaximumLateness(LATENESS, TimeUnit.MILLISECONDS); sink.getSinkElement().setQOSEnabled(true); filter = ElementFactory.make("capsfilter", "capsfilter"); jpegdec = ElementFactory.make("jpegdec", "jpegdec"); pipelineReady(); resolutions = parseResolutions(source.getPads().get(0)); pipelineStop(); }
public VideoComponent(final Composite parent, int style, int redrawFps) { super(parent, style | SWT.DOUBLE_BUFFERED); setRedrawFps(redrawFps); videosink = new RGBDataSink("GstVideoComponent", new RGBListener()); videosink.setPassDirectBuffer(true); gcFont = new Font(getDisplay(), "Arial", 13, SWT.NORMAL); addPaintListener(); addDisposeListener(); startRedrawCycle(); }
/** * Initialize webcam device. */ private synchronized void init() { if (!initialized.compareAndSet(false, true)) { return; } LOG.debug("GStreamer webcam device initialization"); pipe = new Pipeline(getName()); source = ElementFactory.make(GStreamerDriver.getSourceBySystem(), "source"); if (Platform.isWindows()) { source.set("device-index", deviceIndex); } else if (Platform.isLinux()) { source.set("device", videoFile.getAbsolutePath()); } else if (Platform.isMacOSX()) { throw new IllegalStateException("not yet implemented"); } sink = new RGBDataSink(getName(), this); sink.setPassDirectBuffer(true); sink.getSinkElement().setMaximumLateness(LATENESS, TimeUnit.MILLISECONDS); sink.getSinkElement().setQOSEnabled(true); filter = ElementFactory.make("capsfilter", "capsfilter"); jpegdec = ElementFactory.make("jpegdec", "jpegdec"); pipelineReady(); resolutions = parseResolutions(source.getPads().get(0)); pipelineStop(); }
rgbListener = new RGBListener(); videosink = new RGBDataSink("GstVideoComponent", rgbListener); videosink.setPassDirectBuffer(true);