add error msg

This commit is contained in:
nareix 2016-07-01 19:51:55 +08:00
parent 647db1ed5c
commit 9965a4c768

View File

@ -65,7 +65,7 @@ func (self *Demuxer) probe() (err error) {
} }
if moov == nil { if moov == nil {
err = fmt.Errorf("'moov' atom not found") err = fmt.Errorf("mp4: 'moov' atom not found")
return return
} }
@ -80,7 +80,7 @@ func (self *Demuxer) probe() (err error) {
stream.sample = atrack.Media.Info.Sample stream.sample = atrack.Media.Info.Sample
stream.timeScale = int64(atrack.Media.Header.TimeScale) stream.timeScale = int64(atrack.Media.Header.TimeScale)
} else { } else {
err = fmt.Errorf("sample table not found") err = fmt.Errorf("mp4: sample table not found")
return return
} }
@ -126,7 +126,7 @@ func (self *Stream) setSampleIndex(index int) (err error) {
start += n start += n
} }
if !found { if !found {
err = fmt.Errorf("stream[%d]: cannot locate sample index in chunk", self.idx) err = fmt.Errorf("mp4: stream[%d]: cannot locate sample index in chunk", self.idx)
return return
} }
@ -134,7 +134,7 @@ func (self *Stream) setSampleIndex(index int) (err error) {
self.sampleOffsetInChunk = int64(self.sampleIndexInChunk * self.sample.SampleSize.SampleSize) self.sampleOffsetInChunk = int64(self.sampleIndexInChunk * self.sample.SampleSize.SampleSize)
} else { } else {
if index >= len(self.sample.SampleSize.Entries) { if index >= len(self.sample.SampleSize.Entries) {
err = fmt.Errorf("stream[%d]: sample index out of range", self.idx) err = fmt.Errorf("mp4: stream[%d]: sample index out of range", self.idx)
return return
} }
self.sampleOffsetInChunk = int64(0) self.sampleOffsetInChunk = int64(0)
@ -161,7 +161,7 @@ func (self *Stream) setSampleIndex(index int) (err error) {
self.sttsEntryIndex++ self.sttsEntryIndex++
} }
if !found { if !found {
err = fmt.Errorf("stream[%d]: cannot locate sample index in stts entry", self.idx) err = fmt.Errorf("mp4: stream[%d]: cannot locate sample index in stts entry", self.idx)
return return
} }
@ -180,7 +180,7 @@ func (self *Stream) setSampleIndex(index int) (err error) {
self.cttsEntryIndex++ self.cttsEntryIndex++
} }
if !found { if !found {
err = fmt.Errorf("stream[%d]: cannot locate sample index in ctts entry", self.idx) err = fmt.Errorf("mp4: stream[%d]: cannot locate sample index in ctts entry", self.idx)
return return
} }
} }
@ -196,7 +196,7 @@ func (self *Stream) setSampleIndex(index int) (err error) {
} }
if false { if false {
fmt.Printf("stream[%d]: setSampleIndex chunkGroupIndex=%d chunkIndex=%d sampleOffsetInChunk=%d\n", fmt.Printf("mp4: stream[%d]: setSampleIndex chunkGroupIndex=%d chunkIndex=%d sampleOffsetInChunk=%d\n",
self.idx, self.chunkGroupIndex, self.chunkIndex, self.sampleOffsetInChunk) self.idx, self.chunkGroupIndex, self.chunkIndex, self.sampleOffsetInChunk)
} }