(&mut self, frame: &video_frame::Union)
| 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 | })?; |
no test coverage detected