make dump pretty
This commit is contained in:
parent
767dcd85b6
commit
84e73c5011
@ -2,68 +2,85 @@
|
|||||||
package atom
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Walker interface {
|
type Walker interface {
|
||||||
Start()
|
FilterArrayItem(string,string,int,int) bool
|
||||||
Log(string)
|
ArrayLeft(int,int)
|
||||||
|
StartStruct(string)
|
||||||
|
EndStruct()
|
||||||
Name(string)
|
Name(string)
|
||||||
Int(int)
|
Int(int)
|
||||||
Fixed(Fixed)
|
Fixed(Fixed)
|
||||||
String(string)
|
String(string)
|
||||||
Bytes([]byte)
|
Bytes([]byte)
|
||||||
TimeStamp(TimeStamp)
|
TimeStamp(TimeStamp)
|
||||||
End()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Dumper struct {
|
type Dumper struct {
|
||||||
|
W io.Writer
|
||||||
depth int
|
depth int
|
||||||
}
|
name string
|
||||||
|
arrlen int
|
||||||
func (self *Dumper) Start() {
|
arridx int
|
||||||
self.depth++
|
|
||||||
}
|
|
||||||
|
|
||||||
func (self *Dumper) End() {
|
|
||||||
self.depth--
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self Dumper) tab() string {
|
func (self Dumper) tab() string {
|
||||||
return strings.Repeat(" ", self.depth*2)
|
return strings.Repeat(" ", self.depth*2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self Dumper) Name(name string) {
|
func (self Dumper) println(msg string) {
|
||||||
fmt.Print(self.tab(), name, ": ")
|
fmt.Fprintln(self.W, self.tab()+msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self Dumper) Log(msg string) {
|
func (self *Dumper) ArrayLeft(i int, n int) {
|
||||||
fmt.Println(self.tab()+msg)
|
self.println(fmt.Sprintf("... total %d elements", n))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self Dumper) logVal(msg string) {
|
func (self *Dumper) FilterArrayItem(name string, field string, i int, n int) bool {
|
||||||
fmt.Println(msg)
|
if n > 20 && i > 20 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *Dumper) EndArray() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *Dumper) StartStruct(name string) {
|
||||||
|
self.depth++
|
||||||
|
self.println(fmt.Sprintf("[%s]", name))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *Dumper) EndStruct() {
|
||||||
|
self.depth--
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *Dumper) Name(name string) {
|
||||||
|
self.name = name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self Dumper) Int(val int) {
|
func (self Dumper) Int(val int) {
|
||||||
self.logVal(fmt.Sprintf("%d", val))
|
self.println(fmt.Sprintf("%s: %d", self.name, val))
|
||||||
}
|
|
||||||
|
|
||||||
func (self Dumper) Fixed(val Fixed) {
|
|
||||||
self.logVal(fmt.Sprintf("%d", FixedToInt(val)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self Dumper) String(val string) {
|
func (self Dumper) String(val string) {
|
||||||
self.logVal(val)
|
self.println(fmt.Sprintf("%s: %s", self.name, val))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self Dumper) Fixed(val Fixed) {
|
||||||
|
self.println(fmt.Sprintf("%s: %d", self.name, FixedToInt(val)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self Dumper) Bytes(val []byte) {
|
func (self Dumper) Bytes(val []byte) {
|
||||||
self.logVal(hex.EncodeToString(val))
|
self.println(fmt.Sprintf("%s: %s", self.name, hex.EncodeToString(val)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self Dumper) TimeStamp(val TimeStamp) {
|
func (self Dumper) TimeStamp(val TimeStamp) {
|
||||||
self.logVal(fmt.Sprintf("%d", int(val)))
|
self.println(fmt.Sprintf("%s: %d", self.name, int(val)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ var atoms = {
|
|||||||
fields: [
|
fields: [
|
||||||
['$atoms', [
|
['$atoms', [
|
||||||
['header', '*mediaHeader'],
|
['header', '*mediaHeader'],
|
||||||
['info', '*mediaInfo'],
|
|
||||||
['handler', '*handlerRefer'],
|
['handler', '*handlerRefer'],
|
||||||
|
['info', '*mediaInfo'],
|
||||||
]],
|
]],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -526,9 +526,15 @@ var DeclDumpFunc = (opts) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var dumpArr = (name, type, id) => {
|
var dumpArr = (name, type, id) => {
|
||||||
return For(`_, item := range(${name})`, [
|
return [
|
||||||
dumpCommonType('item', type, id),
|
//Call('w.StartArray', [`"${id}"`, `len(${name})`]),
|
||||||
]);
|
For(`i, item := range(${name})`, If(
|
||||||
|
`w.FilterArrayItem("${opts.type}", "${id}", i, len(${name}))`,
|
||||||
|
dumpCommonType('item', type, id),
|
||||||
|
[`w.ArrayLeft(i, len(${name}))`, 'break']
|
||||||
|
)),
|
||||||
|
//Call('w.EndArray', []),
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
var dumpCommonType = (name, type, id) => {
|
var dumpCommonType = (name, type, id) => {
|
||||||
@ -554,12 +560,9 @@ var DeclDumpFunc = (opts) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var dumpFields = fields =>
|
var dumpFields = fields =>
|
||||||
[
|
[ Call('w.StartStruct', [`"${opts.type}"`]) ]
|
||||||
Call('w.Log', [`"[${opts.type}]"`]),
|
|
||||||
Call('w.Start', []),
|
|
||||||
]
|
|
||||||
.concat(fields.map(field => dumpField(field.name, field.type)))
|
.concat(fields.map(field => dumpField(field.name, field.type)))
|
||||||
.concat([Call('w.End', [])]);
|
.concat([Call('w.EndStruct', [])]);
|
||||||
|
|
||||||
return Func(
|
return Func(
|
||||||
'Walk'+opts.type,
|
'Walk'+opts.type,
|
||||||
|
277
atom/struct.go
277
atom/struct.go
@ -81,20 +81,24 @@ func WriteMovie(w io.WriteSeeker, self *Movie) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkMovie(w Walker, self *Movie) {
|
func WalkMovie(w Walker, self *Movie) {
|
||||||
|
|
||||||
w.Log("[Movie]")
|
w.StartStruct("Movie")
|
||||||
w.Start()
|
|
||||||
if self.Header != nil {
|
if self.Header != nil {
|
||||||
WalkMovieHeader(w, self.Header)
|
WalkMovieHeader(w, self.Header)
|
||||||
}
|
}
|
||||||
if self.Iods != nil {
|
if self.Iods != nil {
|
||||||
WalkIods(w, self.Iods)
|
WalkIods(w, self.Iods)
|
||||||
}
|
}
|
||||||
for _, item := range self.Tracks {
|
for i, item := range self.Tracks {
|
||||||
if item != nil {
|
if w.FilterArrayItem("Movie", "Tracks", i, len(self.Tracks)) {
|
||||||
WalkTrack(w, item)
|
if item != nil {
|
||||||
|
WalkTrack(w, item)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
w.ArrayLeft(i, len(self.Tracks))
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,11 +132,10 @@ func WriteIods(w io.WriteSeeker, self *Iods) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkIods(w Walker, self *Iods) {
|
func WalkIods(w Walker, self *Iods) {
|
||||||
|
|
||||||
w.Log("[Iods]")
|
w.StartStruct("Iods")
|
||||||
w.Start()
|
|
||||||
w.Name("Data")
|
w.Name("Data")
|
||||||
w.Bytes(self.Data)
|
w.Bytes(self.Data)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,8 +284,7 @@ func WriteMovieHeader(w io.WriteSeeker, self *MovieHeader) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkMovieHeader(w Walker, self *MovieHeader) {
|
func WalkMovieHeader(w Walker, self *MovieHeader) {
|
||||||
|
|
||||||
w.Log("[MovieHeader]")
|
w.StartStruct("MovieHeader")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
@ -299,9 +301,14 @@ func WalkMovieHeader(w Walker, self *MovieHeader) {
|
|||||||
w.Fixed(self.PreferredRate)
|
w.Fixed(self.PreferredRate)
|
||||||
w.Name("PreferredVolume")
|
w.Name("PreferredVolume")
|
||||||
w.Fixed(self.PreferredVolume)
|
w.Fixed(self.PreferredVolume)
|
||||||
for _, item := range self.Matrix {
|
for i, item := range self.Matrix {
|
||||||
w.Name("Matrix")
|
if w.FilterArrayItem("MovieHeader", "Matrix", i, len(self.Matrix)) {
|
||||||
w.Int(item)
|
w.Name("Matrix")
|
||||||
|
w.Int(item)
|
||||||
|
} else {
|
||||||
|
w.ArrayLeft(i, len(self.Matrix))
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w.Name("PreviewTime")
|
w.Name("PreviewTime")
|
||||||
w.TimeStamp(self.PreviewTime)
|
w.TimeStamp(self.PreviewTime)
|
||||||
@ -317,7 +324,7 @@ func WalkMovieHeader(w Walker, self *MovieHeader) {
|
|||||||
w.TimeStamp(self.CurrentTime)
|
w.TimeStamp(self.CurrentTime)
|
||||||
w.Name("NextTrackId")
|
w.Name("NextTrackId")
|
||||||
w.Int(self.NextTrackId)
|
w.Int(self.NextTrackId)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,15 +388,14 @@ func WriteTrack(w io.WriteSeeker, self *Track) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkTrack(w Walker, self *Track) {
|
func WalkTrack(w Walker, self *Track) {
|
||||||
|
|
||||||
w.Log("[Track]")
|
w.StartStruct("Track")
|
||||||
w.Start()
|
|
||||||
if self.Header != nil {
|
if self.Header != nil {
|
||||||
WalkTrackHeader(w, self.Header)
|
WalkTrackHeader(w, self.Header)
|
||||||
}
|
}
|
||||||
if self.Media != nil {
|
if self.Media != nil {
|
||||||
WalkMedia(w, self.Media)
|
WalkMedia(w, self.Media)
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,8 +528,7 @@ func WriteTrackHeader(w io.WriteSeeker, self *TrackHeader) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkTrackHeader(w Walker, self *TrackHeader) {
|
func WalkTrackHeader(w Walker, self *TrackHeader) {
|
||||||
|
|
||||||
w.Log("[TrackHeader]")
|
w.StartStruct("TrackHeader")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
@ -542,15 +547,20 @@ func WalkTrackHeader(w Walker, self *TrackHeader) {
|
|||||||
w.Int(self.AlternateGroup)
|
w.Int(self.AlternateGroup)
|
||||||
w.Name("Volume")
|
w.Name("Volume")
|
||||||
w.Fixed(self.Volume)
|
w.Fixed(self.Volume)
|
||||||
for _, item := range self.Matrix {
|
for i, item := range self.Matrix {
|
||||||
w.Name("Matrix")
|
if w.FilterArrayItem("TrackHeader", "Matrix", i, len(self.Matrix)) {
|
||||||
w.Int(item)
|
w.Name("Matrix")
|
||||||
|
w.Int(item)
|
||||||
|
} else {
|
||||||
|
w.ArrayLeft(i, len(self.Matrix))
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w.Name("TrackWidth")
|
w.Name("TrackWidth")
|
||||||
w.Fixed(self.TrackWidth)
|
w.Fixed(self.TrackWidth)
|
||||||
w.Name("TrackHeight")
|
w.Name("TrackHeight")
|
||||||
w.Fixed(self.TrackHeight)
|
w.Fixed(self.TrackHeight)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,8 +622,7 @@ func WriteHandlerRefer(w io.WriteSeeker, self *HandlerRefer) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkHandlerRefer(w Walker, self *HandlerRefer) {
|
func WalkHandlerRefer(w Walker, self *HandlerRefer) {
|
||||||
|
|
||||||
w.Log("[HandlerRefer]")
|
w.StartStruct("HandlerRefer")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
@ -624,14 +633,14 @@ func WalkHandlerRefer(w Walker, self *HandlerRefer) {
|
|||||||
w.String(self.SubType)
|
w.String(self.SubType)
|
||||||
w.Name("Name")
|
w.Name("Name")
|
||||||
w.String(self.Name)
|
w.String(self.Name)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
type Media struct {
|
type Media struct {
|
||||||
Header *MediaHeader
|
Header *MediaHeader
|
||||||
Info *MediaInfo
|
|
||||||
Handler *HandlerRefer
|
Handler *HandlerRefer
|
||||||
|
Info *MediaInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReadMedia(r *io.LimitedReader) (res *Media, err error) {
|
func ReadMedia(r *io.LimitedReader) (res *Media, err error) {
|
||||||
@ -650,18 +659,18 @@ func ReadMedia(r *io.LimitedReader) (res *Media, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "minf":
|
|
||||||
{
|
|
||||||
if self.Info, err = ReadMediaInfo(ar); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "hdlr":
|
case "hdlr":
|
||||||
{
|
{
|
||||||
if self.Handler, err = ReadHandlerRefer(ar); err != nil {
|
if self.Handler, err = ReadHandlerRefer(ar); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case "minf":
|
||||||
|
{
|
||||||
|
if self.Info, err = ReadMediaInfo(ar); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if _, err = ReadDummy(ar, int(ar.N)); err != nil {
|
if _, err = ReadDummy(ar, int(ar.N)); err != nil {
|
||||||
@ -683,13 +692,13 @@ func WriteMedia(w io.WriteSeeker, self *Media) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if self.Info != nil {
|
if self.Handler != nil {
|
||||||
if err = WriteMediaInfo(w, self.Info); err != nil {
|
if err = WriteHandlerRefer(w, self.Handler); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if self.Handler != nil {
|
if self.Info != nil {
|
||||||
if err = WriteHandlerRefer(w, self.Handler); err != nil {
|
if err = WriteMediaInfo(w, self.Info); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -700,18 +709,17 @@ func WriteMedia(w io.WriteSeeker, self *Media) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkMedia(w Walker, self *Media) {
|
func WalkMedia(w Walker, self *Media) {
|
||||||
|
|
||||||
w.Log("[Media]")
|
w.StartStruct("Media")
|
||||||
w.Start()
|
|
||||||
if self.Header != nil {
|
if self.Header != nil {
|
||||||
WalkMediaHeader(w, self.Header)
|
WalkMediaHeader(w, self.Header)
|
||||||
}
|
}
|
||||||
if self.Info != nil {
|
|
||||||
WalkMediaInfo(w, self.Info)
|
|
||||||
}
|
|
||||||
if self.Handler != nil {
|
if self.Handler != nil {
|
||||||
WalkHandlerRefer(w, self.Handler)
|
WalkHandlerRefer(w, self.Handler)
|
||||||
}
|
}
|
||||||
w.End()
|
if self.Info != nil {
|
||||||
|
WalkMediaInfo(w, self.Info)
|
||||||
|
}
|
||||||
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,8 +802,7 @@ func WriteMediaHeader(w io.WriteSeeker, self *MediaHeader) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkMediaHeader(w Walker, self *MediaHeader) {
|
func WalkMediaHeader(w Walker, self *MediaHeader) {
|
||||||
|
|
||||||
w.Log("[MediaHeader]")
|
w.StartStruct("MediaHeader")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
@ -812,7 +819,7 @@ func WalkMediaHeader(w Walker, self *MediaHeader) {
|
|||||||
w.Int(self.Language)
|
w.Int(self.Language)
|
||||||
w.Name("Quality")
|
w.Name("Quality")
|
||||||
w.Int(self.Quality)
|
w.Int(self.Quality)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -900,8 +907,7 @@ func WriteMediaInfo(w io.WriteSeeker, self *MediaInfo) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkMediaInfo(w Walker, self *MediaInfo) {
|
func WalkMediaInfo(w Walker, self *MediaInfo) {
|
||||||
|
|
||||||
w.Log("[MediaInfo]")
|
w.StartStruct("MediaInfo")
|
||||||
w.Start()
|
|
||||||
if self.Sound != nil {
|
if self.Sound != nil {
|
||||||
WalkSoundMediaInfo(w, self.Sound)
|
WalkSoundMediaInfo(w, self.Sound)
|
||||||
}
|
}
|
||||||
@ -914,7 +920,7 @@ func WalkMediaInfo(w Walker, self *MediaInfo) {
|
|||||||
if self.Sample != nil {
|
if self.Sample != nil {
|
||||||
WalkSampleTable(w, self.Sample)
|
WalkSampleTable(w, self.Sample)
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -966,12 +972,11 @@ func WriteDataInfo(w io.WriteSeeker, self *DataInfo) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkDataInfo(w Walker, self *DataInfo) {
|
func WalkDataInfo(w Walker, self *DataInfo) {
|
||||||
|
|
||||||
w.Log("[DataInfo]")
|
w.StartStruct("DataInfo")
|
||||||
w.Start()
|
|
||||||
if self.Refer != nil {
|
if self.Refer != nil {
|
||||||
WalkDataRefer(w, self.Refer)
|
WalkDataRefer(w, self.Refer)
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1049,8 +1054,7 @@ func WriteDataRefer(w io.WriteSeeker, self *DataRefer) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkDataRefer(w Walker, self *DataRefer) {
|
func WalkDataRefer(w Walker, self *DataRefer) {
|
||||||
|
|
||||||
w.Log("[DataRefer]")
|
w.StartStruct("DataRefer")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
@ -1058,7 +1062,7 @@ func WalkDataRefer(w Walker, self *DataRefer) {
|
|||||||
if self.Url != nil {
|
if self.Url != nil {
|
||||||
WalkDataReferUrl(w, self.Url)
|
WalkDataReferUrl(w, self.Url)
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1099,13 +1103,12 @@ func WriteDataReferUrl(w io.WriteSeeker, self *DataReferUrl) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkDataReferUrl(w Walker, self *DataReferUrl) {
|
func WalkDataReferUrl(w Walker, self *DataReferUrl) {
|
||||||
|
|
||||||
w.Log("[DataReferUrl]")
|
w.StartStruct("DataReferUrl")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
w.Int(self.Flags)
|
w.Int(self.Flags)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1159,15 +1162,14 @@ func WriteSoundMediaInfo(w io.WriteSeeker, self *SoundMediaInfo) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkSoundMediaInfo(w Walker, self *SoundMediaInfo) {
|
func WalkSoundMediaInfo(w Walker, self *SoundMediaInfo) {
|
||||||
|
|
||||||
w.Log("[SoundMediaInfo]")
|
w.StartStruct("SoundMediaInfo")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
w.Int(self.Flags)
|
w.Int(self.Flags)
|
||||||
w.Name("Balance")
|
w.Name("Balance")
|
||||||
w.Int(self.Balance)
|
w.Int(self.Balance)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1226,19 +1228,23 @@ func WriteVideoMediaInfo(w io.WriteSeeker, self *VideoMediaInfo) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkVideoMediaInfo(w Walker, self *VideoMediaInfo) {
|
func WalkVideoMediaInfo(w Walker, self *VideoMediaInfo) {
|
||||||
|
|
||||||
w.Log("[VideoMediaInfo]")
|
w.StartStruct("VideoMediaInfo")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
w.Int(self.Flags)
|
w.Int(self.Flags)
|
||||||
w.Name("GraphicsMode")
|
w.Name("GraphicsMode")
|
||||||
w.Int(self.GraphicsMode)
|
w.Int(self.GraphicsMode)
|
||||||
for _, item := range self.Opcolor {
|
for i, item := range self.Opcolor {
|
||||||
w.Name("Opcolor")
|
if w.FilterArrayItem("VideoMediaInfo", "Opcolor", i, len(self.Opcolor)) {
|
||||||
w.Int(item)
|
w.Name("Opcolor")
|
||||||
|
w.Int(item)
|
||||||
|
} else {
|
||||||
|
w.ArrayLeft(i, len(self.Opcolor))
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1362,8 +1368,7 @@ func WriteSampleTable(w io.WriteSeeker, self *SampleTable) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkSampleTable(w Walker, self *SampleTable) {
|
func WalkSampleTable(w Walker, self *SampleTable) {
|
||||||
|
|
||||||
w.Log("[SampleTable]")
|
w.StartStruct("SampleTable")
|
||||||
w.Start()
|
|
||||||
if self.SampleDesc != nil {
|
if self.SampleDesc != nil {
|
||||||
WalkSampleDesc(w, self.SampleDesc)
|
WalkSampleDesc(w, self.SampleDesc)
|
||||||
}
|
}
|
||||||
@ -1385,7 +1390,7 @@ func WalkSampleTable(w Walker, self *SampleTable) {
|
|||||||
if self.SampleSize != nil {
|
if self.SampleSize != nil {
|
||||||
WalkSampleSize(w, self.SampleSize)
|
WalkSampleSize(w, self.SampleSize)
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1475,8 +1480,7 @@ func WriteSampleDesc(w io.WriteSeeker, self *SampleDesc) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkSampleDesc(w Walker, self *SampleDesc) {
|
func WalkSampleDesc(w Walker, self *SampleDesc) {
|
||||||
|
|
||||||
w.Log("[SampleDesc]")
|
w.StartStruct("SampleDesc")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
if self.Avc1Desc != nil {
|
if self.Avc1Desc != nil {
|
||||||
@ -1485,7 +1489,7 @@ func WalkSampleDesc(w Walker, self *SampleDesc) {
|
|||||||
if self.Mp4aDesc != nil {
|
if self.Mp4aDesc != nil {
|
||||||
WalkMp4aDesc(w, self.Mp4aDesc)
|
WalkMp4aDesc(w, self.Mp4aDesc)
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1605,8 +1609,7 @@ func WriteMp4aDesc(w io.WriteSeeker, self *Mp4aDesc) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkMp4aDesc(w Walker, self *Mp4aDesc) {
|
func WalkMp4aDesc(w Walker, self *Mp4aDesc) {
|
||||||
|
|
||||||
w.Log("[Mp4aDesc]")
|
w.StartStruct("Mp4aDesc")
|
||||||
w.Start()
|
|
||||||
w.Name("DataRefIdx")
|
w.Name("DataRefIdx")
|
||||||
w.Int(self.DataRefIdx)
|
w.Int(self.DataRefIdx)
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
@ -1626,7 +1629,7 @@ func WalkMp4aDesc(w Walker, self *Mp4aDesc) {
|
|||||||
if self.Conf != nil {
|
if self.Conf != nil {
|
||||||
WalkElemStreamDesc(w, self.Conf)
|
WalkElemStreamDesc(w, self.Conf)
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1667,13 +1670,12 @@ func WriteElemStreamDesc(w io.WriteSeeker, self *ElemStreamDesc) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkElemStreamDesc(w Walker, self *ElemStreamDesc) {
|
func WalkElemStreamDesc(w Walker, self *ElemStreamDesc) {
|
||||||
|
|
||||||
w.Log("[ElemStreamDesc]")
|
w.StartStruct("ElemStreamDesc")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Data")
|
w.Name("Data")
|
||||||
w.Bytes(self.Data)
|
w.Bytes(self.Data)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1835,8 +1837,7 @@ func WriteAvc1Desc(w io.WriteSeeker, self *Avc1Desc) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkAvc1Desc(w Walker, self *Avc1Desc) {
|
func WalkAvc1Desc(w Walker, self *Avc1Desc) {
|
||||||
|
|
||||||
w.Log("[Avc1Desc]")
|
w.StartStruct("Avc1Desc")
|
||||||
w.Start()
|
|
||||||
w.Name("DataRefIdx")
|
w.Name("DataRefIdx")
|
||||||
w.Int(self.DataRefIdx)
|
w.Int(self.DataRefIdx)
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
@ -1868,7 +1869,7 @@ func WalkAvc1Desc(w Walker, self *Avc1Desc) {
|
|||||||
if self.Conf != nil {
|
if self.Conf != nil {
|
||||||
WalkAvc1Conf(w, self.Conf)
|
WalkAvc1Conf(w, self.Conf)
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1902,10 +1903,9 @@ func WriteAvc1Conf(w io.WriteSeeker, self *Avc1Conf) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkAvc1Conf(w Walker, self *Avc1Conf) {
|
func WalkAvc1Conf(w Walker, self *Avc1Conf) {
|
||||||
|
|
||||||
w.Log("[Avc1Conf]")
|
w.StartStruct("Avc1Conf")
|
||||||
w.Start()
|
|
||||||
WalkAVCDecoderConfRecord(w, self.Record)
|
WalkAVCDecoderConfRecord(w, self.Record)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1965,16 +1965,20 @@ func WriteTimeToSample(w io.WriteSeeker, self *TimeToSample) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkTimeToSample(w Walker, self *TimeToSample) {
|
func WalkTimeToSample(w Walker, self *TimeToSample) {
|
||||||
|
|
||||||
w.Log("[TimeToSample]")
|
w.StartStruct("TimeToSample")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
w.Int(self.Flags)
|
w.Int(self.Flags)
|
||||||
for _, item := range self.Entries {
|
for i, item := range self.Entries {
|
||||||
WalkTimeToSampleEntry(w, item)
|
if w.FilterArrayItem("TimeToSample", "Entries", i, len(self.Entries)) {
|
||||||
|
WalkTimeToSampleEntry(w, item)
|
||||||
|
} else {
|
||||||
|
w.ArrayLeft(i, len(self.Entries))
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2005,13 +2009,12 @@ func WriteTimeToSampleEntry(w io.WriteSeeker, self TimeToSampleEntry) (err error
|
|||||||
}
|
}
|
||||||
func WalkTimeToSampleEntry(w Walker, self TimeToSampleEntry) {
|
func WalkTimeToSampleEntry(w Walker, self TimeToSampleEntry) {
|
||||||
|
|
||||||
w.Log("[TimeToSampleEntry]")
|
w.StartStruct("TimeToSampleEntry")
|
||||||
w.Start()
|
|
||||||
w.Name("Count")
|
w.Name("Count")
|
||||||
w.Int(self.Count)
|
w.Int(self.Count)
|
||||||
w.Name("Duration")
|
w.Name("Duration")
|
||||||
w.Int(self.Duration)
|
w.Int(self.Duration)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2071,16 +2074,20 @@ func WriteSampleToChunk(w io.WriteSeeker, self *SampleToChunk) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkSampleToChunk(w Walker, self *SampleToChunk) {
|
func WalkSampleToChunk(w Walker, self *SampleToChunk) {
|
||||||
|
|
||||||
w.Log("[SampleToChunk]")
|
w.StartStruct("SampleToChunk")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
w.Int(self.Flags)
|
w.Int(self.Flags)
|
||||||
for _, item := range self.Entries {
|
for i, item := range self.Entries {
|
||||||
WalkSampleToChunkEntry(w, item)
|
if w.FilterArrayItem("SampleToChunk", "Entries", i, len(self.Entries)) {
|
||||||
|
WalkSampleToChunkEntry(w, item)
|
||||||
|
} else {
|
||||||
|
w.ArrayLeft(i, len(self.Entries))
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2118,15 +2125,14 @@ func WriteSampleToChunkEntry(w io.WriteSeeker, self SampleToChunkEntry) (err err
|
|||||||
}
|
}
|
||||||
func WalkSampleToChunkEntry(w Walker, self SampleToChunkEntry) {
|
func WalkSampleToChunkEntry(w Walker, self SampleToChunkEntry) {
|
||||||
|
|
||||||
w.Log("[SampleToChunkEntry]")
|
w.StartStruct("SampleToChunkEntry")
|
||||||
w.Start()
|
|
||||||
w.Name("FirstChunk")
|
w.Name("FirstChunk")
|
||||||
w.Int(self.FirstChunk)
|
w.Int(self.FirstChunk)
|
||||||
w.Name("SamplesPerChunk")
|
w.Name("SamplesPerChunk")
|
||||||
w.Int(self.SamplesPerChunk)
|
w.Int(self.SamplesPerChunk)
|
||||||
w.Name("SampleDescId")
|
w.Name("SampleDescId")
|
||||||
w.Int(self.SampleDescId)
|
w.Int(self.SampleDescId)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2186,16 +2192,20 @@ func WriteCompositionOffset(w io.WriteSeeker, self *CompositionOffset) (err erro
|
|||||||
}
|
}
|
||||||
func WalkCompositionOffset(w Walker, self *CompositionOffset) {
|
func WalkCompositionOffset(w Walker, self *CompositionOffset) {
|
||||||
|
|
||||||
w.Log("[CompositionOffset]")
|
w.StartStruct("CompositionOffset")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
w.Int(self.Flags)
|
w.Int(self.Flags)
|
||||||
for _, item := range self.Entries {
|
for i, item := range self.Entries {
|
||||||
WalkCompositionOffsetEntry(w, item)
|
if w.FilterArrayItem("CompositionOffset", "Entries", i, len(self.Entries)) {
|
||||||
|
WalkCompositionOffsetEntry(w, item)
|
||||||
|
} else {
|
||||||
|
w.ArrayLeft(i, len(self.Entries))
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2226,13 +2236,12 @@ func WriteCompositionOffsetEntry(w io.WriteSeeker, self CompositionOffsetEntry)
|
|||||||
}
|
}
|
||||||
func WalkCompositionOffsetEntry(w Walker, self CompositionOffsetEntry) {
|
func WalkCompositionOffsetEntry(w Walker, self CompositionOffsetEntry) {
|
||||||
|
|
||||||
w.Log("[CompositionOffsetEntry]")
|
w.StartStruct("CompositionOffsetEntry")
|
||||||
w.Start()
|
|
||||||
w.Name("Count")
|
w.Name("Count")
|
||||||
w.Int(self.Count)
|
w.Int(self.Count)
|
||||||
w.Name("Offset")
|
w.Name("Offset")
|
||||||
w.Int(self.Offset)
|
w.Int(self.Offset)
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2292,17 +2301,21 @@ func WriteSyncSample(w io.WriteSeeker, self *SyncSample) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkSyncSample(w Walker, self *SyncSample) {
|
func WalkSyncSample(w Walker, self *SyncSample) {
|
||||||
|
|
||||||
w.Log("[SyncSample]")
|
w.StartStruct("SyncSample")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
w.Int(self.Flags)
|
w.Int(self.Flags)
|
||||||
for _, item := range self.Entries {
|
for i, item := range self.Entries {
|
||||||
w.Name("Entries")
|
if w.FilterArrayItem("SyncSample", "Entries", i, len(self.Entries)) {
|
||||||
w.Int(item)
|
w.Name("Entries")
|
||||||
|
w.Int(item)
|
||||||
|
} else {
|
||||||
|
w.ArrayLeft(i, len(self.Entries))
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2369,19 +2382,23 @@ func WriteSampleSize(w io.WriteSeeker, self *SampleSize) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkSampleSize(w Walker, self *SampleSize) {
|
func WalkSampleSize(w Walker, self *SampleSize) {
|
||||||
|
|
||||||
w.Log("[SampleSize]")
|
w.StartStruct("SampleSize")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
w.Int(self.Flags)
|
w.Int(self.Flags)
|
||||||
w.Name("SampleSize")
|
w.Name("SampleSize")
|
||||||
w.Int(self.SampleSize)
|
w.Int(self.SampleSize)
|
||||||
for _, item := range self.Entries {
|
for i, item := range self.Entries {
|
||||||
w.Name("Entries")
|
if w.FilterArrayItem("SampleSize", "Entries", i, len(self.Entries)) {
|
||||||
w.Int(item)
|
w.Name("Entries")
|
||||||
|
w.Int(item)
|
||||||
|
} else {
|
||||||
|
w.ArrayLeft(i, len(self.Entries))
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2441,16 +2458,20 @@ func WriteChunkOffset(w io.WriteSeeker, self *ChunkOffset) (err error) {
|
|||||||
}
|
}
|
||||||
func WalkChunkOffset(w Walker, self *ChunkOffset) {
|
func WalkChunkOffset(w Walker, self *ChunkOffset) {
|
||||||
|
|
||||||
w.Log("[ChunkOffset]")
|
w.StartStruct("ChunkOffset")
|
||||||
w.Start()
|
|
||||||
w.Name("Version")
|
w.Name("Version")
|
||||||
w.Int(self.Version)
|
w.Int(self.Version)
|
||||||
w.Name("Flags")
|
w.Name("Flags")
|
||||||
w.Int(self.Flags)
|
w.Int(self.Flags)
|
||||||
for _, item := range self.Entries {
|
for i, item := range self.Entries {
|
||||||
w.Name("Entries")
|
if w.FilterArrayItem("ChunkOffset", "Entries", i, len(self.Entries)) {
|
||||||
w.Int(item)
|
w.Name("Entries")
|
||||||
|
w.Int(item)
|
||||||
|
} else {
|
||||||
|
w.ArrayLeft(i, len(self.Entries))
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
w.End()
|
w.EndStruct()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user