add debug options for example/test
This commit is contained in:
parent
86e41350b3
commit
bc93d48788
@ -45,14 +45,16 @@ type Sample struct {
|
|||||||
RandomAccessIndicator bool
|
RandomAccessIndicator bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
debugData = true
|
||||||
|
debugStream = true
|
||||||
|
)
|
||||||
|
|
||||||
func readSamples(filename string, ch chan Sample) {
|
func readSamples(filename string, ch chan Sample) {
|
||||||
defer func() {
|
defer func() {
|
||||||
close(ch)
|
close(ch)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
debugData := true
|
|
||||||
debugStream := true
|
|
||||||
|
|
||||||
var file *os.File
|
var file *os.File
|
||||||
var err error
|
var err error
|
||||||
if file, err = os.Open(filename); err != nil {
|
if file, err = os.Open(filename); err != nil {
|
||||||
@ -191,14 +193,20 @@ func testInputGob(pathGob string, pathOut string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
outfile.Close()
|
outfile.Close()
|
||||||
|
if debugStream {
|
||||||
fmt.Println("written to", pathOut)
|
fmt.Println("written to", pathOut)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
input := flag.String("i", "", "input file")
|
input := flag.String("i", "", "input file")
|
||||||
output := flag.String("o", "", "output file")
|
output := flag.String("o", "", "output file")
|
||||||
inputGob := flag.String("g", "", "input gob file")
|
inputGob := flag.String("g", "", "input gob file")
|
||||||
cpuprofile := flag.String("cpuprofile", "", "write cpu profile to file")
|
cpuprofile := flag.String("cpuprofile", "", "write cpu profile to file")
|
||||||
|
flag.BoolVar(&debugData, "vd", false, "debug data")
|
||||||
|
flag.BoolVar(&debugStream, "vs", false, "debug stream")
|
||||||
|
flag.BoolVar(&ts.DebugReader, "vr", false, "debug reader")
|
||||||
|
flag.BoolVar(&ts.DebugWriter, "vw", false, "debug writer")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *cpuprofile != "" {
|
if *cpuprofile != "" {
|
||||||
@ -210,10 +218,6 @@ func main() {
|
|||||||
defer pprof.StopCPUProfile()
|
defer pprof.StopCPUProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ts.DebugReader = true
|
|
||||||
ts.DebugWriter = true
|
|
||||||
|
|
||||||
if *inputGob != "" && *output != "" {
|
if *inputGob != "" && *output != "" {
|
||||||
testInputGob(*inputGob, *output)
|
testInputGob(*inputGob, *output)
|
||||||
return
|
return
|
||||||
@ -287,7 +291,7 @@ func main() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if sample.Type == ts.ElementaryStreamTypeH264 {
|
if sample.Type == ts.ElementaryStreamTypeH264 {
|
||||||
if true {
|
if debugStream {
|
||||||
fmt.Println("sample: ", len(sample.Data),
|
fmt.Println("sample: ", len(sample.Data),
|
||||||
"PCR", sample.PCR, "PTS", sample.PTS,
|
"PCR", sample.PCR, "PTS", sample.PTS,
|
||||||
"DTS", sample.DTS, "sync", sample.RandomAccessIndicator,
|
"DTS", sample.DTS, "sync", sample.RandomAccessIndicator,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user