Add frame sink trait
This trait will allow to abstract the concrete sink types from the frame producer (decoder.c).
This commit is contained in:
parent
f7a1b67d66
commit
deab7da761
1 changed files with 26 additions and 0 deletions
26
app/src/trait/frame_sink.h
Normal file
26
app/src/trait/frame_sink.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef SC_FRAME_SINK
|
||||||
|
#define SC_FRAME_SINK
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
typedef struct AVFrame AVFrame;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
Loading…
Reference in a new issue