# g711codec.h

Go to the documentation of this file.

    00001 /*
    00002  * g711codec.h
    00003  *
    00004  * Open Phone Abstraction Library (OPAL)
    00005  * Formally known as the Open H323 project.
    00006  *
    00007  * Copyright (c) 2001 Equivalence Pty. Ltd.
    00008  *
    00009  * The contents of this file are subject to the Mozilla Public License
    00010  * Version 1.0 (the "License"); you may not use this file except in
    00011  * compliance with the License. You may obtain a copy of the License at
    00012  * http://www.mozilla.org/MPL/
    00013  *
    00014  * Software distributed under the License is distributed on an "AS IS"
    00015  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
    00016  * the License for the specific language governing rights and limitations
    00017  * under the License.
    00018  *
    00019  * The Original Code is Open Phone Abstraction Library.
    00020  *
    00021  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
    00022  *
    00023  * Contributor(s): ______________________________________.
    00024  *
    00025  * $Revision: 21988 $
    00026  * $Author: rjongbloed $
    00027  * $Date: 2009-02-04 00:28:03 -0600 (Wed, 04 Feb 2009) $
    00028  */
    00029
    00030 #ifndef OPAL_CODEC_G711CODEC_H
    00031 #define OPAL_CODEC_G711CODEC_H
    00032
    00033 #ifdef P_USE_PRAGMA
    00034 #pragma interface
    00035 #endif
    00036
    00037 #include <opal/buildopts.h>
    00038
    00039 #include <opal/transcoders.h>
    00040 #include <codec/g711a1_plc.h>
    00041
    00042
    00044
    00045 class Opal_G711_PCM : public OpalStreamedTranscoder {
    00046   public:
    00047     Opal_G711_PCM(const OpalMediaFormat & inputMediaFormat);
    00048
    00049 #if OPAL_G711PLC
    00050    virtual PBoolean Convert(
    00051       const RTP_DataFrame & input,
    00052       RTP_DataFrame & output
    00053     );
    00054
    00055   protected:
    00056     OpalG711_PLC plc;
    00057     PINDEX       lastPayloadSize;
    00058 #endif
    00059 };
    00060
    00061
    00063
    00064 class Opal_G711_uLaw_PCM : public Opal_G711_PCM {
    00065   public:
    00066     Opal_G711_uLaw_PCM();
    00067     virtual int ConvertOne(int sample) const;
    00068     static int ConvertSample(int sample);
    00069 };
    00070
    00071
    00073
    00074 class Opal_PCM_G711_uLaw : public OpalStreamedTranscoder {
    00075   public:
    00076     Opal_PCM_G711_uLaw();
    00077     virtual int ConvertOne(int sample) const;
    00078     static int ConvertSample(int sample);
    00079 };
    00080
    00081
    00083
    00084 class Opal_G711_ALaw_PCM : public Opal_G711_PCM {
    00085   public:
    00086     Opal_G711_ALaw_PCM();
    00087     virtual int ConvertOne(int sample) const;
    00088     static int ConvertSample(int sample);
    00089 };
    00090
    00091
    00093
    00094 class Opal_PCM_G711_ALaw : public OpalStreamedTranscoder {
    00095   public:
    00096     Opal_PCM_G711_ALaw();
    00097     virtual int ConvertOne(int sample) const;
    00098     static int ConvertSample(int sample);
    00099 };
    00100
    00101
    00103
    00104 #define OPAL_REGISTER_G711() \
    00105 OPAL_REGISTER_TRANSCODER(Opal_G711_uLaw_PCM, OpalG711_ULAW_64K, OpalPCM16); \
    00106 OPAL_REGISTER_TRANSCODER(Opal_PCM_G711_uLaw, OpalPCM16,         OpalG711_ULAW_64K); \
    00107 OPAL_REGISTER_TRANSCODER(Opal_G711_ALaw_PCM, OpalG711_ALAW_64K, OpalPCM16); \
    00108 OPAL_REGISTER_TRANSCODER(Opal_PCM_G711_ALaw, OpalPCM16,         OpalG711_ALAW_64K)
    00109
    00110 #endif // OPAL_CODEC_G711CODEC_H
    00111
    00112