mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Introduce a new packet type, a "session" packet, containing metadata
about the encoding session. It is used only for the video stream and
currently includes the video resolution.
For illustration, here is a sequence of packets on the video stream:
device rotation
v
CODEC | SESSION | MEDIA | MEDIA | … | SESSION | MEDIA | MEDIA | …
1920x1080 <-----------------> 1080x1920 <------------------
encoding session 1 encoding session 2
This metadata is not strictly necessary, since the video resolution can
be determined after decoding. However, it allows detection of cases
where the encoder does not respect the requested size (and logs a
warning), even without decoding (e.g., when there is no video playback).
Additional metadata could be added later if necessary, for example the
actual device rotation.
Refs #5918 <https://github.com/Genymobile/scrcpy/pull/5918>
Refs #5894 <https://github.com/Genymobile/scrcpy/pull/5894>
PR #6159 <https://github.com/Genymobile/scrcpy/pull/6159>
Co-authored-by: gz0119 <liyong2@4399.com>
48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
#ifndef SC_PACKET_SOURCE_H
|
|
#define SC_PACKET_SOURCE_H
|
|
|
|
#include "common.h"
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "trait/packet_sink.h"
|
|
|
|
#define SC_PACKET_SOURCE_MAX_SINKS 2
|
|
|
|
/**
|
|
* Packet source trait
|
|
*
|
|
* Component able to send AVPackets should implement this trait.
|
|
*/
|
|
struct sc_packet_source {
|
|
struct sc_packet_sink *sinks[SC_PACKET_SOURCE_MAX_SINKS];
|
|
unsigned sink_count;
|
|
};
|
|
|
|
void
|
|
sc_packet_source_init(struct sc_packet_source *source);
|
|
|
|
void
|
|
sc_packet_source_add_sink(struct sc_packet_source *source,
|
|
struct sc_packet_sink *sink);
|
|
|
|
bool
|
|
sc_packet_source_sinks_open(struct sc_packet_source *source,
|
|
AVCodecContext *ctx,
|
|
const struct sc_stream_session *session);
|
|
|
|
void
|
|
sc_packet_source_sinks_close(struct sc_packet_source *source);
|
|
|
|
bool
|
|
sc_packet_source_sinks_push(struct sc_packet_source *source,
|
|
const AVPacket *packet);
|
|
|
|
bool
|
|
sc_packet_source_sinks_push_session(struct sc_packet_source *source,
|
|
const struct sc_stream_session *session);
|
|
|
|
void
|
|
sc_packet_source_sinks_disable(struct sc_packet_source *source);
|
|
|
|
#endif
|