Closed maximk-1 closed 3 years ago
Hello, Yes. Here is some pseudo code that shows roughly what you would do
pkt := &packet.Packet{}
accumulator := libpacket.NewAccumulator(scte35.SCTE35AccumulatorDoneFunc)
for {
bytesRead, err = socket.Read(readBuf)
if err != nil {
return err
}
for pi = 0; pi < (bytesRead / packet.PacketSize); pi++ {
copy(pkt[:], readBuf[pi*packet.PacketSize:(pi+1)*packet.PacketSize])
_, err := accumulator.WritePacket(pkt)
if err == gots.ErrAccumulatorDone {
message, err := scte35.NewSCTE35(accumulator.Bytes())
if err == nil {
fmt.Println(message)
}
accumulator.Reset()
}
}
}
I would recommend more error checking but that the basics of it.
I'm going to close this because it is a question, not an issue.
Other errors you could check are:
Hi. Is it possible to continuously read packets from multicast udp stream and extract data, ex. for scte35 logging?