mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
simplify examples (#493)
This commit is contained in:
@@ -52,6 +52,7 @@ func main() {
|
||||
|
||||
// setup H264 -> MPEG-TS muxer
|
||||
mpegtsMuxer := &mpegtsMuxer{
|
||||
fileName: "mystream.ts",
|
||||
sps: forma.SPS,
|
||||
pps: forma.PPS,
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ func durationGoToMPEGTS(v time.Duration) int64 {
|
||||
|
||||
// mpegtsMuxer allows to save a H264 stream into a MPEG-TS file.
|
||||
type mpegtsMuxer struct {
|
||||
fileName string
|
||||
sps []byte
|
||||
pps []byte
|
||||
|
||||
@@ -28,7 +29,7 @@ type mpegtsMuxer struct {
|
||||
// initialize initializes a mpegtsMuxer.
|
||||
func (e *mpegtsMuxer) initialize() error {
|
||||
var err error
|
||||
e.f, err = os.Create("mystream.ts")
|
||||
e.f, err = os.Create(e.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -52,6 +52,7 @@ func main() {
|
||||
|
||||
// setup H265 -> MPEG-TS muxer
|
||||
mpegtsMuxer := &mpegtsMuxer{
|
||||
fileName: "mystream.ts",
|
||||
vps: forma.VPS,
|
||||
sps: forma.SPS,
|
||||
pps: forma.PPS,
|
||||
|
@@ -15,6 +15,7 @@ func durationGoToMPEGTS(v time.Duration) int64 {
|
||||
|
||||
// mpegtsMuxer allows to save a H265 stream into a MPEG-TS file.
|
||||
type mpegtsMuxer struct {
|
||||
fileName string
|
||||
vps []byte
|
||||
sps []byte
|
||||
pps []byte
|
||||
@@ -29,7 +30,7 @@ type mpegtsMuxer struct {
|
||||
// initialize initializes a mpegtsMuxer.
|
||||
func (e *mpegtsMuxer) initialize() error {
|
||||
var err error
|
||||
e.f, err = os.Create("mystream.ts")
|
||||
e.f, err = os.Create(e.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -51,6 +51,7 @@ func main() {
|
||||
|
||||
// setup MPEG-4 audio -> MPEG-TS muxer
|
||||
mpegtsMuxer := &mpegtsMuxer{
|
||||
fileName: "mystream.ts",
|
||||
config: forma.Config,
|
||||
}
|
||||
mpegtsMuxer.initialize()
|
||||
|
@@ -15,6 +15,7 @@ func durationGoToMPEGTS(v time.Duration) int64 {
|
||||
|
||||
// mpegtsMuxer allows to save a MPEG4-audio stream into a MPEG-TS file.
|
||||
type mpegtsMuxer struct {
|
||||
fileName string
|
||||
config *mpeg4audio.Config
|
||||
|
||||
f *os.File
|
||||
@@ -26,7 +27,7 @@ type mpegtsMuxer struct {
|
||||
// initialize initializes a mpegtsMuxer.
|
||||
func (e *mpegtsMuxer) initialize() error {
|
||||
var err error
|
||||
e.f, err = os.Create("mystream.ts")
|
||||
e.f, err = os.Create(e.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -84,6 +84,7 @@ func (sh *serverHandler) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (
|
||||
|
||||
// setup H264 -> MPEGTS muxer
|
||||
mpegtsMuxer := &mpegtsMuxer{
|
||||
fileName: "mystream.ts",
|
||||
sps: forma.SPS,
|
||||
pps: forma.PPS,
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ func durationGoToMPEGTS(v time.Duration) int64 {
|
||||
|
||||
// mpegtsMuxer allows to save a H264 stream into a MPEG-TS file.
|
||||
type mpegtsMuxer struct {
|
||||
fileName string
|
||||
sps []byte
|
||||
pps []byte
|
||||
|
||||
@@ -28,7 +29,7 @@ type mpegtsMuxer struct {
|
||||
// initialize initializes a mpegtsMuxer.
|
||||
func (e *mpegtsMuxer) initialize() error {
|
||||
var err error
|
||||
e.f, err = os.Create("mystream.ts")
|
||||
e.f, err = os.Create(e.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user