mirror of
https://github.com/aler9/gortsplib
synced 2025-10-28 09:31:33 +08:00
switch to mediacommon/v2 (#695)
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph264"
|
||||
"github.com/bluenviron/mediacommon/pkg/codecs/h264"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
@@ -117,7 +117,7 @@ func main() {
|
||||
|
||||
// wait for an I-frame
|
||||
if !iframeReceived {
|
||||
if !h264.IDRPresent(au) {
|
||||
if !h264.IsRandomAccess(au) {
|
||||
log.Printf("waiting for an I-frame")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/pkg/codecs/h264"
|
||||
"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
)
|
||||
|
||||
func multiplyAndDivide(v, m, d int64) int64 {
|
||||
@@ -27,7 +27,7 @@ type mpegtsMuxer struct {
|
||||
w *mpegts.Writer
|
||||
h264Track *mpegts.Track
|
||||
mpeg4AudioTrack *mpegts.Track
|
||||
dtsExtractor *h264.DTSExtractor2
|
||||
dtsExtractor *h264.DTSExtractor
|
||||
mutex sync.Mutex
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
|
||||
if !idrPresent {
|
||||
return nil
|
||||
}
|
||||
e.dtsExtractor = h264.NewDTSExtractor2()
|
||||
e.dtsExtractor = h264.NewDTSExtractor()
|
||||
}
|
||||
|
||||
dts, err := e.dtsExtractor.Extract(au, pts)
|
||||
@@ -120,7 +120,7 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
|
||||
}
|
||||
|
||||
// encode into MPEG-TS
|
||||
return e.w.WriteH264(e.h264Track, pts, dts, idrPresent, au)
|
||||
return e.w.WriteH264(e.h264Track, pts, dts, au)
|
||||
}
|
||||
|
||||
// writeMPEG4Audio writes MPEG-4 audio access units into MPEG-TS.
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"bufio"
|
||||
"os"
|
||||
|
||||
"github.com/bluenviron/mediacommon/pkg/codecs/h264"
|
||||
"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
)
|
||||
|
||||
// mpegtsMuxer allows to save a H264 stream into a MPEG-TS file.
|
||||
@@ -18,7 +18,7 @@ type mpegtsMuxer struct {
|
||||
b *bufio.Writer
|
||||
w *mpegts.Writer
|
||||
track *mpegts.Track
|
||||
dtsExtractor *h264.DTSExtractor2
|
||||
dtsExtractor *h264.DTSExtractor
|
||||
}
|
||||
|
||||
// initialize initializes a mpegtsMuxer.
|
||||
@@ -92,7 +92,7 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
|
||||
if !idrPresent {
|
||||
return nil
|
||||
}
|
||||
e.dtsExtractor = h264.NewDTSExtractor2()
|
||||
e.dtsExtractor = h264.NewDTSExtractor()
|
||||
}
|
||||
|
||||
dts, err := e.dtsExtractor.Extract(au, pts)
|
||||
@@ -101,5 +101,5 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
|
||||
}
|
||||
|
||||
// encode into MPEG-TS
|
||||
return e.w.WriteH264(e.track, pts, dts, idrPresent, au)
|
||||
return e.w.WriteH264(e.track, pts, dts, au)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format/rtph265"
|
||||
"github.com/bluenviron/mediacommon/pkg/codecs/h265"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"bufio"
|
||||
"os"
|
||||
|
||||
"github.com/bluenviron/mediacommon/pkg/codecs/h265"
|
||||
"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
)
|
||||
|
||||
// mpegtsMuxer allows to save a H265 stream into a MPEG-TS file.
|
||||
@@ -19,7 +19,7 @@ type mpegtsMuxer struct {
|
||||
b *bufio.Writer
|
||||
w *mpegts.Writer
|
||||
track *mpegts.Track
|
||||
dtsExtractor *h265.DTSExtractor2
|
||||
dtsExtractor *h265.DTSExtractor
|
||||
}
|
||||
|
||||
// initialize initializes a mpegtsMuxer.
|
||||
@@ -93,7 +93,7 @@ func (e *mpegtsMuxer) writeH265(au [][]byte, pts int64) error {
|
||||
if !isRandomAccess {
|
||||
return nil
|
||||
}
|
||||
e.dtsExtractor = h265.NewDTSExtractor2()
|
||||
e.dtsExtractor = h265.NewDTSExtractor()
|
||||
}
|
||||
|
||||
dts, err := e.dtsExtractor.Extract(au, pts)
|
||||
@@ -102,5 +102,5 @@ func (e *mpegtsMuxer) writeH265(au [][]byte, pts int64) error {
|
||||
}
|
||||
|
||||
// encode into MPEG-TS
|
||||
return e.w.WriteH265(e.track, pts, dts, isRandomAccess, au)
|
||||
return e.w.WriteH265(e.track, pts, dts, au)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
)
|
||||
|
||||
func multiplyAndDivide(v, m, d int64) int64 {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/base"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
)
|
||||
|
||||
func multiplyAndDivide(v, m, d int64) int64 {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
)
|
||||
|
||||
// This example shows how to
|
||||
@@ -88,7 +88,7 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
timeDecoder := mpegts.NewTimeDecoder2()
|
||||
timeDecoder := mpegts.NewTimeDecoder()
|
||||
var firstDTS *int64
|
||||
var startTime time.Time
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/bluenviron/gortsplib/v4"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/description"
|
||||
"github.com/bluenviron/gortsplib/v4/pkg/format"
|
||||
"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
|
||||
"github.com/pion/rtp"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"bufio"
|
||||
"os"
|
||||
|
||||
"github.com/bluenviron/mediacommon/pkg/codecs/h264"
|
||||
"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
|
||||
"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
|
||||
)
|
||||
|
||||
// mpegtsMuxer allows to save a H264 stream into a MPEG-TS file.
|
||||
@@ -18,7 +18,7 @@ type mpegtsMuxer struct {
|
||||
b *bufio.Writer
|
||||
w *mpegts.Writer
|
||||
track *mpegts.Track
|
||||
dtsExtractor *h264.DTSExtractor2
|
||||
dtsExtractor *h264.DTSExtractor
|
||||
}
|
||||
|
||||
// initialize initializes a mpegtsMuxer.
|
||||
@@ -92,7 +92,7 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
|
||||
if !idrPresent {
|
||||
return nil
|
||||
}
|
||||
e.dtsExtractor = h264.NewDTSExtractor2()
|
||||
e.dtsExtractor = h264.NewDTSExtractor()
|
||||
}
|
||||
|
||||
dts, err := e.dtsExtractor.Extract(au, pts)
|
||||
@@ -101,5 +101,5 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
|
||||
}
|
||||
|
||||
// encode into MPEG-TS
|
||||
return e.w.WriteH265(e.track, pts, dts, idrPresent, au)
|
||||
return e.w.WriteH265(e.track, pts, dts, au)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user