lib/ffmpeg/Buffer: add noexcept

This commit is contained in:
Max Kellermann 2020-11-04 19:47:07 +01:00
parent 9332527872
commit f9bdb4b0b8

View File

@ -27,24 +27,24 @@ extern "C" {
#include <cstddef>
class FfmpegBuffer {
void *data;
unsigned size;
void *data = nullptr;
unsigned size = 0;
public:
FfmpegBuffer():data(nullptr), size(0) {}
FfmpegBuffer() noexcept = default;
~FfmpegBuffer() {
~FfmpegBuffer() noexcept {
av_free(data);
}
gcc_malloc
void *Get(size_t min_size) {
void *Get(size_t min_size) noexcept {
av_fast_malloc(&data, &size, min_size);
return data;
}
template<typename T>
T *GetT(size_t n) {
T *GetT(size_t n) noexcept {
return (T *)Get(n * sizeof(T));
}
};