1 /* 2 * Copyright (C) 2002-2003 Fhg Fokus 3 * 4 * This file is part of SEMS, a free SIP media server. 5 * 6 * SEMS is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. This program is released under 10 * the GPL with the additional exemption that compiling, linking, 11 * and/or using OpenSSL is allowed. 12 * 13 * For a license to use the SEMS software under conditions 14 * other than those described here, or to purchase support for this 15 * software, please contact iptel.org by e-mail at the following addresses: 16 * info@iptel.org 17 * 18 * SEMS is distributed in the hope that it will be useful, 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 * GNU General Public License for more details. 22 * 23 * You should have received a copy of the GNU General Public License 24 * along with this program; if not, write to the Free Software 25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 */ 27 28 #ifndef _AmBufferedAudio_H 29 #define _AmBufferedAudio_H 30 31 #include "AmAudio.h" 32 /** 33 * AmAudio with buffered output 34 */ 35 class AmBufferedAudio : public AmAudio { 36 37 unsigned char* output_buffer; 38 size_t output_buffer_size, low_buffer_thresh, full_buffer_thresh; 39 size_t r, w; 40 41 bool eof; 42 int err_code; 43 44 void input_get_audio(unsigned int user_ts); 45 inline void allocateBuffer(); 46 inline void releaseBuffer(); 47 48 protected: 49 AmBufferedAudio(size_t output_buffer_size, size_t low_buffer_thresh, size_t full_buffer_thresh); 50 ~AmBufferedAudio(); 51 52 void clearBufferEOF(); 53 void setBufferSize(size_t _output_buffer_size, size_t _low_buffer_thresh, size_t _full_buffer_thresh); 54 55 public: 56 virtual int get(unsigned long long system_ts, unsigned char* buffer, 57 int output_sample_rate, unsigned int nb_samples); 58 59 }; 60 #endif 61 62 // Local Variables: 63 // mode:C++ 64 // End: 65