Make decoder push frames to sinks

Now that screen implements the packet sink trait, make decoder push
packets to the sinks without depending on the concrete sink types.
This commit is contained in:
Romain Vimont
2021-04-11 15:01:05 +02:00
parent 08b3086ffc
commit 6f5ad21f57
3 changed files with 70 additions and 14 deletions

View File

@@ -8,24 +8,22 @@
#include <stdbool.h>
#include <libavformat/avformat.h>
struct video_buffer;
#define DECODER_MAX_SINKS 1
struct decoder {
struct sc_packet_sink packet_sink; // packet sink trait
struct video_buffer *video_buffer;
struct sc_frame_sink *sinks[DECODER_MAX_SINKS];
unsigned sink_count;
AVCodecContext *codec_ctx;
AVFrame *frame;
};
void
decoder_init(struct decoder *decoder, struct video_buffer *vb);
bool
decoder_open(struct decoder *decoder, const AVCodec *codec);
decoder_init(struct decoder *decoder);
void
decoder_close(struct decoder *decoder);
decoder_add_sink(struct decoder *decoder, struct sc_frame_sink *sink);
#endif