add util package

master v1.0.2
Baik S. Hyun 4 years ago
parent f47e6a594e
commit 6c50f90a01

@ -10,6 +10,7 @@ import (
"strings"
"gitlab.com/ics_cinnamon/joy4/av"
"gitlab.com/ics_cinnamon/joy4/util"
)
type HandlerDemuxer struct {
@ -126,6 +127,8 @@ func (self *Handlers) NewAudioDecoder(codec av.AudioCodecData) (dec av.AudioDeco
}
func (self *Handlers) Open(uri string) (demuxer av.DemuxCloser, err error) {
util.PrintCallTrace(0)
listen := false
if strings.HasPrefix(uri, "listen:") {
uri = uri[len("listen:"):]
@ -270,6 +273,7 @@ var DefaultHandlers = &Handlers{}
func Open(url string) (demuxer av.DemuxCloser, err error) {
fmt.Println("avutil Open!")
util.PrintCallTrace(1)
return DefaultHandlers.Open(url)
}

@ -1,20 +1,19 @@
package format
import (
"fmt"
"gitlab.com/ics_cinnamon/joy4/av/avutil"
"gitlab.com/ics_cinnamon/joy4/format/aac"
"gitlab.com/ics_cinnamon/joy4/format/flv"
"gitlab.com/ics_cinnamon/joy4/format/mp4"
"gitlab.com/ics_cinnamon/joy4/format/rtmp"
"gitlab.com/ics_cinnamon/joy4/format/rtsp"
"gitlab.com/ics_cinnamon/joy4/format/ts"
)
func RegisterAll() {
avutil.DefaultHandlers.Add(mp4.Handler)
avutil.DefaultHandlers.Add(ts.Handler)
avutil.DefaultHandlers.Add(rtmp.Handler)
avutil.DefaultHandlers.Add(rtsp.Handler)
avutil.DefaultHandlers.Add(flv.Handler)
//avutil.DefaultHandlers.Add(mp4.Handler)
//avutil.DefaultHandlers.Add(ts.Handler)
//avutil.DefaultHandlers.Add(rtmp.Handler)
//avutil.DefaultHandlers.Add(rtsp.Handler)
//avutil.DefaultHandlers.Add(flv.Handler)
avutil.DefaultHandlers.Add(aac.Handler)
fmt.Println("Handler Regi Done!")
}

@ -0,0 +1,13 @@
package util
import (
"fmt"
"runtime"
)
func PrintCallTrace(depth int) {
funcname, file, line, ok := runtime.Caller(depth)
if ok {
fmt.Printf("[%s:%d %s]\n", file, line, runtime.FuncForPC(funcname).Name())
}
}
Loading…
Cancel
Save