mirror of https://bitbucket.org/ausocean/av.git
codec/h264/h264dec: added helper function to get first MediaPID found in a stream map
This commit is contained in:
parent
f6c296de01
commit
c9d30ad807
|
@ -286,6 +286,19 @@ func FindPSI(d []byte) (int, map[uint16]uint8, map[string]string, error) {
|
||||||
return i, streamMap, meta, nil
|
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
|
// FillPayload takes a channel and fills the packets Payload field until the
|
||||||
// channel is empty or we've the packet reaches capacity
|
// channel is empty or we've the packet reaches capacity
|
||||||
func (p *Packet) FillPayload(data []byte) int {
|
func (p *Packet) FillPayload(data []byte) int {
|
||||||
|
|
Loading…
Reference in New Issue