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-2020 Live Networks, Inc. All rights reserved. |
18 | // MPEG-4 audio, using LATM multiplexing |
19 | // C++ header |
20 | |
21 | #ifndef _MPEG4_LATM_AUDIO_RTP_SOURCE_HH |
22 | #define _MPEG4_LATM_AUDIO_RTP_SOURCE_HH |
23 | |
24 | #ifndef _MULTI_FRAMED_RTP_SOURCE_HH |
25 | #include "MultiFramedRTPSource.hh" |
26 | #endif |
27 | |
28 | class MPEG4LATMAudioRTPSource: public MultiFramedRTPSource { |
29 | public: |
30 | static MPEG4LATMAudioRTPSource* |
31 | createNew(UsageEnvironment& env, Groupsock* RTPgs, |
32 | unsigned char rtpPayloadFormat, |
33 | unsigned rtpTimestampFrequency); |
34 | |
35 | // By default, the LATM data length field is included at the beginning of each |
36 | // returned frame. To omit this field, call the following: |
37 | void omitLATMDataLengthField(); |
38 | |
39 | Boolean returnedFrameIncludesLATMDataLengthField() const { return fIncludeLATMDataLengthField; } |
40 | |
41 | protected: |
42 | virtual ~MPEG4LATMAudioRTPSource(); |
43 | |
44 | private: |
45 | MPEG4LATMAudioRTPSource(UsageEnvironment& env, Groupsock* RTPgs, |
46 | unsigned char rtpPayloadFormat, |
47 | unsigned rtpTimestampFrequency); |
48 | // called only by createNew() |
49 | |
50 | private: |
51 | // redefined virtual functions: |
52 | virtual Boolean (BufferedPacket* packet, |
53 | unsigned& ); |
54 | virtual char const* MIMEtype() const; |
55 | |
56 | private: |
57 | Boolean fIncludeLATMDataLengthField; |
58 | }; |
59 | |
60 | |
61 | // A utility for parsing a "StreamMuxConfig" string |
62 | Boolean |
63 | parseStreamMuxConfigStr(char const* configStr, |
64 | // result parameters: |
65 | Boolean& audioMuxVersion, |
66 | Boolean& allStreamsSameTimeFraming, |
67 | unsigned char& numSubFrames, |
68 | unsigned char& numProgram, |
69 | unsigned char& numLayer, |
70 | unsigned char*& audioSpecificConfig, |
71 | unsigned& audioSpecificConfigSize); |
72 | // Parses "configStr" as a sequence of hexadecimal digits, representing |
73 | // a "StreamMuxConfig" (as defined in ISO.IEC 14496-3, table 1.21). |
74 | // Returns, in "audioSpecificConfig", a binary representation of |
75 | // the enclosed "AudioSpecificConfig" structure (of size |
76 | // "audioSpecificConfigSize" bytes). The memory for this is allocated |
77 | // dynamically by this function; the caller is responsible for |
78 | // freeing it. Other values, that precede "AudioSpecificConfig", |
79 | // are returned in the other parameters. |
80 | // Returns True iff the parsing succeeds. |
81 | // IMPORTANT NOTE: The implementation of this function currently assumes |
82 | // that everything after the first "numLayer" field is an |
83 | // "AudioSpecificConfig". Therefore, it will not work properly if |
84 | // "audioMuxVersion" != 0, "numProgram" > 0, or "numLayer" > 0. |
85 | // Also, any 'other data' or CRC info will be included at |
86 | // the end of "audioSpecificConfig". |
87 | |
88 | unsigned char* parseStreamMuxConfigStr(char const* configStr, |
89 | // result parameter: |
90 | unsigned& audioSpecificConfigSize); |
91 | // A variant of the above that returns just the "AudioSpecificConfig" data |
92 | // (or NULL) if the parsing failed, without bothering with the other |
93 | // result parameters. |
94 | |
95 | unsigned char* parseGeneralConfigStr(char const* configStr, |
96 | // result parameter: |
97 | unsigned& configSize); |
98 | // A routine that parses an arbitrary config string, returning |
99 | // the result in binary form. |
100 | |
101 | #endif |
102 | |