diff --git a/lib/Makefile.am b/lib/Makefile.am index 9d92098f..4de85fa8 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS = $(global_CFLAGS) lib_LTLIBRARIES=libmist-1.0.la -libmist_1_0_la_SOURCES=amf.h amf.cpp auth.h auth.cpp base64.h base64.cpp config.h config.cpp dtsc.h dtsc.cpp flv_tag.h flv_tag.cpp http_parser.h http_parser.cpp json.h json.cpp procs.h procs.cpp rtmpchunks.h rtmpchunks.cpp socket.h socket.cpp mp4.h mp4.cpp ftp.h ftp.cpp filesystem.h filesystem.cpp stream.h stream.cpp timing.h timing.cpp +libmist_1_0_la_SOURCES=amf.h amf.cpp auth.h auth.cpp base64.h base64.cpp config.h config.cpp dtsc.h dtsc.cpp flv_tag.h flv_tag.cpp http_parser.h http_parser.cpp json.h json.cpp procs.h procs.cpp rtmpchunks.h rtmpchunks.cpp socket.h socket.cpp mp4.h mp4.cpp ftp.h ftp.cpp filesystem.h filesystem.cpp stream.h stream.cpp timing.h timing.cpp ts_packet.cpp ts_packet.h libmist_1_0_la_LIBADD=-lssl -lcrypto -lrt libmist_1_0_la_LDFLAGS = -version-info 3:0:0 diff --git a/lib/ts_packet.cpp b/lib/ts_packet.cpp index e6079f1a..07e7f54c 100644 --- a/lib/ts_packet.cpp +++ b/lib/ts_packet.cpp @@ -99,7 +99,6 @@ void TS::Packet::PCR( int64_t NewVal ) { strBuf[4] = 0x07; strBuf[5] = (strBuf[5] | 0x10 ); int64_t TmpVal = NewVal / 300; - fprintf( stderr, "\tSetting PCR_Base: %d\n", TmpVal ); strBuf[6] = (((TmpVal>>1)>>24) & 0xFF); strBuf[7] = (((TmpVal>>1)>>16) & 0xFF); strBuf[8] = (((TmpVal>>1)>>8) & 0xFF); diff --git a/lib/ts_packet.h b/lib/ts_packet.h index a8336743..c85bd39d 100644 --- a/lib/ts_packet.h +++ b/lib/ts_packet.h @@ -54,12 +54,16 @@ namespace TS { /// The length of this header will ALWAYS be 7 bytes, and has to be /// prepended on each audio frame. /// \param FrameLen the length of the current audio frame. - static inline std::string GetAudioHeader( int FrameLen ) { - char StandardHeader[7] = {0xFF,0xF1,0x4C,0x80,0x00,0x1F,0xFC}; + static inline std::string GetAudioHeader( int FrameLen, std::string initData ) { + char StandardHeader[7] = {0xFF,0xF1,0x00,0x00,0x00,0x1F,0xFC}; FrameLen += 7; - StandardHeader[3] = ( StandardHeader[3] & 0xFC ) + ( ( FrameLen & 0x00001800 ) >> 11 ); + StandardHeader[2] = ((((initData[0] >> 3) - 1) << 6 ) & 0xC0);//AAC Profile - 1 ( First two bits ) + StandardHeader[2] |= (( ((initData[0] & 0x07) << 1) | ((initData[1] >> 7) & 0x01) ) << 2 );//AAC Frequency Index + StandardHeader[2] |= ((initData[1] & 0x20) >> 5); + StandardHeader[3] = ((initData[1] & 0x18 ) << 3 ); + StandardHeader[3] |= ( ( FrameLen & 0x00001800 ) >> 11 ); StandardHeader[4] = ( ( FrameLen & 0x000007F8 ) >> 3 ); - StandardHeader[5] = ( StandardHeader[5] & 0x3F ) + ( ( FrameLen & 0x00000007 ) << 5 ); + StandardHeader[5] |= ( ( FrameLen & 0x00000007 ) << 5 ); return std::string(StandardHeader,7); }