liveMedia/include/uLawAudioFilter.hh

Go to the documentation of this file.
00001 /**********
00002 This library is free software; you can redistribute it and/or modify it under
00003 the terms of the GNU Lesser General Public License as published by the
00004 Free Software Foundation; either version 2.1 of the License, or (at your
00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
00006 
00007 This library is distributed in the hope that it will be useful, but WITHOUT
00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00009 FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
00010 more details.
00011 
00012 You should have received a copy of the GNU Lesser General Public License
00013 along with this library; if not, write to the Free Software Foundation, Inc.,
00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015 **********/
00016 // "liveMedia"
00017 // Copyright (c) 1996-2012 Live Networks, Inc.  All rights reserved.
00018 // Filters for converting between raw PCM audio and uLaw
00019 // C++ header
00020 
00021 #ifndef _ULAW_AUDIO_FILTER_HH
00022 #define _ULAW_AUDIO_FILTER_HH
00023 
00024 #ifndef _FRAMED_FILTER_HH
00025 #include "FramedFilter.hh"
00026 #endif
00027 
00029 
00030 class uLawFromPCMAudioSource: public FramedFilter {
00031 public:
00032   static uLawFromPCMAudioSource*
00033   createNew(UsageEnvironment& env, FramedSource* inputSource,
00034             int byteOrdering = 0);
00035   // "byteOrdering" == 0 => host order (the default)
00036   // "byteOrdering" == 1 => little-endian order
00037   // "byteOrdering" == 2 => network (i.e., big-endian) order
00038 
00039 protected:
00040   uLawFromPCMAudioSource(UsageEnvironment& env, FramedSource* inputSource,
00041                          int byteOrdering);
00042       // called only by createNew()
00043   virtual ~uLawFromPCMAudioSource();
00044 
00045 private:
00046   // Redefined virtual functions:
00047   virtual void doGetNextFrame();
00048 
00049 private:
00050   static void afterGettingFrame(void* clientData, unsigned frameSize,
00051                                 unsigned numTruncatedBytes,
00052                                 struct timeval presentationTime,
00053                                 unsigned durationInMicroseconds);
00054   void afterGettingFrame1(unsigned frameSize,
00055                           unsigned numTruncatedBytes,
00056                           struct timeval presentationTime,
00057                           unsigned durationInMicroseconds);
00058 
00059 private:
00060   int fByteOrdering;
00061   unsigned char* fInputBuffer;
00062   unsigned fInputBufferSize;
00063 };
00064 
00065 
00067 
00068 class PCMFromuLawAudioSource: public FramedFilter {
00069 public:
00070   static PCMFromuLawAudioSource*
00071   createNew(UsageEnvironment& env, FramedSource* inputSource);
00072 
00073 protected:
00074   PCMFromuLawAudioSource(UsageEnvironment& env,
00075                          FramedSource* inputSource);
00076       // called only by createNew()
00077   virtual ~PCMFromuLawAudioSource();
00078 
00079 private:
00080   // Redefined virtual functions:
00081   virtual void doGetNextFrame();
00082 
00083 private:
00084   static void afterGettingFrame(void* clientData, unsigned frameSize,
00085                                 unsigned numTruncatedBytes,
00086                                 struct timeval presentationTime,
00087                                 unsigned durationInMicroseconds);
00088   void afterGettingFrame1(unsigned frameSize,
00089                           unsigned numTruncatedBytes,
00090                           struct timeval presentationTime,
00091                           unsigned durationInMicroseconds);
00092 
00093 private:
00094   unsigned char* fInputBuffer;
00095   unsigned fInputBufferSize;
00096 };
00097 
00098 
00100 
00101 class NetworkFromHostOrder16: public FramedFilter {
00102 public:
00103   static NetworkFromHostOrder16*
00104   createNew(UsageEnvironment& env, FramedSource* inputSource);
00105 
00106 protected:
00107   NetworkFromHostOrder16(UsageEnvironment& env, FramedSource* inputSource);
00108       // called only by createNew()
00109   virtual ~NetworkFromHostOrder16();
00110 
00111 private:
00112   // Redefined virtual functions:
00113   virtual void doGetNextFrame();
00114 
00115 private:
00116   static void afterGettingFrame(void* clientData, unsigned frameSize,
00117                                 unsigned numTruncatedBytes,
00118                                 struct timeval presentationTime,
00119                                 unsigned durationInMicroseconds);
00120   void afterGettingFrame1(unsigned frameSize,
00121                           unsigned numTruncatedBytes,
00122                           struct timeval presentationTime,
00123                           unsigned durationInMicroseconds);
00124 };
00125 
00126 
00128 
00129 class HostFromNetworkOrder16: public FramedFilter {
00130 public:
00131   static HostFromNetworkOrder16*
00132   createNew(UsageEnvironment& env, FramedSource* inputSource);
00133 
00134 protected:
00135   HostFromNetworkOrder16(UsageEnvironment& env, FramedSource* inputSource);
00136       // called only by createNew()
00137   virtual ~HostFromNetworkOrder16();
00138 
00139 private:
00140   // Redefined virtual functions:
00141   virtual void doGetNextFrame();
00142 
00143 private:
00144   static void afterGettingFrame(void* clientData, unsigned frameSize,
00145                                 unsigned numTruncatedBytes,
00146                                 struct timeval presentationTime,
00147                                 unsigned durationInMicroseconds);
00148   void afterGettingFrame1(unsigned frameSize,
00149                           unsigned numTruncatedBytes,
00150                           struct timeval presentationTime,
00151                           unsigned durationInMicroseconds);
00152 };
00153 
00154 
00156 
00157 class EndianSwap16: public FramedFilter {
00158 public:
00159   static EndianSwap16* createNew(UsageEnvironment& env, FramedSource* inputSource);
00160 
00161 protected:
00162   EndianSwap16(UsageEnvironment& env, FramedSource* inputSource);
00163       // called only by createNew()
00164   virtual ~EndianSwap16();
00165 
00166 private:
00167   // Redefined virtual functions:
00168   virtual void doGetNextFrame();
00169 
00170 private:
00171   static void afterGettingFrame(void* clientData, unsigned frameSize,
00172                                 unsigned numTruncatedBytes,
00173                                 struct timeval presentationTime,
00174                                 unsigned durationInMicroseconds);
00175   void afterGettingFrame1(unsigned frameSize,
00176                           unsigned numTruncatedBytes,
00177                           struct timeval presentationTime,
00178                           unsigned durationInMicroseconds);
00179 };
00180 
00181 #endif

Generated on Thu May 17 07:11:46 2012 for live by  doxygen 1.5.2