Do not use avformat network

Scrcpy does not use FFmpeg network features. Initialize network locally
instead (useful only for Windows).

The include block has been moved to fix the following warning:

    Please include winsock2.h before windows.h
This commit is contained in:
Romain Vimont 2023-02-27 20:03:04 +01:00
parent 0702be86d8
commit 8e8b039a63

View file

@ -4,10 +4,6 @@
#include <stdbool.h>
#include <unistd.h>
#include <libavformat/avformat.h>
#ifdef _WIN32
#include <windows.h>
#include "util/str.h"
#endif
#ifdef HAVE_V4L2
# include <libavdevice/avdevice.h>
#endif
@ -19,8 +15,14 @@
#include "scrcpy.h"
#include "usb/scrcpy_otg.h"
#include "util/log.h"
#include "util/net.h"
#include "version.h"
#ifdef _WIN32
#include <windows.h>
#include "util/str.h"
#endif
int
main_scrcpy(int argc, char *argv[]) {
#ifdef _WIN32
@ -69,7 +71,7 @@ main_scrcpy(int argc, char *argv[]) {
}
#endif
if (avformat_network_init()) {
if (!net_init()) {
return SCRCPY_EXIT_FAILURE;
}
@ -80,8 +82,6 @@ main_scrcpy(int argc, char *argv[]) {
enum scrcpy_exit_code ret = scrcpy(&args.opts);
#endif
avformat_network_deinit(); // ignore failure
return ret;
}