Added functionality to TS Connector

This commit is contained in:
Erik Zandvliet 2011-08-01 02:33:08 +02:00
parent 50f90f15c4
commit 42052732c1
2 changed files with 100 additions and 10 deletions

View file

@ -401,12 +401,19 @@ int main( ) {
adaptation_field AF;
pes_packet PES;
int ProgramNum;
while( std::cin.good( ) && BlockNo <= 1000 ) {
std::ofstream outfile;
outfile.open( "out.ts" );
while( std::cin.good( ) ) { // && BlockNo <= 1000 ) {
for( int i = 0; i < 188; i++ ) {
if( std::cin.good( ) ){ TempChar[i] = std::cin.get(); }
}
if( ( ( TempChar[1] & 0x1F ) << 8 ) + ( TempChar[2] ) != 0x1FFF ) {
int PID = ( ( TempChar[1] & 0x1F ) << 8 ) + ( TempChar[2] );
if( PID != 100 || ( PID == 100 && ((TempChar[3] & 0x30) == 3 ) && (TempChar[4] & 0x10 )) ) {
for( int i = 0; i < 188; i++ ) {
outfile << TempChar[i];
}
/*
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 ) );
@ -443,7 +450,7 @@ int main( ) {
}
BlockNo ++;
*/
} else {
EmptyBlocks ++;
}