From 6ba6ec40e364beaedeb97c97beb2bed90798424f Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 11 Apr 2021 15:39:00 +0200 Subject: [PATCH] Add frame sink trait This trait will allow to abstract the concrete sink types from the frame producer (decoder.c). --- app/src/trait/frame_sink.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 app/src/trait/frame_sink.h diff --git a/app/src/trait/frame_sink.h b/app/src/trait/frame_sink.h new file mode 100644 index 00000000..10d2f670 --- /dev/null +++ b/app/src/trait/frame_sink.h @@ -0,0 +1,24 @@ +#ifndef SC_FRAME_SINK +#define SC_FRAME_SINK + +#include "common.h" + +#include +#include + +/** + * Frame sink trait. + * + * Component able to receive AVFrames should implement this trait. + */ +struct sc_frame_sink { + const struct sc_frame_sink_ops *ops; +}; + +struct sc_frame_sink_ops { + bool (*open)(struct sc_frame_sink *sink); + void (*close)(struct sc_frame_sink *sink); + bool (*push)(struct sc_frame_sink *sink, const AVFrame *frame); +}; + +#endif