live
MP3ADUinterleaving.hh
Go to the documentation of this file.
1/**********
2This library is free software; you can redistribute it and/or modify it under
3the terms of the GNU Lesser General Public License as published by the
4Free Software Foundation; either version 3 of the License, or (at your
5option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
6
7This library is distributed in the hope that it will be useful, but WITHOUT
8ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
10more details.
11
12You should have received a copy of the GNU Lesser General Public License
13along with this library; if not, write to the Free Software Foundation, Inc.,
1451 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15**********/
16// "liveMedia"
17// Copyright (c) 1996-2024 Live Networks, Inc. All rights reserved.
18// Interleaving of MP3 ADUs
19// C++ header
20
21#ifndef _MP3_ADU_INTERLEAVING_HH
22#define _MP3_ADU_INTERLEAVING_HH
23
24#ifndef _FRAMED_FILTER_HH
25#include "FramedFilter.hh"
26#endif
27
28// A data structure used to represent an interleaving
29#define MAX_CYCLE_SIZE 256
31public:
32 Interleaving(unsigned cycleSize, unsigned char const* cycleArray);
33 virtual ~Interleaving();
34
35 unsigned cycleSize() const {return fCycleSize;}
36 unsigned char lookupInverseCycle(unsigned char index) const {
37 return fInverseCycle[index];
38 }
39
40private:
41 unsigned fCycleSize;
43};
44
45// This class is used only as a base for the following two:
46
48protected:
51 // abstract base class
53
55 char const* inputSourceName);
56 static void afterGettingFrame(void* clientData,
57 unsigned numBytesRead,
58 unsigned numTruncatedBytes,
59 struct timeval presentationTime,
60 unsigned durationInMicroseconds);
61 virtual void afterGettingFrame(unsigned numBytesRead,
62 struct timeval presentationTime,
63 unsigned durationInMicroseconds) = 0;
64};
65
66// This class is used to convert an ADU sequence from non-interleaved
67// to interleaved form:
68
70public:
72 Interleaving const& interleaving,
74
75protected:
77 Interleaving const& interleaving,
79 // called only by createNew()
81
82private:
83 // redefined virtual functions:
84 virtual void doGetNextFrame();
85 virtual void afterGettingFrame(unsigned numBytesRead,
86 struct timeval presentationTime,
87 unsigned durationInMicroseconds);
88
89private:
91
92private:
94 class InterleavingFrames* fFrames;
96 unsigned fII, fICC;
97};
98
99// This class is used to convert an ADU sequence from interleaved
100// to non-interleaved form:
101
103public:
106
107protected:
110 // called only by createNew()
112
113private:
114 // redefined virtual functions:
115 virtual void doGetNextFrame();
116 virtual void afterGettingFrame(unsigned numBytesRead,
117 struct timeval presentationTime,
118 unsigned durationInMicroseconds);
119
120private:
122
123private:
124 class DeinterleavingFrames* fFrames;
126};
127
128#endif
129
#define MAX_CYCLE_SIZE
FramedSource * inputSource() const
Definition: FramedFilter.hh:30
unsigned char lookupInverseCycle(unsigned char index) const
virtual ~Interleaving()
Interleaving(unsigned cycleSize, unsigned char const *cycleArray)
unsigned cycleSize() const
unsigned char fInverseCycle[MAX_CYCLE_SIZE]
virtual ~MP3ADUdeinterleaver()
virtual void afterGettingFrame(unsigned numBytesRead, struct timeval presentationTime, unsigned durationInMicroseconds)
MP3ADUdeinterleaver(UsageEnvironment &env, FramedSource *inputSource)
static MP3ADUdeinterleaver * createNew(UsageEnvironment &env, FramedSource *inputSource)
virtual void doGetNextFrame()
class DeinterleavingFrames * fFrames
virtual void afterGettingFrame(unsigned numBytesRead, struct timeval presentationTime, unsigned durationInMicroseconds)=0
static void afterGettingFrame(void *clientData, unsigned numBytesRead, unsigned numTruncatedBytes, struct timeval presentationTime, unsigned durationInMicroseconds)
MP3ADUinterleaverBase(UsageEnvironment &env, FramedSource *inputSource)
virtual ~MP3ADUinterleaverBase()
static FramedSource * getInputSource(UsageEnvironment &env, char const *inputSourceName)
virtual ~MP3ADUinterleaver()
void releaseOutgoingFrame()
unsigned char fPositionOfNextIncomingFrame
static MP3ADUinterleaver * createNew(UsageEnvironment &env, Interleaving const &interleaving, FramedSource *inputSource)
Interleaving const fInterleaving
virtual void afterGettingFrame(unsigned numBytesRead, struct timeval presentationTime, unsigned durationInMicroseconds)
MP3ADUinterleaver(UsageEnvironment &env, Interleaving const &interleaving, FramedSource *inputSource)
class InterleavingFrames * fFrames
virtual void doGetNextFrame()