mirror of https://github.com/q191201771/lal.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
664 B
Go
37 lines
664 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"github.com/q191201771/lal/pkg/rtmp"
|
|
"github.com/q191201771/lal/pkg/util/errors"
|
|
"github.com/q191201771/lal/pkg/util/log"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
type Obs struct {
|
|
}
|
|
|
|
func (obs Obs) ReadRTMPAVMsgCB(header rtmp.Header, timestampAbs int, message []byte) {
|
|
log.Infof("%+v, abs ts=%d", header, timestampAbs)
|
|
}
|
|
|
|
func main() {
|
|
url := parseFlag()
|
|
var obs Obs
|
|
session := rtmp.NewPullSession(obs, 2000)
|
|
err := session.Pull(url)
|
|
errors.PanicIfErrorOccur(err)
|
|
time.Sleep(1 * time.Hour)
|
|
}
|
|
|
|
func parseFlag() string {
|
|
url := flag.String("i", "", "specify rtmp url")
|
|
flag.Parse()
|
|
if *url == "" {
|
|
flag.Usage()
|
|
os.Exit(1)
|
|
}
|
|
return *url
|
|
}
|