读取TS
实现比较简单,读取188字节的数据即可
/* TS包 */
class Packet
{
public:
// ...
// 读取数据
friend std::istream& operator>>(std::istream& is, Packet& packet)
{
// 读取
is.read(reinterpret_cast<char*> (&packet), PACKET_SIZE);
packet.good
= (is.gcount() == PACKET_SIZE && packet.sync == PACKET_SYNC);
return is;
}
// ...
};