|
13 | 13 | extern "C" { |
14 | 14 | #include <libavcodec/avcodec.h> |
15 | 15 | #include <libavfilter/avfilter.h> |
| 16 | +#include <libavfilter/buffersrc.h> |
16 | 17 | #include <libavformat/avformat.h> |
17 | 18 | #include <libavformat/avio.h> |
18 | 19 | #include <libavutil/audio_fifo.h> |
@@ -41,6 +42,15 @@ struct Deleterp { |
41 | 42 | } |
42 | 43 | }; |
43 | 44 |
|
| 45 | +template <typename T, typename R, R (*Fn)(void*)> |
| 46 | +struct Deleterv { |
| 47 | + inline void operator()(T* p) const { |
| 48 | + if (p) { |
| 49 | + Fn(&p); |
| 50 | + } |
| 51 | + } |
| 52 | +}; |
| 53 | + |
44 | 54 | template <typename T, typename R, R (*Fn)(T*)> |
45 | 55 | struct Deleter { |
46 | 56 | inline void operator()(T* p) const { |
@@ -78,6 +88,9 @@ using UniqueAVAudioFifo = std:: |
78 | 88 | unique_ptr<AVAudioFifo, Deleter<AVAudioFifo, void, av_audio_fifo_free>>; |
79 | 89 | using UniqueAVBufferRef = |
80 | 90 | std::unique_ptr<AVBufferRef, Deleterp<AVBufferRef, void, av_buffer_unref>>; |
| 91 | +using UniqueAVBufferSrcParameters = std::unique_ptr< |
| 92 | + AVBufferSrcParameters, |
| 93 | + Deleterv<AVBufferSrcParameters, void, av_freep>>; |
81 | 94 |
|
82 | 95 | // These 2 classes share the same underlying AVPacket object. They are meant to |
83 | 96 | // be used in tandem, like so: |
|
0 commit comments