00001 /********** 00002 This library is free software; you can redistribute it and/or modify it under 00003 the terms of the GNU Lesser General Public License as published by the 00004 Free Software Foundation; either version 2.1 of the License, or (at your 00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.) 00006 00007 This library is distributed in the hope that it will be useful, but WITHOUT 00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00009 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00010 more details. 00011 00012 You should have received a copy of the GNU Lesser General Public License 00013 along with this library; if not, write to the Free Software Foundation, Inc., 00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00015 **********/ 00016 // "liveMedia" 00017 // Copyright (c) 1996-2008 Live Networks, Inc. All rights reserved. 00018 // MPEG-4 audio, using LATM multiplexing 00019 // C++ header 00020 00021 #ifndef _MPEG4_LATM_AUDIO_RTP_SOURCE_HH 00022 #define _MPEG4_LATM_AUDIO_RTP_SOURCE_HH 00023 00024 #ifndef _MULTI_FRAMED_RTP_SOURCE_HH 00025 #include "MultiFramedRTPSource.hh" 00026 #endif 00027 00028 class MPEG4LATMAudioRTPSource: public MultiFramedRTPSource { 00029 public: 00030 static MPEG4LATMAudioRTPSource* 00031 createNew(UsageEnvironment& env, Groupsock* RTPgs, 00032 unsigned char rtpPayloadFormat, 00033 unsigned rtpTimestampFrequency); 00034 00035 // By default, the LATM data length field is included at the beginning of each 00036 // returned frame. To omit this field, call the following: 00037 void omitLATMDataLengthField(); 00038 00039 Boolean returnedFrameIncludesLATMDataLengthField() const { return fIncludeLATMDataLengthField; } 00040 00041 protected: 00042 virtual ~MPEG4LATMAudioRTPSource(); 00043 00044 private: 00045 MPEG4LATMAudioRTPSource(UsageEnvironment& env, Groupsock* RTPgs, 00046 unsigned char rtpPayloadFormat, 00047 unsigned rtpTimestampFrequency); 00048 // called only by createNew() 00049 00050 private: 00051 // redefined virtual functions: 00052 virtual Boolean processSpecialHeader(BufferedPacket* packet, 00053 unsigned& resultSpecialHeaderSize); 00054 virtual char const* MIMEtype() const; 00055 00056 private: 00057 Boolean fIncludeLATMDataLengthField; 00058 }; 00059 00060 00061 // A utility for parsing a "StreamMuxConfig" string 00062 Boolean 00063 parseStreamMuxConfigStr(char const* configStr, 00064 // result parameters: 00065 Boolean& audioMuxVersion, 00066 Boolean& allStreamsSameTimeFraming, 00067 unsigned char& numSubFrames, 00068 unsigned char& numProgram, 00069 unsigned char& numLayer, 00070 unsigned char*& audioSpecificConfig, 00071 unsigned& audioSpecificConfigSize); 00072 // Parses "configStr" as a sequence of hexadecimal digits, representing 00073 // a "StreamMuxConfig" (as defined in ISO.IEC 14496-3, table 1.21). 00074 // Returns, in "audioSpecificConfig", a binary representation of 00075 // the enclosed "AudioSpecificConfig" structure (of size 00076 // "audioSpecificConfigSize" bytes). The memory for this is allocated 00077 // dynamically by this function; the caller is responsible for 00078 // freeing it. Other values, that precede "AudioSpecificConfig", 00079 // are returned in the other parameters. 00080 // Returns True iff the parsing succeeds. 00081 // IMPORTANT NOTE: The implementation of this function currently assumes 00082 // that everything after the first "numLayer" field is an 00083 // "AudioSpecificConfig". Therefore, it will not work properly if 00084 // "audioMuxVersion" != 0, "numProgram" > 0, or "numLayer" > 0. 00085 // Also, any 'other data' or CRC info will be included at 00086 // the end of "audioSpecificConfig". 00087 00088 unsigned char* parseStreamMuxConfigStr(char const* configStr, 00089 // result parameter: 00090 unsigned& audioSpecificConfigSize); 00091 // A variant of the above that returns just the "AudioSpecificConfig" data 00092 // (or NULL) if the parsing failed, without bothering with the other 00093 // result parameters. 00094 00095 unsigned char* parseGeneralConfigStr(char const* configStr, 00096 // result parameter: 00097 unsigned& configSize); 00098 // A routine that parses an arbitrary config string, returning 00099 // the result in binary form. 00100 00101 #endif
1.5.2