scrcpy/app/src/v4l2_sink.h
Romain Vimont 238ab872ba Pass video size as codec metadata
On initial connection, scrcpy sent some device metadata:
 - the device name (to be used as window title)
 - the initial video size (before any frame or even SPS/PPS)

But it is better to provide the initial video size as part as the video
stream, so that it can be demuxed and exposed via AVCodecContext to
sinks.

This avoids to pass an explicit "initial frame size" for the screen, the
recorder and the v4l2 sink.
2023-03-11 15:57:25 +01:00

40 lines
742 B
C

#ifndef SC_V4L2_SINK_H
#define SC_V4L2_SINK_H
#include "common.h"
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include "coords.h"
#include "trait/frame_sink.h"
#include "frame_buffer.h"
#include "util/tick.h"
struct sc_v4l2_sink {
struct sc_frame_sink frame_sink; // frame sink trait
struct sc_frame_buffer fb;
AVFormatContext *format_ctx;
AVCodecContext *encoder_ctx;
char *device_name;
sc_thread thread;
sc_mutex mutex;
sc_cond cond;
bool has_frame;
bool stopped;
bool header_written;
AVFrame *frame;
AVPacket *packet;
};
bool
sc_v4l2_sink_init(struct sc_v4l2_sink *vs, const char *device_name);
void
sc_v4l2_sink_destroy(struct sc_v4l2_sink *vs);
#endif