Hi,
I want to extract the PID from a TS
this is the code that I'm proposed to use
Code VHDL - [expand] |
1
2
3
4
5
6
| ...
ID(7 downto 0) <= DATA_IN;
ID(15 downto 8) <= ID(7 downto 0);
DATA_OUT <= ID(15 downto 8);
...
PID <= ID(12 downto 0); |
this is the TS header:
I think if I use this VHDL code, by reading 12 downto 0 bits of "ID" I won't get the PID because I will have:
[(5 bits of PID, 3 flag bits),(8 bits of PID)
]
so reading 13 lower bits from that I will get:
[(2 bits of PID, 3 flag bits, 8 bits of PID)
]
am I right?
I've tested this code myself and as I said above I couldn't get the correct PID, BUT, since I saw the above code in a somehow "reliable" source I'm thinking maybe I've done something wrong. I'm suspicious maybe I'm reading the bytes in wrong order. so can you help me?
this is a sample of TS packet I've used. I read this file using hread and other functions of "textio".
Code:
47100014C4A0055EBEA2ED2A016F2BA6EB4108F93FD042744FE60499B2D0A02E76B43EBF982D66C4FC8349262B243960B9D510F911E049A42D05BCE49BBF102745D66001CB3F8EA6634B2BEBA352C06DEA645EB220EE1385A7399D7FEB9AFACE74B9FE38F38DB2FB8824EAE68C9391C23CACF4AD9B3DC206F4FA4F2898AB88E44AD725DF98C3A6FE910DA69E8D1561A08D549DB071A883768E24B16A9AC78C7B93F9EC26772E2EDA2814C1AAE61613B65735069CD455F34228C9F19C