Move IVFWriter to pkg

Allow this to be used/improved by others. SampleBuilder will be a
sibling

Resolves #115
This commit is contained in:
Sean DuBois
2018-08-27 00:29:48 -07:00
parent fde197b31c
commit 2adb8dcc80
2 changed files with 25 additions and 20 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/pions/webrtc"
"github.com/pions/webrtc/pkg/ice"
"github.com/pions/webrtc/pkg/media/ivfwriter"
)
func main() {
@@ -49,12 +50,14 @@ func main() {
peerConnection.Ontrack = func(track *webrtc.RTCTrack) {
if track.Codec.Name == webrtc.VP8 {
fmt.Println("Got VP8 track, saving to disk as output.ivf")
i, err := newIVFWriter("output.ivf")
i, err := ivfwriter.New("output.ivf")
if err != nil {
panic(err)
}
for {
i.addPacket(<-track.Packets)
if err := i.AddPacket(<-track.Packets); err != nil {
panic(err)
}
}
}
}