2024-10-08 02:29:00 +00:00
|
|
|
#ifndef FILTER_H
|
|
|
|
#define FILTER_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include <libavcodec/avcodec.h>
|
|
|
|
#include <libavfilter/avfilter.h>
|
2024-10-10 07:23:13 +00:00
|
|
|
#include <libavutil/buffer.h>
|
2024-10-08 02:29:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Abstract base class for filters
|
|
|
|
class Filter {
|
|
|
|
public:
|
2024-10-21 23:54:22 +00:00
|
|
|
virtual ~Filter() = default;
|
2024-10-10 07:23:13 +00:00
|
|
|
virtual int init(AVCodecContext *dec_ctx, AVCodecContext *enc_ctx, AVBufferRef *hw_ctx) = 0;
|
2024-10-21 23:54:22 +00:00
|
|
|
virtual int process_frame(AVFrame *in_frame, AVFrame **out_frame) = 0;
|
|
|
|
virtual int flush(std::vector<AVFrame *> &flushed_frames) { return 0; }
|
2024-10-08 02:29:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FILTER_H
|