128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org/* 228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * libjingle 328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * Copyright 2004 Google Inc. 428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * Redistribution and use in source and binary forms, with or without 628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * modification, are permitted provided that the following conditions are met: 728e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 1. Redistributions of source code must retain the above copyright notice, 928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * this list of conditions and the following disclaimer. 1028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 2. Redistributions in binary form must reproduce the above copyright notice, 1128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * this list of conditions and the following disclaimer in the documentation 1228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * and/or other materials provided with the distribution. 1328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 3. The name of the author may not be used to endorse or promote products 1428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * derived from this software without specific prior written permission. 1528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * 1628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 1728e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 1928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 2228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 2428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 2528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org */ 2728e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 2828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org#ifndef TALK_MEDIA_BASE_AUDIOFRAME_H_ 2928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org#define TALK_MEDIA_BASE_AUDIOFRAME_H_ 3028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 3128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.orgnamespace cricket { 3228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 3328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.orgclass AudioFrame { 3428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org public: 3528e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org AudioFrame() 3628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org : audio10ms_(NULL), 3728e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org length_(0), 3828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org sampling_frequency_(8000), 3928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org stereo_(false) { 4028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org } 410c4e06b4c6107a1b94f764e279e4fb4161e905b0Peter Boström AudioFrame(int16_t* audio, size_t audio_length, int sample_freq, bool stereo) 4228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org : audio10ms_(audio), 4328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org length_(audio_length), 4428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org sampling_frequency_(sample_freq), 450c4e06b4c6107a1b94f764e279e4fb4161e905b0Peter Boström stereo_(stereo) {} 4628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 470c4e06b4c6107a1b94f764e279e4fb4161e905b0Peter Boström int16_t* GetData() { return audio10ms_; } 4828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org size_t GetSize() const { return length_; } 4928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org int GetSamplingFrequency() const { return sampling_frequency_; } 5028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org bool GetStereo() const { return stereo_; } 5128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 5228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org private: 5328e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org // TODO(janahan): currently the data is not owned by this class. 5428e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org // add ownership when we come up with the first use case that requires it. 550c4e06b4c6107a1b94f764e279e4fb4161e905b0Peter Boström int16_t* audio10ms_; 5628e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org size_t length_; 5728e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org int sampling_frequency_; 5828e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org bool stereo_; 5928e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org}; 6028e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org 6128e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org} // namespace cricket 6228e20752806a492f5a6a5d343c02f9556f39b1cdhenrike@webrtc.org#endif // TALK_MEDIA_BASE_AUDIOFRAME_H_ 63