diff --git a/src/audio/audiocodec.cpp b/src/audio/audiocodec.cpp deleted file mode 100644 index 4e0899b69dd82018a95340f995435f5248996594..0000000000000000000000000000000000000000 --- a/src/audio/audiocodec.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * This 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, - * or (at your option) any later version. - * - * This 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 dpkg; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <iostream> -#include <string> - -#include "audiocodec.h" - -AudioCodec::AudioCodec (int payload, const std::string &codecName) - : _codecName(codecName) -{ - _payload = payload; - _clockRate = 8000; // default - _channel = 1; // default - _active = false; - - _hasDynamicPayload = (_payload >= 96 && _payload <= 127) ? true : false; -} - -AudioCodec::~AudioCodec (void) -{ -} diff --git a/src/audio/codec_alaw.so b/src/audio/codec_alaw.so deleted file mode 100755 index 9c1a8446e9dd3b0662deef9bce208deadac3401e..0000000000000000000000000000000000000000 Binary files a/src/audio/codec_alaw.so and /dev/null differ diff --git a/src/audio/codec_gsm.so b/src/audio/codec_gsm.so deleted file mode 100755 index 16846e53f4752c1f9bd4569ee056bd7aaec04782..0000000000000000000000000000000000000000 Binary files a/src/audio/codec_gsm.so and /dev/null differ diff --git a/src/audio/codec_ilbc.so b/src/audio/codec_ilbc.so deleted file mode 100755 index 28b1ae6dc3b2f617159f698be82fa514184492ee..0000000000000000000000000000000000000000 Binary files a/src/audio/codec_ilbc.so and /dev/null differ diff --git a/src/audio/codec_ulaw.so b/src/audio/codec_ulaw.so deleted file mode 100755 index 3cdfe0f32e8905a4dd86b4f2f8ce6597ca364655..0000000000000000000000000000000000000000 Binary files a/src/audio/codec_ulaw.so and /dev/null differ diff --git a/src/audio/g711.cpp b/src/audio/g711.cpp deleted file mode 100644 index a9520b7660dccd2638d5012abe63f5dc6382b417..0000000000000000000000000000000000000000 --- a/src/audio/g711.cpp +++ /dev/null @@ -1,279 +0,0 @@ -/** - * Copyright (C) 2005 Savoir-Faire Linux inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * - Implementation of ITU-T (formerly CCITT) Recomendation G711 - - Copyright (C) 2004 J.D.Medhurst (a.k.a. Tixy) - - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public - * License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - */ -#include "common.h" -#include "g711.h" - - -/* -Members of class G711 -*/ - - -uint8 G711::ALawEncode(int16 pcm16) - { - int p = pcm16; - uint a; // A-law value we are forming - if(p<0) - { - // -ve value - // Note, ones compliment is here used here as this keeps encoding symetrical - - // and equal spaced around zero cross-over, (it also matches the standard). - p = ~p; - a = 0x00; // sign = 0 - } - else - { - // +ve value - a = 0x80; // sign = 1 - } - - // Calculate segment and interval numbers - p >>= 4; - if(p>=0x20) - { - if(p>=0x100) - { - p >>= 4; - a += 0x40; - } - if(p>=0x40) - { - p >>= 2; - a += 0x20; - } - if(p>=0x20) - { - p >>= 1; - a += 0x10; - } - } - // a&0x70 now holds segment value and 'p' the interval number - - a += p; // a now equal to encoded A-law value - - return a^0x55; // A-law has alternate bits inverted for transmission - } - - -int G711::ALawDecode(uint8 alaw) - { - alaw ^= 0x55; // A-law has alternate bits inverted for transmission - - uint sign = alaw&0x80; - - int linear = alaw&0x1f; - linear <<= 4; - linear += 8; // Add a 'half' bit (0x08) to place PCM value in middle of range - - alaw &= 0x7f; - if(alaw>=0x20) - { - linear |= 0x100; // Put in MSB - uint shift = (alaw>>4)-1; - linear <<= shift; - } - - if(!sign) - return -linear; - else - return linear; - } - - -uint8 G711::ULawEncode(int16 pcm16) - { - int p = pcm16; - uint u; // u-law value we are forming - - if(p<0) - { - // -ve value - // Note, ones compliment is here used here as this keeps encoding symetrical - // and equal spaced around zero cross-over, (it also matches the standard). - p = ~p; - u = 0x80^0x10^0xff; // Sign bit = 1 (^0x10 because this will get inverted later) ^0xff ^0xff to invert final u-Law code - } - else - { - // +ve value - u = 0x00^0x10^0xff; // Sign bit = 0 (-0x10 because this amount extra will get added later) ^0xff to invert final u-Law code - } - - p += 0x84; // Add uLaw bias - - if(p>0x7f00) - p = 0x7f00; // Clip to 15 bits - - // Calculate segment and interval numbers - p >>= 3; // Shift down to 13bit - if(p>=0x100) - { - p >>= 4; - u ^= 0x40; - } - if(p>=0x40) - { - p >>= 2; - u ^= 0x20; - } - if(p>=0x20) - { - p >>= 1; - u ^= 0x10; - } - // (u^0x10)&0x70 now equal to the segment value and 'p' the interval number (^0x10) - - u ^= p; // u now equal to encoded u-law value (with all bits inverted) - - return u; - } - - -int G711::ULawDecode(uint8 ulaw) - { - ulaw ^= 0xff; // u-law has all bits inverted for transmission - - int linear = ulaw&0x0f; - linear <<= 3; - linear |= 0x84; // Set MSB (0x80) and a 'half' bit (0x04) to place PCM value in middle of range - - uint shift = ulaw>>4; - shift &= 7; - linear <<= shift; - - linear -= 0x84; // Subract uLaw bias - - if(ulaw&0x80) - return -linear; - else - return linear; - } - - -uint8 G711::ALawToULaw(uint8 alaw) - { - uint8 sign=alaw&0x80; - alaw ^= sign; - alaw ^= 0x55; - uint ulaw; - if(alaw<45) - { - if(alaw<24) - ulaw = (alaw<8) ? (alaw<<1)+1 : alaw+8; - else - ulaw = (alaw<32) ? (alaw>>1)+20 : alaw+4; - } - else - { - if(alaw<63) - ulaw = (alaw<47) ? alaw+3 : alaw+2; - else - ulaw = (alaw<79) ? alaw+1 : alaw; - } - ulaw ^= sign; - return ulaw^0x7f; - } - - -uint8 G711::ULawToALaw(uint8 ulaw) - { - uint8 sign=ulaw&0x80; - ulaw ^= sign; - ulaw ^= 0x7f; - uint alaw; - if(ulaw<48) - { - if(ulaw<=32) - alaw = (ulaw<=15) ? ulaw>>1 : ulaw-8; - else - alaw = (ulaw<=35) ? (ulaw<<1)-40 : ulaw-4; - } - else - { - if(ulaw<=63) - alaw = (ulaw==48) ? ulaw-3 : ulaw-2; - else - alaw = (ulaw<=79) ? ulaw-1 : ulaw; - } - alaw ^= sign; - return alaw^0x55; - } - - -uint G711::ALawEncode(uint8* dst, int16* src, uint srcSize) - { - srcSize >>= 1; - uint8* end = dst+srcSize; - while(dst<end) - *dst++ = ALawEncode(*src++); - return srcSize; - } - - -uint G711::ALawDecode(int16* dst, uint8* src, uint srcSize) - { - int16* end = dst+srcSize; - while(dst<end) - *dst++ = ALawDecode(*src++); - return srcSize<<1; - } - - -uint G711::ULawEncode(uint8* dst, int16* src, uint srcSize) - { - srcSize >>= 1; - uint8* end = dst+srcSize; - while(dst<end) - *dst++ = ULawEncode(*src++); - return srcSize; - } - - -uint G711::ULawDecode(int16* dst, uint8* src, uint srcSize) - { - int16* end = dst+srcSize; - while(dst<end) - *dst++ = ULawDecode(*src++); - return srcSize<<1; - } - - -uint G711::ALawToULaw(uint8* dst, uint8* src, uint srcSize) - { - uint8* end = dst+srcSize; - while(dst<end) - *dst++ = ALawToULaw(*src++); - return srcSize; - } - - -uint G711::ULawToALaw(uint8* dst, uint8* src, uint srcSize) - { - uint8* end = dst+srcSize; - while(dst<end) - *dst++ = ULawToALaw(*src++); - return srcSize; - } diff --git a/src/audio/g711.h b/src/audio/g711.h deleted file mode 100644 index c3d6b56dd678c6e57bea27a54ab40f0b102f9db5..0000000000000000000000000000000000000000 --- a/src/audio/g711.h +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Copyright (C) 2005 Savoir-Faire Linux inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * - Implementation of ITU-T (formerly CCITT) Recomendation G711 - - Copyright (C) 2004 J.D.Medhurst (a.k.a. Tixy) - - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. - * - * This program 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 Library General Public - * License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - */ -#ifndef __G711_H__ -#define __G711_H__ - -#include "common.h" - -/** -A class which implements ITU-T (formerly CCITT) Recomendation G711 -"Pulse Code Modulation (PCM) of Voice Frequencies" - -This encodes and decodes uniform PCM values to/from 8 bit A-law and u-Law values. - -Note, the methods in this class use uniform PCM values which are of 16 bits precision, -these are 'left justified' values corresponding to the 13 and 14 bit values described -in G711. -*/ -class G711 - { -public: - /** - Encode a 16 bit uniform PCM value into an A-Law value - @param pcm16 A 16 bit uniform PCM value (sign extented into an int). - If the value doesn't lie in the range -32768 to 32767 then the - result is undefined. - @return The A-Law encoded value corresponding to pcm16 - */ - static uint8 ALawEncode(int16 pcm16); - - /** - Encode an A-Law value into a 16 bit uniform PCM value - @param alaw An A-Law encoded value - @return The 16 bit uniform PCM value corresponding to alaw - */ - static int ALawDecode(uint8 alaw); - - /** - Encode a 16 bit uniform PCM value into an u-Law value - @param pcm16 A 16 bit uniform PCM value (sign extented into an int) - If the value doesn't lie in the range -32768 to 32767 then the - result is undefined. - @return The u-Law encoded value corresponding to pcm16 - */ - static uint8 ULawEncode(int16 pcm16); - - /** - Encode an u-Law value into a 16 bit uniform PCM value - @param ulaw An u-Law encoded value - @return The 16 bit uniform PCM value corresponding to ulaw - */ - static int ULawDecode(uint8 ulaw); - - /** - Convert an A-Law value into a u-law value. - @param alaw An A-Law encoded value - @return The u-law value. - */ - static uint8 ALawToULaw(uint8 alaw); - - /** - Convert a u-Law value into an A-law value. - @param ulaw An u-Law encoded value - @return The A-Law value - */ - static uint8 ULawToALaw(uint8 ulaw); - - /** - Encode a buffer of 16 bit uniform PCM values into A-Law values - @param dst Pointer to location to store A-Law encoded values - @param src Pointer to the buffer of 16 bit uniform PCM values to be encoded - @param srcSize The size in bytes of the src buffer - @return The number of bytes which were stored at dst (equal to srcSize>>1) - */ - static uint ALawEncode(uint8* dst, int16* src, uint srcSize); - - /** - Decode a buffer of A-Law values into 16 bit uniform PCM values - @param dst Pointer to location to store decoded 16 bit uniform PCM values - @param src Pointer to the buffer of A-Law values to be decoded - @param srcSize The size in bytes of the src buffer - @return The number of bytes which were stored at dst (equal to srcSize<<1) - */ - static uint ALawDecode(int16* dst, uint8* src, uint srcSize); - - /** - Encode a buffer of 16 bit uniform PCM values into u-Law values - @param dst Pointer to location to store u-Law encoded values - @param src Pointer to the buffer of 16 bit uniform PCM values to be encoded - @param srcSize The size in bytes of the src buffer - @return The number of bytes which were stored at dst (equal to srcSize>>1) - */ - static uint ULawEncode(uint8* dst, int16* src, uint srcSize); - - /** - Decode a buffer of u-Law values into 16 bit uniform PCM values - @param dst Pointer to location to store decoded 16 bit uniform PCM values - @param src Pointer to the buffer of u-Law values to be decoded - @param srcSize The size in bytes of the src buffer - @return The number of bytes which were stored at dst (equal to srcSize<<1) - */ - static uint ULawDecode(int16* dst, uint8* src, uint srcSize); - - /** - Convert a buffer of A-Law value into u-law values. - @param dst Pointer to location to store u-law values - @param src Pointer to the buffer of A-Law values to be converted - @param srcSize The size in bytes of the src buffer - @return The number of bytes which were stored at dst (equal to srcSize) - */ - static uint ALawToULaw(uint8* dst, uint8* src, uint srcSize); - - /** - Convert a buffer of u-Law value into A-law values. - @param dst Pointer to location to store A-law values - @param src Pointer to the buffer of u-Law values to be converted - @param srcSize The size in bytes of the src buffer - @return The number of bytes which were stored at dst (equal to srcSize) - */ - static uint ULawToALaw(uint8* dst, uint8* src, uint srcSize); - }; - -#endif -