live
MP3ADUdescriptor.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-2022 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)
27 public:
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
static unsigned generateDescriptor(unsigned char *&toPtr, unsigned remainingFrameSize)
static unsigned getRemainingFrameSize(unsigned char *&fromPtr)
static void generateTwoByteDescriptor(unsigned char *&toPtr, unsigned remainingFrameSize)
static unsigned computeSize(unsigned remainingFrameSize)