MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / drain

Method drain

pj_scene2D/core/src/ffmpeg_decoder.cpp:339–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339std::vector<DecodedFrame> FfmpegDecoder::drain() {
340 std::vector<DecodedFrame> frames;
341 if (codec_ctx_ == nullptr) {
342 return frames;
343 }
344
345 // Send NULL packet to drain
346 avcodec_send_packet(codec_ctx_, nullptr);
347
348 AVFrame* frame = av_frame_alloc();
349 while (avcodec_receive_frame(codec_ctx_, frame) >= 0) {
350 auto result = avFrameToDecodedFrame(frame);
351 if (result.has_value()) {
352 result->pts = frame->pts;
353 frames.push_back(std::move(*result));
354 }
355 av_frame_unref(frame);
356 }
357 av_frame_free(&frame);
358 return frames;
359}
360
361int FfmpegDecoder::width() const {
362 return codec_ctx_ != nullptr ? codec_ctx_->width : 0;

Callers 3

serveForwardMethod · 0.45
decodeSampledForwardMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected