live
uLawAudioFilter.hh
Go to the documentation of this file.
1 /**********
2 This library is free software; you can redistribute it and/or modify it under
3 the terms of the GNU Lesser General Public License as published by the
4 Free Software Foundation; either version 3 of the License, or (at your
5 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6 
7 This library is distributed in the hope that it will be useful, but WITHOUT
8 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10 more details.
11 
12 You should have received a copy of the GNU Lesser General Public License
13 along with this library; if not, write to the Free Software Foundation, Inc.,
14 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 **********/
16 // "liveMedia"
17 // Copyright (c) 1996-2021 Live Networks, Inc. All rights reserved.
18 // Filters for converting between raw PCM audio and uLaw
19 // C++ header
20 
21 #ifndef _ULAW_AUDIO_FILTER_HH
22 #define _ULAW_AUDIO_FILTER_HH
23 
24 #ifndef _FRAMED_FILTER_HH
25 #include "FramedFilter.hh"
26 #endif
27 
29 
31 public:
34  int byteOrdering = 0);
35  // "byteOrdering" == 0 => host order (the default)
36  // "byteOrdering" == 1 => little-endian order
37  // "byteOrdering" == 2 => network (i.e., big-endian) order
38 
39 protected:
41  int byteOrdering);
42  // called only by createNew()
44 
45 private:
46  // Redefined virtual functions:
47  virtual void doGetNextFrame();
48 
49 private:
50  static void afterGettingFrame(void* clientData, unsigned frameSize,
51  unsigned numTruncatedBytes,
52  struct timeval presentationTime,
53  unsigned durationInMicroseconds);
54  void afterGettingFrame1(unsigned frameSize,
55  unsigned numTruncatedBytes,
56  struct timeval presentationTime,
57  unsigned durationInMicroseconds);
58 
59 private:
61  unsigned char* fInputBuffer;
62  unsigned fInputBufferSize;
63 };
64 
65 
67 
69 public:
72 
73 protected:
76  // called only by createNew()
78 
79 private:
80  // Redefined virtual functions:
81  virtual void doGetNextFrame();
82 
83 private:
84  static void afterGettingFrame(void* clientData, unsigned frameSize,
85  unsigned numTruncatedBytes,
86  struct timeval presentationTime,
87  unsigned durationInMicroseconds);
88  void afterGettingFrame1(unsigned frameSize,
89  unsigned numTruncatedBytes,
90  struct timeval presentationTime,
91  unsigned durationInMicroseconds);
92 
93 private:
94  unsigned char* fInputBuffer;
95  unsigned fInputBufferSize;
96 };
97 
98 
100 
102 public:
103  static NetworkFromHostOrder16*
105 
106 protected:
108  // called only by createNew()
110 
111 private:
112  // Redefined virtual functions:
113  virtual void doGetNextFrame();
114 
115 private:
116  static void afterGettingFrame(void* clientData, unsigned frameSize,
117  unsigned numTruncatedBytes,
118  struct timeval presentationTime,
119  unsigned durationInMicroseconds);
120  void afterGettingFrame1(unsigned frameSize,
121  unsigned numTruncatedBytes,
122  struct timeval presentationTime,
123  unsigned durationInMicroseconds);
124 };
125 
126 
128 
130 public:
131  static HostFromNetworkOrder16*
133 
134 protected:
136  // called only by createNew()
138 
139 private:
140  // Redefined virtual functions:
141  virtual void doGetNextFrame();
142 
143 private:
144  static void afterGettingFrame(void* clientData, unsigned frameSize,
145  unsigned numTruncatedBytes,
146  struct timeval presentationTime,
147  unsigned durationInMicroseconds);
148  void afterGettingFrame1(unsigned frameSize,
149  unsigned numTruncatedBytes,
150  struct timeval presentationTime,
151  unsigned durationInMicroseconds);
152 };
153 
154 
156 
157 class EndianSwap16: public FramedFilter {
158 public:
160 
161 protected:
163  // called only by createNew()
164  virtual ~EndianSwap16();
165 
166 private:
167  // Redefined virtual functions:
168  virtual void doGetNextFrame();
169 
170 private:
171  static void afterGettingFrame(void* clientData, unsigned frameSize,
172  unsigned numTruncatedBytes,
173  struct timeval presentationTime,
174  unsigned durationInMicroseconds);
175  void afterGettingFrame1(unsigned frameSize,
176  unsigned numTruncatedBytes,
177  struct timeval presentationTime,
178  unsigned durationInMicroseconds);
179 };
180 
181 
183 
184 class EndianSwap24: public FramedFilter {
185 public:
187 
188 protected:
190  // called only by createNew()
191  virtual ~EndianSwap24();
192 
193 private:
194  // Redefined virtual functions:
195  virtual void doGetNextFrame();
196 
197 private:
198  static void afterGettingFrame(void* clientData, unsigned frameSize,
199  unsigned numTruncatedBytes,
200  struct timeval presentationTime,
201  unsigned durationInMicroseconds);
202  void afterGettingFrame1(unsigned frameSize,
203  unsigned numTruncatedBytes,
204  struct timeval presentationTime,
205  unsigned durationInMicroseconds);
206 };
207 
208 #endif
void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
virtual ~EndianSwap16()
static EndianSwap16 * createNew(UsageEnvironment &env, FramedSource *inputSource)
virtual void doGetNextFrame()
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
EndianSwap16(UsageEnvironment &env, FramedSource *inputSource)
static EndianSwap24 * createNew(UsageEnvironment &env, FramedSource *inputSource)
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
virtual ~EndianSwap24()
virtual void doGetNextFrame()
void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
EndianSwap24(UsageEnvironment &env, FramedSource *inputSource)
FramedSource * inputSource() const
Definition: FramedFilter.hh:30
virtual void doGetNextFrame()
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
static HostFromNetworkOrder16 * createNew(UsageEnvironment &env, FramedSource *inputSource)
void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
virtual ~HostFromNetworkOrder16()
HostFromNetworkOrder16(UsageEnvironment &env, FramedSource *inputSource)
virtual void doGetNextFrame()
virtual ~NetworkFromHostOrder16()
void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
NetworkFromHostOrder16(UsageEnvironment &env, FramedSource *inputSource)
static NetworkFromHostOrder16 * createNew(UsageEnvironment &env, FramedSource *inputSource)
virtual ~PCMFromuLawAudioSource()
void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
virtual void doGetNextFrame()
PCMFromuLawAudioSource(UsageEnvironment &env, FramedSource *inputSource)
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
unsigned char * fInputBuffer
static PCMFromuLawAudioSource * createNew(UsageEnvironment &env, FramedSource *inputSource)
static uLawFromPCMAudioSource * createNew(UsageEnvironment &env, FramedSource *inputSource, int byteOrdering=0)
unsigned char * fInputBuffer
static void afterGettingFrame(void *clientData, unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
virtual void doGetNextFrame()
void afterGettingFrame1(unsigned frameSize, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
uLawFromPCMAudioSource(UsageEnvironment &env, FramedSource *inputSource, int byteOrdering)
virtual ~uLawFromPCMAudioSource()