|
1 | 1 | // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
|
2 | 2 | // SPDX-License-Identifier: MIT
|
3 | 3 |
|
4 |
| -// Package frame provides code to construct complete media frames from packetized media |
| 4 | +// Package frame is deprecated. |
5 | 5 | package frame
|
6 | 6 |
|
7 |
| -import "github.com/pion/rtp/codecs" |
| 7 | +import ( |
| 8 | + "github.com/pion/rtp/codecs/av1/frame" |
| 9 | +) |
8 | 10 |
|
9 | 11 | // AV1 represents a collection of OBUs given a stream of AV1 Packets.
|
10 | 12 | // Each AV1 RTP Packet is a collection of OBU Elements. Each OBU Element may be a full OBU, or just a fragment of one.
|
11 | 13 | // AV1 provides the tools to construct a collection of OBUs from a collection of OBU Elements. This structure
|
12 | 14 | // contains an internal cache and should be used for the entire RTP Stream.
|
13 |
| -type AV1 struct { |
14 |
| - // Buffer for fragmented OBU. If ReadFrames is called on a RTP Packet |
15 |
| - // that doesn't contain a fully formed OBU |
16 |
| - obuBuffer []byte |
17 |
| -} |
18 |
| - |
19 |
| -func (f *AV1) pushOBUElement(isFirstOBUFragment *bool, obuElement []byte, obuList [][]byte) [][]byte { |
20 |
| - if *isFirstOBUFragment { |
21 |
| - *isFirstOBUFragment = false |
22 |
| - // Discard pushed because we don't have a fragment to combine it with |
23 |
| - if f.obuBuffer == nil { |
24 |
| - return obuList |
25 |
| - } |
26 |
| - obuElement = append(f.obuBuffer, obuElement...) |
27 |
| - f.obuBuffer = nil |
28 |
| - } |
29 |
| - return append(obuList, obuElement) |
30 |
| -} |
31 |
| - |
32 |
| -// ReadFrames processes the codecs.AV1Packet and returns fully constructed frames |
33 |
| -func (f *AV1) ReadFrames(pkt *codecs.AV1Packet) ([][]byte, error) { |
34 |
| - OBUs := [][]byte{} |
35 |
| - isFirstOBUFragment := pkt.Z |
36 |
| - |
37 |
| - for i := range pkt.OBUElements { |
38 |
| - OBUs = f.pushOBUElement(&isFirstOBUFragment, pkt.OBUElements[i], OBUs) |
39 |
| - } |
40 |
| - |
41 |
| - if pkt.Y && len(OBUs) > 0 { |
42 |
| - // Take copy of OBUElement that is being cached |
43 |
| - f.obuBuffer = append(f.obuBuffer, append([]byte{}, OBUs[len(OBUs)-1]...)...) |
44 |
| - OBUs = OBUs[:len(OBUs)-1] |
45 |
| - } |
46 |
| - return OBUs, nil |
47 |
| -} |
| 15 | +// |
| 16 | +// Deprecated: moved into codecs/av1/frame. |
| 17 | +type AV1 = frame.AV1 |
0 commit comments