Skip to content

Commit

Permalink
avutil: seek after probe
Browse files Browse the repository at this point in the history
  • Loading branch information
nareix committed Jul 28, 2016
1 parent d5c3f87 commit c4855b6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion av/avutil/avutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,17 @@ func (self *Handlers) Open(uri string) (demuxer av.DemuxCloser, err error) {

for _, handler := range self.handlers {
if handler.Probe != nil && handler.Probe(probebuf[:]) && handler.ReaderDemuxer != nil {
var _r io.Reader
if rs, ok := r.(io.ReadSeeker); ok {
if _, err = rs.Seek(0, 0); err != nil {
return
}
_r = rs
} else {
_r = io.MultiReader(bytes.NewReader(probebuf[:]), r)
}
demuxer = &HandlerDemuxer{
Demuxer: handler.ReaderDemuxer(io.MultiReader(bytes.NewReader(probebuf[:]), r)),
Demuxer: handler.ReaderDemuxer(_r),
r: r,
}
return
Expand Down

0 comments on commit c4855b6

Please sign in to comment.