Skip to content

Commit

Permalink
update mediacommon (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored Oct 7, 2024
1 parent 8a07427 commit ed88408
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
3 changes: 2 additions & 1 deletion client_time_conv_mpegts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ type clientTimeConvMPEGTS struct {
}

func (ts *clientTimeConvMPEGTS) initialize() {
ts.td = mpegts.NewTimeDecoder2(ts.startDTS)
ts.td = mpegts.NewTimeDecoder2()
ts.td.Decode(ts.startDTS)
}

func (ts *clientTimeConvMPEGTS) convert(v int64) int64 {
Expand Down
15 changes: 6 additions & 9 deletions examples/muxer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,17 @@ func main() {
panic(fmt.Errorf("H264 track not found"))
}

var timeDec *mpegts.TimeDecoder2
timeDec := mpegts.NewTimeDecoder2()

// setup a callback that is called when a H264 access unit is received
r.OnDataH264(track, func(rawPTS int64, _ int64, au [][]byte) error {
// decode the time
if timeDec == nil {
timeDec = mpegts.NewTimeDecoder2(rawPTS)
}
pts := timeDec.Decode(rawPTS)
r.OnDataH264(track, func(pts int64, _ int64, au [][]byte) error {
// decode timestamp
pts = timeDec.Decode(pts)

// pass the access unit to the HLS muxer
log.Printf("visit http://localhost:8080 - encoding access unit with PTS = %v", pts)
mux.WriteH264(videoTrack, time.Now(), pts, au)

// pass the access unit to the HLS muxer
mux.WriteH264(videoTrack, time.Now(), pts, au)
return nil
})

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/asticode/go-astits v1.13.0
github.com/bluenviron/mediacommon v1.12.5-0.20241006182151-6b36e8902699
github.com/bluenviron/mediacommon v1.12.5-0.20241007134008-c84f1fd25fa3
github.com/stretchr/testify v1.9.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/asticode/go-astikit v0.30.0 h1:DkBkRQRIxYcknlaU7W7ksNfn4gMFsB0tqMJflx
github.com/asticode/go-astikit v0.30.0/go.mod h1:h4ly7idim1tNhaVkdVBeXQZEE3L0xblP7fCWbgwipF0=
github.com/asticode/go-astits v1.13.0 h1:XOgkaadfZODnyZRR5Y0/DWkA9vrkLLPLeeOvDwfKZ1c=
github.com/asticode/go-astits v1.13.0/go.mod h1:QSHmknZ51pf6KJdHKZHJTLlMegIrhega3LPWz3ND/iI=
github.com/bluenviron/mediacommon v1.12.5-0.20241006182151-6b36e8902699 h1:B7Ae/628il4hCNu1SaAysFa2y/1cLh+DhPIBHKI0oeg=
github.com/bluenviron/mediacommon v1.12.5-0.20241006182151-6b36e8902699/go.mod h1:HDyW2CzjvhYJXtdxstdFPio3G0qSocPhqkhUt/qffec=
github.com/bluenviron/mediacommon v1.12.5-0.20241007134008-c84f1fd25fa3 h1:czCwPRlUCIc0QSg85TPIK4qhI+ZbAn+XyrKut0OeWl0=
github.com/bluenviron/mediacommon v1.12.5-0.20241007134008-c84f1fd25fa3/go.mod h1:HDyW2CzjvhYJXtdxstdFPio3G0qSocPhqkhUt/qffec=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down

0 comments on commit ed88408

Please sign in to comment.