app-starlock/lib/talk/starChart/handle/other/h264_frame_buffer.dart
2025-02-21 15:55:35 +08:00

23 lines
584 B
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'dart:typed_data';
import 'package:star_lock/talk/starChart/proto/talk_data_h264_frame.pb.dart';
class H264FrameBuffer {
List<TalkDataH264Frame> frames = [];
void addFrame(TalkDataH264Frame frame) {
frames.add(frame);
}
Uint8List getCompleteStream() {
final List<int> completeStream = [];
for (final frame in frames) {
// 添加起始码(假设为 0x00 0x00 0x01
completeStream.addAll([0x00, 0x00, 0x01]);
// 添加帧数据
completeStream.addAll(frame.frameData);
}
return Uint8List.fromList(completeStream);
}
}