| 9 | using namespace streamfx::ffmpeg; |
| 10 | |
| 11 | std::shared_ptr<AVFrame> avframe_queue::create_frame() |
| 12 | { |
| 13 | std::shared_ptr<AVFrame> frame = std::shared_ptr<AVFrame>(av_frame_alloc(), [](AVFrame* frame) { |
| 14 | av_frame_unref(frame); |
| 15 | av_frame_free(&frame); |
| 16 | }); |
| 17 | frame->width = this->_resolution.first; |
| 18 | frame->height = this->_resolution.second; |
| 19 | frame->format = this->_format; |
| 20 | |
| 21 | int res = av_frame_get_buffer(frame.get(), 32); |
| 22 | if (res < 0) { |
| 23 | throw std::runtime_error(tools::get_error_description(res)); |
| 24 | } |
| 25 | |
| 26 | return frame; |
| 27 | } |
| 28 | |
| 29 | avframe_queue::avframe_queue() = default; |
| 30 | |