mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-02 22:29:25 +00:00
Add packet sink trait
This trait will allow to abstract the concrete sink types from the packet producer (stream.c).
This commit is contained in:
parent
042ace4b4e
commit
f3879fc92d
1 changed files with 25 additions and 0 deletions
25
app/src/trait/packet_sink.h
Normal file
25
app/src/trait/packet_sink.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef SC_PACKET_SINK
|
||||||
|
#define SC_PACKET_SINK
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <libavcodec/avcodec.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Packet sink trait.
|
||||||
|
*
|
||||||
|
* Component able to receive AVPackets should implement this trait.
|
||||||
|
*/
|
||||||
|
struct sc_packet_sink {
|
||||||
|
const struct sc_packet_sink_ops *ops;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sc_packet_sink_ops {
|
||||||
|
bool (*open)(struct sc_packet_sink *sink, const AVCodec *codec);
|
||||||
|
void (*close)(struct sc_packet_sink *sink);
|
||||||
|
bool (*push)(struct sc_packet_sink *sink, const AVPacket *packet);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue