Skip to content

Commit f7875b1

Browse files
author
Isaac
committed
Fix build
1 parent 907e9b1 commit f7875b1

File tree

1 file changed

+1
-204
lines changed

1 file changed

+1
-204
lines changed

submodules/MediaPlayer/Sources/FFMpegMediaFrameSourceContextHelpers.swift

Lines changed: 1 addition & 204 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public final class FFMpegMediaFrameSourceContextHelpers {
9292
}
9393

9494
static func createFormatDescriptionFromAV1CodecData(_ formatId: UInt32, _ width: Int32, _ height: Int32, _ extradata: Data, frameData: Data) -> CMFormatDescription? {
95-
return createAV1FormatDescription(frameData)
95+
return nil
9696

9797
/*let par = NSMutableDictionary()
9898
par.setObject(1 as NSNumber, forKey: "HorizontalSpacing" as NSString)
@@ -120,206 +120,3 @@ public final class FFMpegMediaFrameSourceContextHelpers {
120120
return formatDescription*/
121121
}
122122
}
123-
124-
private func getSequenceHeaderOBU(data: Data) -> (Data, Data)? {
125-
let originalData = data
126-
return data.withUnsafeBytes { buffer -> (Data, Data)? in
127-
let data = buffer.baseAddress!.assumingMemoryBound(to: UInt8.self)
128-
129-
var index = 0
130-
while true {
131-
if index >= buffer.count {
132-
return nil
133-
}
134-
135-
let startIndex = index
136-
let value = data[index]
137-
index += 1
138-
if (value >> 7) != 0 {
139-
return nil
140-
}
141-
let headerType = value >> 3
142-
let hasPayloadSize = value & 0x02
143-
if hasPayloadSize == 0 {
144-
return nil
145-
}
146-
147-
let hasExtension = value & 0x04
148-
if hasExtension != 0 {
149-
index += 1
150-
}
151-
152-
let payloadSize = readULEBSize(data: data, dataSize: buffer.count, index: &index)
153-
if index + payloadSize >= buffer.count {
154-
return nil
155-
}
156-
157-
if headerType == 1 {
158-
let fullObu = originalData.subdata(in: startIndex ..< (startIndex + payloadSize + index - startIndex))
159-
let obuData = originalData.subdata(in: index ..< (index + payloadSize))
160-
return (fullObu, obuData)
161-
}
162-
163-
index += payloadSize
164-
}
165-
166-
return nil
167-
}
168-
}
169-
170-
private func readULEBSize(data: UnsafePointer<UInt8>, dataSize: Int, index: inout Int) -> Int {
171-
var value = 0
172-
for cptr in 0 ..< 8 {
173-
if index >= dataSize {
174-
return 0
175-
}
176-
177-
let dataByte = data[index]
178-
index += 1
179-
let decodedByte = dataByte & 0x7f
180-
value |= Int(decodedByte << (7 * cptr))
181-
if value >= Int(Int32.max) {
182-
return 0
183-
}
184-
if (dataByte & 0x80) == 0 {
185-
break;
186-
}
187-
}
188-
return value
189-
}
190-
191-
private struct ParsedSequenceHeaderParameters {
192-
var height: Int32 = 0
193-
var width: Int32 = 0
194-
195-
var profile: UInt8 = 0
196-
var level: UInt8 = 0
197-
198-
var high_bitdepth: UInt8 = 0
199-
var twelve_bit: UInt8 = 0
200-
var chroma_type: UInt8 = 0
201-
}
202-
203-
private func parseSequenceHeaderOBU(data: Data) -> ParsedSequenceHeaderParameters? {
204-
var parameters = ParsedSequenceHeaderParameters()
205-
206-
let bitReader = LsbBitReader(data: data)
207-
var value: UInt32 = 0
208-
209-
// Read three bits, profile
210-
if bitReader.bitsLeft < 3 {
211-
return nil
212-
}
213-
value = bitReader.uint32(fromBits: 3)
214-
bitReader.advance(by: 3)
215-
parameters.profile = UInt8(bitPattern: Int8(clamping: value))
216-
217-
// Read one bit, still picture
218-
if bitReader.bitsLeft < 1 {
219-
return nil
220-
}
221-
value = bitReader.uint32(fromBits: 1)
222-
bitReader.advance(by: 1)
223-
224-
// Read one bit, hdr still picture
225-
if bitReader.bitsLeft < 1 {
226-
return nil
227-
}
228-
value = bitReader.uint32(fromBits: 1)
229-
bitReader.advance(by: 1)
230-
// We only support hdr still picture = 0 for now.
231-
if value != 0 {
232-
return nil
233-
}
234-
235-
parameters.high_bitdepth = 0
236-
parameters.twelve_bit = 0
237-
parameters.chroma_type = 3
238-
239-
// Read one bit, timing info
240-
if bitReader.bitsLeft < 1 {
241-
return nil
242-
}
243-
value = bitReader.uint32(fromBits: 1)
244-
bitReader.advance(by: 1)
245-
// We only support no timing info for now.
246-
if value != 0 {
247-
return nil
248-
}
249-
250-
// Read one bit, display mode
251-
if bitReader.bitsLeft < 1 {
252-
return nil
253-
}
254-
value = bitReader.uint32(fromBits: 1)
255-
bitReader.advance(by: 1)
256-
257-
// Read 5 bits, operating_points_cnt_minus_1
258-
if bitReader.bitsLeft < 5 {
259-
return nil
260-
}
261-
value = bitReader.uint32(fromBits: 5)
262-
bitReader.advance(by: 5)
263-
// We only support operating_points_cnt_minus_1 = 0 for now.
264-
if value != 0 {
265-
return nil
266-
}
267-
268-
// Read 12 bits, operating_point_idc
269-
if bitReader.bitsLeft < 12 {
270-
return nil
271-
}
272-
value = bitReader.uint32(fromBits: 12)
273-
bitReader.advance(by: 12)
274-
275-
// Read 5 bits, level
276-
if bitReader.bitsLeft < 5 {
277-
return nil
278-
}
279-
value = bitReader.uint32(fromBits: 5)
280-
bitReader.advance(by: 5)
281-
parameters.level = UInt8(value)
282-
283-
// If level >= 4.0, read one bit
284-
if parameters.level > 7 {
285-
if bitReader.bitsLeft < 1 {
286-
return nil
287-
}
288-
value = bitReader.uint32(fromBits: 1)
289-
bitReader.advance(by: 1)
290-
}
291-
292-
// Read width num bits
293-
if bitReader.bitsLeft < 4 {
294-
return nil
295-
}
296-
value = bitReader.uint32(fromBits: 4)
297-
bitReader.advance(by: 4)
298-
let widthNumBits = value + 1
299-
300-
// Read height num bits
301-
if bitReader.bitsLeft < 4 {
302-
return nil
303-
}
304-
value = bitReader.uint32(fromBits: 4)
305-
bitReader.advance(by: 4)
306-
let heightNumBits = value + 1
307-
308-
// Read width according with num bits
309-
if bitReader.bitsLeft < Int(widthNumBits) {
310-
return nil
311-
}
312-
value = bitReader.uint32(fromBits: Int(widthNumBits))
313-
bitReader.advance(by: Int(widthNumBits))
314-
parameters.width = Int32(value + 1)
315-
316-
// Read height according with num bits
317-
if bitReader.bitsLeft < Int(heightNumBits) {
318-
return nil
319-
}
320-
value = bitReader.uint32(fromBits: Int(heightNumBits))
321-
bitReader.advance(by: Int(heightNumBits))
322-
parameters.height = Int32(value + 1)
323-
324-
return parameters
325-
}

0 commit comments

Comments
 (0)