-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add lhvc, vexu, hfov, sgpd, colr boxes
- Loading branch information
1 parent
7af5a62
commit bda3c53
Showing
9 changed files
with
218 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Package colr represents ColourInformationBox. | ||
package colr | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/golang/glog" | ||
"github.com/wangyoucao577/medialib/container/mp4/box" | ||
"github.com/wangyoucao577/medialib/util" | ||
) | ||
|
||
// Box represents a colr box. | ||
type Box struct { | ||
box.Header `json:"header"` | ||
} | ||
|
||
// New creates a new Box. | ||
func New(h box.Header) box.Box { | ||
return &Box{ | ||
Header: h, | ||
} | ||
} | ||
|
||
// ParsePayload parse payload which requires basic box already exist. | ||
func (b *Box) ParsePayload(r io.Reader) error { | ||
if err := b.Validate(); err != nil { | ||
glog.Warningf("box %s invalid, err %v", b.Type, err) | ||
return nil | ||
} | ||
|
||
//TODO: these can be removed if we have supported full AVCDecoderConfigurationRecord parsing | ||
glog.Warningf("box type %s still has %d bytes hasn't been parsed yet, ignore them", b.Type, b.PayloadSize()) | ||
if err := util.ReadOrError(r, make([]byte, b.PayloadSize())); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Package hfov represents hfov box. | ||
package hfov | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/golang/glog" | ||
"github.com/wangyoucao577/medialib/container/mp4/box" | ||
"github.com/wangyoucao577/medialib/util" | ||
) | ||
|
||
// Box represents a hfov box. | ||
type Box struct { | ||
box.Header `json:"header"` | ||
} | ||
|
||
// New creates a new Box. | ||
func New(h box.Header) box.Box { | ||
return &Box{ | ||
Header: h, | ||
} | ||
} | ||
|
||
// ParsePayload parse payload which requires basic box already exist. | ||
func (b *Box) ParsePayload(r io.Reader) error { | ||
if err := b.Validate(); err != nil { | ||
glog.Warningf("box %s invalid, err %v", b.Type, err) | ||
return nil | ||
} | ||
|
||
//TODO: these can be removed if we have supported full AVCDecoderConfigurationRecord parsing | ||
glog.Warningf("box type %s still has %d bytes hasn't been parsed yet, ignore them", b.Type, b.PayloadSize()) | ||
if err := util.ReadOrError(r, make([]byte, b.PayloadSize())); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Package sgpd represents Sample Group Description Box. | ||
package sgpd | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/golang/glog" | ||
"github.com/wangyoucao577/medialib/container/mp4/box" | ||
"github.com/wangyoucao577/medialib/util" | ||
) | ||
|
||
// Box represents a hfov box. | ||
type Box struct { | ||
box.Header `json:"header"` | ||
} | ||
|
||
// New creates a new Box. | ||
func New(h box.Header) box.Box { | ||
return &Box{ | ||
Header: h, | ||
} | ||
} | ||
|
||
// ParsePayload parse payload which requires basic box already exist. | ||
func (b *Box) ParsePayload(r io.Reader) error { | ||
if err := b.Validate(); err != nil { | ||
glog.Warningf("box %s invalid, err %v", b.Type, err) | ||
return nil | ||
} | ||
|
||
//TODO: these can be removed if we have supported full AVCDecoderConfigurationRecord parsing | ||
glog.Warningf("box type %s still has %d bytes hasn't been parsed yet, ignore them", b.Type, b.PayloadSize()) | ||
if err := util.ReadOrError(r, make([]byte, b.PayloadSize())); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Package vexu represents Video Extended Usage Box for Multiview HEVC. | ||
package vexu | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/golang/glog" | ||
"github.com/wangyoucao577/medialib/container/mp4/box" | ||
"github.com/wangyoucao577/medialib/util" | ||
) | ||
|
||
// Box represents a vexu box. | ||
type Box struct { | ||
box.Header `json:"header"` | ||
} | ||
|
||
// New creates a new Box. | ||
func New(h box.Header) box.Box { | ||
return &Box{ | ||
Header: h, | ||
} | ||
} | ||
|
||
// ParsePayload parse payload which requires basic box already exist. | ||
func (b *Box) ParsePayload(r io.Reader) error { | ||
if err := b.Validate(); err != nil { | ||
glog.Warningf("box %s invalid, err %v", b.Type, err) | ||
return nil | ||
} | ||
|
||
//TODO: these can be removed if we have supported full AVCDecoderConfigurationRecord parsing | ||
glog.Warningf("box type %s still has %d bytes hasn't been parsed yet, ignore them", b.Type, b.PayloadSize()) | ||
if err := util.ReadOrError(r, make([]byte, b.PayloadSize())); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters