diff --git a/Connector_HTTP/main.cpp b/Connector_HTTP/main.cpp index b7fff570..f45ec5e2 100644 --- a/Connector_HTTP/main.cpp +++ b/Connector_HTTP/main.cpp @@ -180,6 +180,7 @@ namespace Connector_HTTP{ printf( "URL: %s\n", HTTP_R.url.c_str()); printf( "Movie: %s, Quality: %s, Seg %d Frag %d\n", Movie.c_str(), Quality.c_str(), Segment, ReqFragment); #endif + Flash_ManifestSent = true;//stop manifest from being sent multiple times Flash_RequestPending++; }else{ Movie = HTTP_R.url.substr(1); diff --git a/TS_Analyser/main.cpp b/TS_Analyser/main.cpp new file mode 100644 index 00000000..2feb81eb --- /dev/null +++ b/TS_Analyser/main.cpp @@ -0,0 +1,68 @@ +#include +#include +#include +#include + +int main( ) { + std::string File; + unsigned int BlockNo = 1; + unsigned int EmptyBlocks = 0; + unsigned char TempChar[188]; + unsigned char Skip; + unsigned int SkippedBytes = 0; + unsigned int Adaptation; + while( std::cin.good( ) && BlockNo <= 5) { + for( int i = 0; i < 188; i++ ) { + TempChar[i] = std::cin.get(); + } + + if( ( ( TempChar[1] & 0x1F ) << 8 ) + ( TempChar[2] ) != 0x1FFF ) { + printf( "Block %d:\n", BlockNo ); + printf( "\tSync Byte:\t\t\t%X\n", TempChar[0] ); + printf( "\tTransport Error Indicator:\t%d\n", ( ( TempChar[1] & 0x80 ) != 0 ) ); + printf( "\tPayload Unit Start Indicator:\t%d\n", ( ( TempChar[1] & 0x40 ) != 0 ) ); + printf( "\tTransport Priority:\t\t%d\n", ( ( TempChar[1] & 0x20 ) != 0 ) ); + printf( "\tPacket ID:\t\t\t%X\n", ( ( TempChar[1] & 0x1F ) << 8 ) + ( TempChar[2] ) ); + printf( "\tScrambling control:\t\t%d%d\n", ( ( TempChar[3] & 0x80 ) != 0 ), ( ( TempChar[3] & 0x40 ) != 0 ) ); + printf( "\tAdaptation Field Exists:\t%d%d\n", ( ( TempChar[3] & 0x20 ) != 0 ), ( ( TempChar[3] & 0x10 ) != 0 ) ); + printf( "\tContinuity Counter:\t\t%d\n", ( TempChar[3] & 0x0F ) ); + + Adaptation = ( ( TempChar[3] & 0x30 ) >> 4 ); + + if( Adaptation == 2 || Adaptation == 3 ) { + printf( "\tAdaptation Field\n" ); + } + + + if( ( ( TempChar[1] & 0x1F ) << 8 ) + ( TempChar[2] ) == 0 ) { + printf( "\tProgram Association Table\n" ); + printf( "\t\ttable_id:\t\t\t%d\n", TempChar[4] ); + printf( "\t\tsection_syntax_indicator:\t%d\n", ( ( TempChar[5] & 0x80 ) != 0 ) ); + printf( "\t\t0:\t\t\t\t%d\n", ( ( TempChar[5] & 0x40 ) != 0 ) ); + printf( "\t\treserved:\t\t\t%d\n", ( ( TempChar[5] & 0x30 ) >> 4 ) ); + printf( "\t\tsection_length:\t\t\t%d\n", ( ( TempChar[5] & 0x0F ) << 8 ) + TempChar[6] ); + printf( "\t\treserved:\t\t\t%d\n", ( ( TempChar[7] & 0xC0 ) >> 6 ) ); + printf( "\t\tversion_number:\t\t\t%d\n", ( ( TempChar[7] & 0x3E ) >> 1 ) ); + printf( "\t\tcurrent_next_indicator:\t\t%d\n", ( ( TempChar[7] & 0x01 ) != 0 ) ); + printf( "\t\tsection_number:\t\t\t%d\n", TempChar[8] ); + printf( "\t\tlast_section_number:\t\t%d\n", TempChar[9] ); + + } + + BlockNo ++; + + } + else { + EmptyBlocks ++; + } + + //Find Next Sync Byte + SkippedBytes = 0; + while( (int)std::cin.peek( ) != 0x47 ) { + std::cin >> Skip; + SkippedBytes ++; + } + printf( "Empty Packet Counter: %d\n", EmptyBlocks ); + } + return 0; +}