MCPcopy Create free account
hub / github.com/Recordscript/recordscript / write_frame

Method write_frame

libs/scrap/src/common/record.rs:147–215  ·  view source on GitHub ↗
(&mut self, frame: &video_frame::Union)

Source from the content-addressed store, hash-verified

145 }
146
147 pub fn write_frame(&mut self, frame: &video_frame::Union) -> ResultType<()> {
148 match frame {
149 video_frame::Union::Vp8s(vp8s) => {
150 if self.ctx.format != CodecFormat::VP8 {
151 self.change(RecorderContext {
152 format: CodecFormat::VP8,
153 ..self.ctx.clone()
154 })?;
155 }
156 for f in vp8s.frames.iter() {
157 self.check_pts(f.pts)?;
158 self.write_video(f);
159 }
160 }
161 video_frame::Union::Vp9s(vp9s) => {
162 if self.ctx.format != CodecFormat::VP9 {
163 self.change(RecorderContext {
164 format: CodecFormat::VP9,
165 ..self.ctx.clone()
166 })?;
167 }
168 for f in vp9s.frames.iter() {
169 self.check_pts(f.pts)?;
170 self.write_video(f);
171 }
172 }
173 video_frame::Union::Av1s(av1s) => {
174 if self.ctx.format != CodecFormat::AV1 {
175 self.change(RecorderContext {
176 format: CodecFormat::AV1,
177 ..self.ctx.clone()
178 })?;
179 }
180 for f in av1s.frames.iter() {
181 self.check_pts(f.pts)?;
182 self.write_video(f);
183 }
184 }
185 #[cfg(feature = "hwcodec")]
186 video_frame::Union::H264s(h264s) => {
187 if self.ctx.format != CodecFormat::H264 {
188 self.change(RecorderContext {
189 format: CodecFormat::H264,
190 ..self.ctx.clone()
191 })?;
192 }
193 for f in h264s.frames.iter() {
194 self.check_pts(f.pts)?;
195 self.write_video(f);
196 }
197 }
198 #[cfg(feature = "hwcodec")]
199 video_frame::Union::H265s(h265s) => {
200 if self.ctx.format != CodecFormat::H265 {
201 self.change(RecorderContext {
202 format: CodecFormat::H265,
203 ..self.ctx.clone()
204 })?;

Callers 1

write_messageMethod · 0.80

Calls 6

changeMethod · 0.80
iterMethod · 0.80
check_ptsMethod · 0.80
write_videoMethod · 0.80
send_stateMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected