If you think the Android project spydroid-ipcamera listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright (C) 2011-2014 GUIGUI Simon, fyhertz@gmail.com
* //fromwww.java2s.com
* This file is part of libstreaming (https://github.com/fyhertz/libstreaming)
*
* Spydroid is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/package net.majorkernelpanic.streaming.audio;
/**
* A class that represents the quality of an audio stream.
*/publicclass AudioQuality {
/** Default audio stream quality. */publicfinalstatic AudioQuality DEFAULT_AUDIO_QUALITY = new AudioQuality(8000,32000);
/** Represents a quality for a video stream. */public AudioQuality() {}
/**
* Represents a quality for an audio stream.
* @param samplingRate The sampling rate
* @param bitRate The bitrate in bit per seconds
*/public AudioQuality(int samplingRate, int bitRate) {
this.samplingRate = samplingRate;
this.bitRate = bitRate;
}
publicint samplingRate = 0;
publicint bitRate = 0;
publicboolean equals(AudioQuality quality) {
if (quality==null) return false;
return (quality.samplingRate == this.samplingRate &
quality.bitRate == this.bitRate);
}
public AudioQuality clone() {
returnnew AudioQuality(samplingRate, bitRate);
}
publicstatic AudioQuality parseQuality(String str) {
AudioQuality quality = DEFAULT_AUDIO_QUALITY.clone();
if (str != null) {
String[] config = str.split("-");
try {
quality.bitRate = Integer.parseInt(config[0])*1000; // conversion to bit/s
quality.samplingRate = Integer.parseInt(config[1]);
}
catch (IndexOutOfBoundsException ignore) {}
}
return quality;
}
}