Beispiel #1
0
void TCPClient::Send(Packet & packet)
{
    if (!m_Socket) {
        LOG_WARNING("TCPClient::Send: Socket is null");
        return;
    }
    packet.UpdateSize();
    boost::system::error_code error;
    m_Socket->send(boost::asio::buffer(
        packet.Data(),
        packet.Size()), 0, error);
}
Beispiel #2
0
//@data: TS packet
int MP2TMuxer::DeliverPacket(Packet &packet){
	unsigned short pid = packet.PID();
	
	if(this->mpDeliverer){
		mPSIPeriod -= 1;

		packet.SetCC(mContinuityCounter[pid]);
		int ret = this->mpDeliverer->Deliver((const char *)packet.Data(), Packet::PACKET_LENGTH);
		packet.Reset();
		mContinuityCounter[pid] = packet.GetCC();

		return ret;
	}
	if (mDeliverer) {
		mPSIPeriod -= 1;

		packet.SetCC(mContinuityCounter[pid]);
		int ret = this->mDeliverer((const unsigned char *)packet.Data(), Packet::PACKET_LENGTH, mDeliverHandler);
		packet.Reset();
		mContinuityCounter[pid] = packet.GetCC();
	}
	
	return 0;
}
Beispiel #3
0
void Packet::WritePacketData(Packet &packet) {
	if (packet.Length() == 0) return;
	data.resize(data.size() + packet.Length());
	memcpy(&data[data.size() - packet.Length()], packet.Data(), packet.Length());
}