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-2020 Live Networks, Inc. All rights reserved.
18// Descriptor preceding frames of 'ADU' MP3 streams (for improved loss-tolerance)
19// C++ header
20
21#ifndef _MP3_ADU_DESCRIPTOR_HH
22#define _MP3_ADU_DESCRIPTOR_HH
23
24// A class for handling the descriptor that begins each ADU frame:
25// (Note: We don't yet implement fragmentation)
26class ADUdescriptor {
27public:
28 // Operations for generating a new descriptor
29 static unsigned computeSize(unsigned remainingFrameSize) {
30 return remainingFrameSize >= 64 ? 2 : 1;
31 }
32 static unsigned generateDescriptor(unsigned char*& toPtr, unsigned remainingFrameSize);
33 // returns descriptor size; increments "toPtr" afterwards
34 static void generateTwoByteDescriptor(unsigned char*& toPtr, unsigned remainingFrameSize);
35 // always generates a 2-byte descriptor, even if "remainingFrameSize" is
36 // small enough for a 1-byte descriptor
37
38 // Operations for reading a descriptor
39 static unsigned getRemainingFrameSize(unsigned char*& fromPtr);
40 // increments "fromPtr" afterwards
41};
42
43#endif
44