Rename demuxer to video_demuxer
There will be another demuxer instance for audio. PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757>
This commit is contained in:
parent
15556d1f3b
commit
e9876788c9
1 changed files with 19 additions and 16 deletions
|
@ -40,7 +40,7 @@
|
|||
struct scrcpy {
|
||||
struct sc_server server;
|
||||
struct sc_screen screen;
|
||||
struct sc_demuxer demuxer;
|
||||
struct sc_demuxer video_demuxer;
|
||||
struct sc_decoder decoder;
|
||||
struct sc_recorder recorder;
|
||||
#ifdef HAVE_V4L2
|
||||
|
@ -213,7 +213,8 @@ sc_recorder_on_ended(struct sc_recorder *recorder, bool success,
|
|||
}
|
||||
|
||||
static void
|
||||
sc_demuxer_on_ended(struct sc_demuxer *demuxer, bool eos, void *userdata) {
|
||||
sc_video_demuxer_on_ended(struct sc_demuxer *demuxer, bool eos,
|
||||
void *userdata) {
|
||||
(void) demuxer;
|
||||
(void) userdata;
|
||||
|
||||
|
@ -281,7 +282,7 @@ scrcpy(struct scrcpy_options *options) {
|
|||
#ifdef HAVE_V4L2
|
||||
bool v4l2_sink_initialized = false;
|
||||
#endif
|
||||
bool demuxer_started = false;
|
||||
bool video_demuxer_started = false;
|
||||
#ifdef HAVE_USB
|
||||
bool aoa_hid_initialized = false;
|
||||
bool hid_keyboard_initialized = false;
|
||||
|
@ -383,10 +384,11 @@ scrcpy(struct scrcpy_options *options) {
|
|||
file_pusher_initialized = true;
|
||||
}
|
||||
|
||||
static const struct sc_demuxer_callbacks demuxer_cbs = {
|
||||
.on_ended = sc_demuxer_on_ended,
|
||||
static const struct sc_demuxer_callbacks video_demuxer_cbs = {
|
||||
.on_ended = sc_video_demuxer_on_ended,
|
||||
};
|
||||
sc_demuxer_init(&s->demuxer, s->server.video_socket, &demuxer_cbs, NULL);
|
||||
sc_demuxer_init(&s->video_demuxer, s->server.video_socket,
|
||||
&video_demuxer_cbs, NULL);
|
||||
|
||||
bool needs_decoder = options->display;
|
||||
#ifdef HAVE_V4L2
|
||||
|
@ -394,7 +396,7 @@ scrcpy(struct scrcpy_options *options) {
|
|||
#endif
|
||||
if (needs_decoder) {
|
||||
sc_decoder_init(&s->decoder);
|
||||
sc_demuxer_add_sink(&s->demuxer, &s->decoder.packet_sink);
|
||||
sc_demuxer_add_sink(&s->video_demuxer, &s->decoder.packet_sink);
|
||||
}
|
||||
|
||||
if (options->record_filename) {
|
||||
|
@ -413,7 +415,7 @@ scrcpy(struct scrcpy_options *options) {
|
|||
}
|
||||
recorder_started = true;
|
||||
|
||||
sc_demuxer_add_sink(&s->demuxer, &s->recorder.packet_sink);
|
||||
sc_demuxer_add_sink(&s->video_demuxer, &s->recorder.packet_sink);
|
||||
}
|
||||
|
||||
struct sc_controller *controller = NULL;
|
||||
|
@ -621,17 +623,17 @@ aoa_hid_end:
|
|||
#endif
|
||||
|
||||
// now we consumed the header values, the socket receives the video stream
|
||||
// start the demuxer
|
||||
if (!sc_demuxer_start(&s->demuxer)) {
|
||||
// start the video demuxer
|
||||
if (!sc_demuxer_start(&s->video_demuxer)) {
|
||||
goto end;
|
||||
}
|
||||
demuxer_started = true;
|
||||
video_demuxer_started = true;
|
||||
|
||||
ret = event_loop(s);
|
||||
LOGD("quit...");
|
||||
|
||||
// Close the window immediately on closing, because screen_destroy() may
|
||||
// only be called once the demuxer thread is joined (it may take time)
|
||||
// only be called once the video demuxer thread is joined (it may take time)
|
||||
sc_screen_hide_window(&s->screen);
|
||||
|
||||
end:
|
||||
|
@ -672,8 +674,8 @@ end:
|
|||
|
||||
// now that the sockets are shutdown, the demuxer and controller are
|
||||
// interrupted, we can join them
|
||||
if (demuxer_started) {
|
||||
sc_demuxer_join(&s->demuxer);
|
||||
if (video_demuxer_started) {
|
||||
sc_demuxer_join(&s->video_demuxer);
|
||||
}
|
||||
|
||||
#ifdef HAVE_V4L2
|
||||
|
@ -692,8 +694,9 @@ end:
|
|||
}
|
||||
#endif
|
||||
|
||||
// Destroy the screen only after the demuxer is guaranteed to be finished,
|
||||
// because otherwise the screen could receive new frames after destruction
|
||||
// Destroy the screen only after the video demuxer is guaranteed to be
|
||||
// finished, because otherwise the screen could receive new frames after
|
||||
// destruction
|
||||
if (screen_initialized) {
|
||||
sc_screen_join(&s->screen);
|
||||
sc_screen_destroy(&s->screen);
|
||||
|
|
Loading…
Reference in a new issue