mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-15 03:26:00 +08:00
Make decoder implement the packet sink trait. This will allow the stream to push packets without depending on the concrete sink type.
35 lines
600 B
C
35 lines
600 B
C
#ifndef DECODER_H
|
|
#define DECODER_H
|
|
|
|
#include "common.h"
|
|
|
|
#include "trait/packet_sink.h"
|
|
|
|
#include <stdbool.h>
|
|
#include <libavformat/avformat.h>
|
|
|
|
struct video_buffer;
|
|
|
|
struct decoder {
|
|
struct sc_packet_sink packet_sink; // packet sink trait
|
|
|
|
struct video_buffer *video_buffer;
|
|
|
|
AVCodecContext *codec_ctx;
|
|
AVFrame *frame;
|
|
};
|
|
|
|
void
|
|
decoder_init(struct decoder *decoder, struct video_buffer *vb);
|
|
|
|
bool
|
|
decoder_open(struct decoder *decoder, const AVCodec *codec);
|
|
|
|
void
|
|
decoder_close(struct decoder *decoder);
|
|
|
|
bool
|
|
decoder_push(struct decoder *decoder, const AVPacket *packet);
|
|
|
|
#endif
|