pub fn map_frames_pub<T, R>(
frames: &[T],
encode: impl Fn(&T) -> R + Sync + Send,
) -> Vec<R>Expand description
map_frames, public so benchmarks and callers with their own frame source
can use the same batching the export paths do.
Examples found in repository?
examples/codec_bench.rs (lines 121-123)
106fn encode_hevc_mp4(args: &Args, frames: &[Yuv420Frame]) -> Vec<u8> {
107 use threers_codec::hevc::compress::CompressedEncoder;
108 let enc =
109 CompressedEncoder::new(args.width, args.height, args.qp).tiles(args.tiles.0, args.tiles.1);
110 let level = enc.config().level_idc;
111 let (vps, sps, pps) = enc.parameter_sets();
112 let mut stream = vec![[
113 vec![0, 0, 0, 1],
114 vps,
115 vec![0, 0, 0, 1],
116 sps,
117 vec![0, 0, 0, 1],
118 pps,
119 ]
120 .concat()];
121 stream.extend(threers_codec::map_frames_pub(frames, |f| {
122 enc.encode_slice_au(f)
123 }));
124 mux_annexb(args, &stream, level)
125}