/** * Implements {@link CaptureDevice#connect()}. Delegates to the wrapped * <tt>CaptureDevice</tt> if available; otherwise, does nothing. * * @throws IOException if the wrapped <tt>CaptureDevice</tt> throws such an * exception */ @Override public void connect() throws IOException { if (captureDevice != null) captureDevice.connect(); }
/** * Implements {@link CaptureDevice#disconnect()}. Delegates to the wrapped * <tt>CaptureDevice</tt> if available; otherwise, does nothing. */ @Override public void disconnect() { if (captureDevice != null) captureDevice.disconnect(); }
/** * Implements {@link CaptureDevice#getCaptureDeviceInfo()}. Delegates to the * wrapped <tt>CaptureDevice</tt> if available; otherwise, returns * <tt>null</tt>. * * @return the <tt>CaptureDeviceInfo</tt> of the wrapped * <tt>CaptureDevice</tt> if available; otherwise, <tt>null</tt> */ public CaptureDeviceInfo getCaptureDeviceInfo() { return (captureDevice != null) ? captureDevice.getCaptureDeviceInfo() : null; }
/** * Implements {@link CaptureDevice#getFormatControls()}. Delegates to the * wrapped <tt>CaptureDevice</tt> if available; otherwise, returns an empty * array with <tt>FormatControl</tt> element type. * * @return the array of <tt>FormatControl</tt>s of the wrapped * <tt>CaptureDevice</tt> if available; otherwise, an empty array with * <tt>FormatControl</tt> element type */ public FormatControl[] getFormatControls() { return (captureDevice != null) ? captureDevice.getFormatControls() : new FormatControl[0]; }
/** * Implements {@link CaptureDevice#start()}. Delegates to the wrapped * <tt>CaptureDevice</tt> if available; otherwise, does nothing. * * @throws IOException if the wrapped <tt>CaptureDevice</tt> throws such an * exception */ @Override public void stop() throws IOException { if (captureDevice != null) captureDevice.stop(); }
/** * Implements {@link CaptureDevice#start()}. Delegates to the wrapped * <tt>CaptureDevice</tt> if available; otherwise, does nothing. * * @throws IOException if the wrapped <tt>CaptureDevice</tt> throws such an * exception */ @Override public void start() throws IOException { if (captureDevice != null) captureDevice.start(); }
/** * Implements {@link CaptureDevice#getFormatControls()}. Delegates to the * wrapped <tt>CaptureDevice</tt> if available; otherwise, returns an empty * array with <tt>FormatControl</tt> element type. * * @return the array of <tt>FormatControl</tt>s of the wrapped * <tt>CaptureDevice</tt> if available; otherwise, an empty array with * <tt>FormatControl</tt> element type */ public FormatControl[] getFormatControls() { return (captureDevice != null) ? captureDevice.getFormatControls() : new FormatControl[0]; }
/** * Implements {@link CaptureDevice#stop()}. Delegates to the wrapped * <tt>CaptureDevice</tt> if available; otherwise, does nothing. * * @throws IOException if the wrapped <tt>CaptureDevice</tt> throws such an * exception */ @Override public void stop() throws IOException { if (captureDevice != null) captureDevice.stop(); } }
/** * Implements {@link CaptureDevice#start()}. Delegates to the wrapped * <tt>CaptureDevice</tt> if available; otherwise, does nothing. * * @throws IOException if the wrapped <tt>CaptureDevice</tt> throws such an * exception */ @Override public void start() throws IOException { if (captureDevice != null) captureDevice.start(); }
/** * Gets an array of <tt>FormatControl</tt>s for the * <tt>CaptureDevice</tt> this <tt>AudioMixer</tt> provides through * its output <tt>AudioMixingPushBufferDataSource</tt>s. * * @return an array of <tt>FormatControl</tt>s for the * <tt>CaptureDevice</tt> this <tt>AudioMixer</tt> provides * through its output <tt>AudioMixingPushBufferDataSource</tt>s */ FormatControl[] getFormatControls() { /* * Setting the format of the captureDevice once we've started using it * is likely to wreak havoc so disable it. */ FormatControl[] formatControls = captureDevice.getFormatControls(); if (!OSUtils.IS_ANDROID && (formatControls != null)) { for (int i = 0; i < formatControls.length; i++) { formatControls[i] = new ReadOnlyFormatControlDelegate(formatControls[i]); } } return formatControls; }
/** * Gets the <tt>CaptureDeviceInfo</tt> of the <tt>CaptureDevice</tt> * this <tt>AudioMixer</tt> provides through its output * <tt>AudioMixingPushBufferDataSource</tt>s. * * @return the <tt>CaptureDeviceInfo</tt> of the <tt>CaptureDevice</tt> this * <tt>AudioMixer</tt> provides through its output * <tt>AudioMixingPushBufferDataSource</tt>s */ CaptureDeviceInfo getCaptureDeviceInfo() { return captureDevice.getCaptureDeviceInfo(); }
/** * Implements {@link CaptureDevice#disconnect()}. Delegates to the wrapped * <tt>CaptureDevice</tt> if available; otherwise, does nothing. */ @Override public void disconnect() { if (captureDevice != null) captureDevice.disconnect(); }
/** * Implements {@link CaptureDevice#connect()}. Delegates to the wrapped * <tt>CaptureDevice</tt> if available; otherwise, does nothing. * * @throws IOException if the wrapped <tt>CaptureDevice</tt> throws such an * exception */ @Override public void connect() throws IOException { if (captureDevice != null) captureDevice.connect(); }
= ((CaptureDevice) captureDevice).getFormatControls();
/** * Implements {@link CaptureDevice#getCaptureDeviceInfo()}. Delegates to the * wrapped <tt>CaptureDevice</tt> if available; otherwise, returns * <tt>null</tt>. * * @return the <tt>CaptureDeviceInfo</tt> of the wrapped * <tt>CaptureDevice</tt> if available; otherwise, <tt>null</tt> */ public CaptureDeviceInfo getCaptureDeviceInfo() { return (captureDevice != null) ? captureDevice.getCaptureDeviceInfo() : null; } }
/** * Gets the <tt>MediaFormat</tt> in which this <tt>MediaDevice</tt> captures * media. * * @return the <tt>MediaFormat</tt> in which this <tt>MediaDevice</tt> * captures media * @see MediaDevice#getFormat() */ public MediaFormat getFormat() { CaptureDevice captureDevice = createCaptureDevice(); if (captureDevice != null) { MediaType mediaType = getMediaType(); for (FormatControl formatControl : captureDevice.getFormatControls()) { MediaFormat format = MediaFormatImpl.createInstance(formatControl.getFormat()); if ((format != null) && format.getMediaType().equals(mediaType)) return format; } } return null; }
/** * Returns a human-readable representation of a specific * <tt>CaptureDevice</tt> in the form of a <tt>String</tt> value. * * @param captureDevice the <tt>CaptureDevice</tt> to get a human-readable * representation of * @return a <tt>String</tt> value which gives a human-readable * representation of the specified <tt>captureDevice</tt> */ private static String toString(CaptureDevice captureDevice) { StringBuffer str = new StringBuffer(); str.append("CaptureDevice with hashCode "); str.append(captureDevice.hashCode()); str.append(" and captureDeviceInfo "); CaptureDeviceInfo captureDeviceInfo = captureDevice.getCaptureDeviceInfo(); MediaLocator mediaLocator = null; if (captureDeviceInfo != null) { mediaLocator = captureDeviceInfo.getLocator(); } str.append((mediaLocator == null) ? captureDeviceInfo : mediaLocator); return str.toString(); }
= captureDevice.getFormatControls();