std::shared_ptr<AVPacket> alloc_packet() { const auto packet = std::shared_ptr<AVPacket>(av_packet_alloc(), [](AVPacket* ptr) { av_packet_free(&ptr); }); if (!packet) FF_RET(AVERROR(ENOMEM), "av_packet_alloc"); return packet; }
std::shared_ptr<AVFrame> poll() { if (fast_path()) { if (fast_path_.empty()) return nullptr; auto result = fast_path_.front(); fast_path_.pop(); return result; } auto filt_frame = ffmpeg::create_frame(); const auto ret = av_buffersink_get_frame( video_graph_out_, filt_frame.get()); if(ret == AVERROR_EOF || ret == AVERROR(EAGAIN)) return nullptr; FF_RET(ret, "poll"); return filt_frame; }
std::shared_ptr<AVFrame> alloc_frame() { const auto frame = std::shared_ptr<AVFrame>(av_frame_alloc(), [](AVFrame* ptr) { av_frame_free(&ptr); }); if (!frame) FF_RET(AVERROR(ENOMEM), "av_frame_alloc"); return frame; }