Comments (6)
This all looks reasonably sensible - the dumps help a huge amount (at least for testing - i hate doing this stuff blind).
I added just now the start of AC3 and EAC3 descriptors (just need to add the loops to read flagged elements, but need to collect some more sample streams first). Adding other ones... I will try and get around to it, but it might take a few weeks :-)
from tsdecoder.
if you want tell me an date and timerange and i give you Access to my System over TeamViewer
there had you then Vs 2017 some satip servers with dvbs wireshark and what you Need
case 0x09: return new CADescriptor(stream, start);
public class CADescriptor : Descriptor
{
private int _systemIdentifier;
private int _caPid;
public CADescriptor(byte[] stream, int start) : base(stream, start)
{
var index = start+2;
_systemIdentifier= Utils.Convert2BytesToInt(stream, index);
index += 2;
_caPid = ((stream[index] & 0x1f) * 256) + (int)stream[index+1];
index = start + DescriptorLength;
}
public int CaPid { get => _caPid; set => _caPid = value; }
public int SystemIdentifier { get => _systemIdentifier; set => _systemIdentifier = value; }
}
public static int ConvertBCDToInt(byte[] byteData, int index, int count)
{
int result = 0;
int shift = 4;
for (int nibbleIndex = 0; nibbleIndex < count; nibbleIndex++)
{
result = (result * 10) + ((byteData[index] >> shift) & 0x0f);
if (shift == 4)
shift = 0;
else
{
shift = 4;
index++;
}
}
return (result);
}
public static string ToHexString(this byte[] hex)
{
if (hex == null) return null;
if (hex.Length == 0) return string.Empty;
var s = new System.Text.StringBuilder();
foreach (byte b in hex)
{
s.Append(b.ToString("x2"));
}
return s.ToString();
}
public static int Convert2BytesToInt(byte[] buffer, int offset)
{
int temp = (int)buffer[offset];
temp = (temp * 256) + buffer[offset + 1];
return (temp);
}
public static int Convert3BytesToInt(byte[] buffer, int offset)
{
int temp = (int)buffer[offset];
temp = (temp * 256) + buffer[offset + 1];
temp = (temp * 256) + buffer[offset + 2];
return (temp);
}
public static int Convert4BytesToInt(byte[] buffer, int offset)
{
int temp =(int)buffer[offset];
temp = (temp * 256) + buffer[offset + 1];
temp = (temp * 256) + buffer[offset + 2];
temp = (temp * 256) + buffer[offset + 3];
return (temp);
}
public static long Convert4BytesToLong(byte[] buffer, int offset)
{
long temp = 0;
for (int index = 0; index < 4; index++)
temp = (temp * 256) + buffer[offset + index];
return (temp);
}
public static long Convert8BytesToLong(byte[] buffer, int offset)
{
long temp = 0;
for (int index = 0; index < 8; index++)
temp = (temp * 256) + buffer[offset + index];
return (temp);
}
public static string ConvertBytesToString(byte[] buffer, int offset, int length)
{
StringBuilder reply = new StringBuilder(4);
for (int index = 0; index < length; index++)
reply.Append((char)buffer[offset + index]);
return (reply.ToString());
}
from tsdecoder.
as Addition to the descriptor text dumps here 2 capture files
11720 -2017-07-09-16-01-43.zip
11954 -2017-07-09-16-05-06.zip
from tsdecoder.
I have completed the concrete ac3/eac3 descriptors, but rather than add just a few other random descriptors you found I added a pretty exhaustive dictionary of descriptor names and added a short & full name properties to the base class. Now all any descriptor should be correctly labelled and easy to access. I added your streams and some more unit tests (I do need to deal with some EIT bugs still...).
Let me know if there were any specific descriptors that you would appreciate concrete implementations and I can add them - but otherwise I would like to close this issue.
from tsdecoder.
you can Close this issue . sure there are many descriptors that can be needed but i try to help you in the future with pull requests
the CADescriptor 0x09 look in one top post as exsample
the other question is is it possible to use the Utils class?
i looks cleaner in the descriptor cable satellite System Delivery descriptor if you use this
Frequency = Utils.ConvertBCDToInt(byteData, lastIndex, 8);
instead of
Frequency = System.String.Format("{0}{1}{2}{3}{4}{5}{6}{7}", (stream[start + 2] >> 4) & 0x0F, stream[start + 2] & 0x0F, (stream[start + 3] >> 4) & 0x0F, stream[start + 3] & 0x0F, (stream[start + 4] >> 4) & 0x0F, stream[start + 4] & 0x0F, (stream[start + 5] >> 4) & 0x0F, stream[start + 5] & 0x0F);
from tsdecoder.
I had an issue i needed to fix with the EIT system, so while i was there i quickly added a concrete CA Descriptor.
I would probably use such a string format method if i need to touch such code again, but the satellite stuff came from a pull request from Chris - and so i'm a but loath to touch it just for improving readability.
If I do have any other reason to maintain anything (or if during adding any other descriptors it makes sense) then i'd be happy to.
I'm not so wild about the '2 bytes to int' helpers, since actually maintaining the indexing in such cases leads to more lines and it is harder to follow the location within the spec if debugging (since you need to do the math in your head instead or use debugger). If you see my implementation of the CA descriptor i think it expresses intent a little more clearly.
That example from the satellite descriptor is an ugly case though :-)
from tsdecoder.
Related Issues (10)
- Index out of range Exceptions in Short and ExtendedEventDescriptors HOT 1
- Feature Request TableIdentifier Support in AddPacket Method HOT 3
- Logical Channel Number Descriptor (LCNDescriptor 0x83) HOT 2
- Error xmlns="http://schemas.microsoft.com/developer/msbuild/2003" HOT 1
- Get SatelliteDeliverySystemDescriptor for Choosen TransportstreamId HOT 1
- Pat table with Section length > 176 bytes HOT 2
- SDT-other BAT tables support HOT 2
- Bug in TsPacketFactory.GetTsPacketsFromData() HOT 4
- Service name in Cyrillic. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tsdecoder.