mirror of https://bitbucket.org/ausocean/av.git
Merged in get-first-pid (pull request #228)
codec/h264/h264dec: added helper function to get first MediaPID found in a stream map Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
commit
e78b38a4da
|
@ -286,6 +286,19 @@ func FindPSI(d []byte) (int, map[uint16]uint8, map[string]string, error) {
|
|||
return i, streamMap, meta, nil
|
||||
}
|
||||
|
||||
var (
|
||||
ErrStreamMap = errors.New("stream map is empty")
|
||||
)
|
||||
|
||||
// FirstMediaPID returns the first PID and it's type in the given streamMap.
|
||||
func FirstMediaPID(streamMap map[uint16]uint8) (p uint16, t uint8, err error) {
|
||||
for p, t = range streamMap {
|
||||
return
|
||||
}
|
||||
err = ErrStreamMap
|
||||
return
|
||||
}
|
||||
|
||||
// FillPayload takes a channel and fills the packets Payload field until the
|
||||
// channel is empty or we've the packet reaches capacity
|
||||
func (p *Packet) FillPayload(data []byte) int {
|
||||
|
|
Loading…
Reference in New Issue