| 97 | } |
| 98 | |
| 99 | VideoEncoderError FFmpegEncoderPlugin::Encode(const std::shared_ptr<Image>& i420_image, uint64_t frame_index, const std::any& extra) { |
| 100 | auto cap_video_frame = std::any_cast<CaptureVideoFrame>(extra); |
| 101 | auto monitor_name = std::string(cap_video_frame.display_name_); |
| 102 | if (!i420_image) { |
| 103 | return VideoEncoderError::InvalidInput(); |
| 104 | } |
| 105 | if (!HasEncoderForMonitor(monitor_name)) { |
| 106 | return VideoEncoderError::NotFound(); |
| 107 | } |
| 108 | if (!video_encoders_[monitor_name]->Encode(i420_image, frame_index, extra)) { |
| 109 | return VideoEncoderError::EncodeFailed(); |
| 110 | } |
| 111 | return VideoEncoderError::Ok(); |
| 112 | } |
| 113 | |
| 114 | void FFmpegEncoderPlugin::Exit(const std::string& monitor_name) { |
| 115 | if (HasEncoderForMonitor(monitor_name)) { |
nothing calls this directly
no outgoing calls
no test coverage detected