MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / ScopedFrame

Class ScopedFrame

examples/VulkanBenchmark.cpp:66–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64using Micros = std::chrono::microseconds;
65
66struct ScopedFrame {
67 AVFrame* frame = nullptr;
68
69 ScopedFrame() : frame(av_frame_alloc()) {}
70 explicit ScopedFrame(AVFrame* value) : frame(value) {}
71
72 ~ScopedFrame() {
73 if (frame)
74 av_frame_free(&frame);
75 }
76
77 ScopedFrame(const ScopedFrame&) = delete;
78 ScopedFrame& operator=(const ScopedFrame&) = delete;
79
80 ScopedFrame(ScopedFrame&& other) noexcept : frame(other.frame) {
81 other.frame = nullptr;
82 }
83
84 ScopedFrame& operator=(ScopedFrame&& other) noexcept {
85 if (this != &other) {
86 if (frame)
87 av_frame_free(&frame);
88 frame = other.frame;
89 other.frame = nullptr;
90 }
91 return *this;
92 }
93
94 AVFrame* get() const { return frame; }
95 AVFrame* release() {
96 AVFrame* value = frame;
97 frame = nullptr;
98 return value;
99 }
100 operator bool() const { return frame != nullptr; }
101};
102
103struct ScopedPacket {
104 AVPacket* packet = nullptr;

Callers 2

NextFrameMethod · 0.85
RunVulkanUploadBenchmarkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected