Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Sample speed test for Transport Stream construction

, 13 Apr 2004
A program that emulates the TS construction from ES files for the HDTV standard.
ts_constructor.zip
TS_constructor
TS_constructor.exe
ts_source_code.zip
TS_Source_Code
App.ico
ts.ico
mpeg_tst.csproj.user
using System;

namespace mpeg_tst
{
	public class TS
	{
		private byte[] TS_Header;				// 4 bytes ?
		//private byte[] TS_Adaptation_Field;		// ????
		//private byte[] TS_Payload;				// Pachetele PES care nu le-am inclus inca
		private int TS_length;				// =188 bytes
		private int TS_Data_Length;			// =184 bytes
		private byte[] TS_Data;				// Partea de date din pachet

		private int bytes_left;				// indicator de spatiu liber in pachet
		private int load;					// indicator de pozitie in TS_Data

		public byte[] TS_output;			// Pachetul final asamblat

		public TS() // Constructorul implicit al clasei
		{
			TS_length=188;
			TS_Data_Length=184;
			TS_Header=new byte[4];
			for(int i=0;i<4;i++) TS_Header[i]=42; // Header-ul va fi "****"
			TS_Data=new byte[TS_Data_Length];
			TS_output=new byte[TS_length];
			bytes_left=184;
			load=0;
		}

		public bool add_data(byte[] raw_data)
		{
			int i,len;
			len=raw_data.GetLength(0);
			if (bytes_left<len) return false;
			for(i=0;i<len;i++) TS_Data[load+i]=raw_data[i];
			load=load+len;
			bytes_left=bytes_left-len;
			return true;
		}

		public void stuffing()
		{
			for(int i=load;i<TS_Data_Length;i++) TS_Data[i]=33;
		}

		public void asembly_output()
		{ int i;
			for(i=0;i<4;i++) TS_output[i]=TS_Header[i];
			for(i=0;i<TS_Data_Length;i++) TS_output[4+i]=TS_Data[i];
		}

		public void reset_TS()
		{
			bytes_left=184;
			load=0;
		}

	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

ro_angel_bv
Web Developer
Malaysia Malaysia
Dumitru Bogdan - alias Angel
 
Born 1980 , Brasov , Romania
 
Final year student at Transilvania University of Brasov , Faculty of Electrical Engineering & Computer Science , Department of Electronics & Computers
 
Programming : Visual C++ , Visual Fox Pro , Assembler & later , C#
 
Motto : "Nothing Last Forever" , and software is no exception

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150123.1 | Last Updated 14 Apr 2004
Article Copyright 2004 by ro_angel_bv
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid