flavioribeiro / donut

donut is a zero setup required SRT+MPEG-TS -> WebRTC Bridge powered by Pion.
Apache License 2.0
341 stars 10 forks source link

support scte-35 parsing #10

Open flavioribeiro opened 1 year ago

flavioribeiro commented 1 year ago

suggested by @tretelny.

Need to check with @futzu if we could use his lib.

flavioribeiro commented 1 year ago

https://github.com/Comcast/scte35-go

flavioribeiro commented 1 year ago

https://github.com/futzu/cuei

futzu commented 1 year ago

Flavio, of course. If I can do anything to help, just let me know.

futzu commented 1 year ago

I see you already have asitis parsing the stream, all you really would have to do is make a cuei.Cue instance and pass it the payload from a SCTE-35 packet like this

import 
    "github.com/futzu/cuei"

var cue cuei.Cue
cue.Decode(payload)

Then you can access whatever you need with dot notation like cue.Command.PTS

cue.Show() will print the Cue in JSON

cue.Show()
type Cue struct {
    InfoSection
    Command     SpliceCommand
    Descriptors []SpliceDescriptor `json:",omitempty"`
    Packet      *PacketData        `json:",omitempty"`
}

All the SCTE35 Splice Commands (Splice Insert, Time Signal etc) are consolidated into the SpliceCommand struct and all the Descriptors are consolidated into SpliceDescriptor. No interfaces needed. it makes it much easier to get to vars in the struct.

futzu commented 1 year ago

I put some examples up.

flavioribeiro commented 1 year ago

thanks, @futzu !

futzu commented 1 year ago

I was looking at how you were doing things with the close captions, and I added something similar.

https://github.com/futzu/cuei#use-cuei-with-another-mpegts-stream-parser--demuxer