/** * Creates a CaptureDevice used mostly for testing purposes from its important components. * * @param srcLoc Where the capture device will capture from e.g. /dev/video0. * @param devName The ProducerType of the capture device such as V4L2SRC. * @param name The unique name of the capture device. * @param outputLoc The output name of the capture media. * */ public static CaptureDevice createCaptureDevice( String srcLoc, ProducerType devName, String name, String outputLoc) { CaptureDevice capdev = new CaptureDevice(srcLoc, devName, name, outputLoc); String codecProperty = CaptureParameters.CAPTURE_DEVICE_PREFIX + name + CaptureParameters.CAPTURE_DEVICE_CODEC; String containerProperty = CaptureParameters.CAPTURE_DEVICE_PREFIX + name + CaptureParameters.CAPTURE_DEVICE_CONTAINER; String bitrateProperty = codecProperty + CaptureParameters.CAPTURE_DEVICE_BITRATE; String quantizerProperty = codecProperty + CaptureParameters.CAPTURE_DEVICE_QUANTIZER; String bufferProperty = CaptureParameters.CAPTURE_DEVICE_PREFIX + name + CaptureParameters.CAPTURE_DEVICE_BUFFER; String bufferCountProperty = bufferProperty + CaptureParameters.CAPTURE_DEVICE_BUFFER_MAX_BUFFERS; String bufferByteProperty = bufferProperty + CaptureParameters.CAPTURE_DEVICE_BUFFER_MAX_BYTES; String bufferTimeProperty = bufferProperty + CaptureParameters.CAPTURE_DEVICE_BUFFER_MAX_TIME; String framerateProperty = CaptureParameters.CAPTURE_DEVICE_PREFIX + name + CaptureParameters.CAPTURE_DEVICE_FRAMERATE; String codec = properties.getProperty(codecProperty); String container = properties.getProperty(containerProperty); String bitrate = properties.getProperty(bitrateProperty); String quantizer = properties.getProperty(quantizerProperty); String bufferCount = properties.getProperty(bufferCountProperty); String bufferBytes = properties.getProperty(bufferByteProperty); String bufferTime = properties.getProperty(bufferTimeProperty); String framerate = properties.getProperty(framerateProperty); if (codec != null) capdev.getProperties().setProperty("codec", codec); if (bitrate != null) capdev.getProperties().setProperty("bitrate", bitrate); if (quantizer != null) capdev.getProperties().setProperty("quantizer", quantizer); if (container != null) capdev.getProperties().setProperty("container", container); if (bufferCount != null) capdev.getProperties().setProperty("bufferCount", bufferCount); if (bufferBytes != null) capdev.getProperties().setProperty("bufferBytes", bufferBytes); if (bufferTime != null) capdev.getProperties().setProperty("bufferTime", bufferTime); if (framerate != null) capdev.getProperties().setProperty("framerate", framerate); return capdev; }