/** * Checks if the requested resolution is supported by the camera. * If not, it modifies it by supported parameters. **/ public static VideoQuality determineClosestSupportedResolution(Android.Hardware.Camera.Parameters parameters, VideoQuality quality) { VideoQuality v = quality.clone(); int minDist = Integer.MaxValue; System.String supportedSizesStr = "Supported resolutions: "; IList <Android.Hardware.Camera.Size> supportedSizes = parameters.SupportedPreviewSizes; //for (Iterator<Size> it = supportedSizes.En...iterator(); it.hasNext();) foreach (Android.Hardware.Camera.Size size in supportedSizes) { // supportedSizesStr += size.Width + "x" + size.Height + (it.hasNext() ? ", " : ""); int dist = System.Math.Abs(quality.resX - size.Width); if (dist < minDist) { minDist = dist; v.resX = size.Width; v.resY = size.Height; } } //Log.v(TAG, supportedSizesStr); if (quality.resX != v.resX || quality.resY != v.resY) { // Log.v(TAG, "Resolution modified: " + quality.resX + "x" + quality.resY + "->" + v.resX + "x" + v.resY); } return(v); }
public bool equals(VideoQuality quality) { if (quality == null) { return(false); } return(quality.resX == this.resX && quality.resY == this.resY && quality.framerate == this.framerate && quality.bitrate == this.bitrate); }
public static VideoQuality parseQuality(System.String str) { VideoQuality quality = DEFAULT_VIDEO_QUALITY.clone(); if (str != null) { System.String[] config = str.Split('-'); try { quality.bitrate = Integer.ParseInt(config[0]) * 1000; // conversion to bit/s quality.framerate = Integer.ParseInt(config[1]); quality.resX = Integer.ParseInt(config[2]); quality.resY = Integer.ParseInt(config[3]); } catch (IndexOutOfBoundsException ignore) { } } return(quality); }
/** * Sets the configuration of the stream. <br /> * You can call this method at any time and changes will take * effect next time you call {@link #configure()}. * @param quality Quality of the stream */ public void setVideoQuality(VideoQuality quality) { if (mVideoStream != null) { mVideoStream.setVideoQuality(quality); } }
/** * Sets the configuration of the stream. You can call this method at any time * and changes will take effect next time you call {@link #configure()}. * @param videoQuality Quality of the stream */ public void setVideoQuality(VideoQuality videoQuality) { if (!mRequestedQuality.equals(videoQuality)) { mRequestedQuality = videoQuality.clone(); mUpdated = false; } }