Move utilities to util/
This commit is contained in:
parent
83ace84280
commit
dfd0707a29
40 changed files with 58 additions and 57 deletions
|
@ -10,16 +10,16 @@ src = [
|
||||||
'src/file_handler.c',
|
'src/file_handler.c',
|
||||||
'src/fps_counter.c',
|
'src/fps_counter.c',
|
||||||
'src/input_manager.c',
|
'src/input_manager.c',
|
||||||
'src/net.c',
|
|
||||||
'src/receiver.c',
|
'src/receiver.c',
|
||||||
'src/recorder.c',
|
'src/recorder.c',
|
||||||
'src/scrcpy.c',
|
'src/scrcpy.c',
|
||||||
'src/screen.c',
|
'src/screen.c',
|
||||||
'src/server.c',
|
'src/server.c',
|
||||||
'src/str_util.c',
|
|
||||||
'src/tiny_xpm.c',
|
|
||||||
'src/stream.c',
|
'src/stream.c',
|
||||||
|
'src/tiny_xpm.c',
|
||||||
'src/video_buffer.c',
|
'src/video_buffer.c',
|
||||||
|
'src/util/net.c',
|
||||||
|
'src/util/str_util.c'
|
||||||
]
|
]
|
||||||
|
|
||||||
if not get_option('crossbuild_windows')
|
if not get_option('crossbuild_windows')
|
||||||
|
@ -147,7 +147,7 @@ tests = [
|
||||||
['test_control_event_serialize', [
|
['test_control_event_serialize', [
|
||||||
'tests/test_control_msg_serialize.c',
|
'tests/test_control_msg_serialize.c',
|
||||||
'src/control_msg.c',
|
'src/control_msg.c',
|
||||||
'src/str_util.c'
|
'src/util/str_util.c'
|
||||||
]],
|
]],
|
||||||
['test_device_event_deserialize', [
|
['test_device_event_deserialize', [
|
||||||
'tests/test_device_msg_deserialize.c',
|
'tests/test_device_msg_deserialize.c',
|
||||||
|
@ -158,7 +158,7 @@ tests = [
|
||||||
]],
|
]],
|
||||||
['test_strutil', [
|
['test_strutil', [
|
||||||
'tests/test_strutil.c',
|
'tests/test_strutil.c',
|
||||||
'src/str_util.c'
|
'src/util/str_util.c'
|
||||||
]],
|
]],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
#include "str_util.h"
|
#include "util/str_util.h"
|
||||||
|
|
||||||
static const char *adb_command;
|
static const char *adb_command;
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
#include <SDL2/SDL_assert.h>
|
#include <SDL2/SDL_assert.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "buffer_util.h"
|
#include "util/buffer_util.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
#include "str_util.h"
|
#include "util/str_util.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_position(uint8_t *buf, const struct position *position) {
|
write_position(uint8_t *buf, const struct position *position) {
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
#include <SDL2/SDL_assert.h>
|
#include <SDL2/SDL_assert.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "lock_util.h"
|
#include "util/lock.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
controller_init(struct controller *controller, socket_t control_socket) {
|
controller_init(struct controller *controller, socket_t control_socket) {
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
#include <SDL2/SDL_thread.h>
|
#include <SDL2/SDL_thread.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "cbuf.h"
|
|
||||||
#include "control_msg.h"
|
#include "control_msg.h"
|
||||||
#include "net.h"
|
|
||||||
#include "receiver.h"
|
#include "receiver.h"
|
||||||
|
#include "util/cbuf.h"
|
||||||
|
#include "util/net.h"
|
||||||
|
|
||||||
struct control_msg_queue CBUF(struct control_msg, 64);
|
struct control_msg_queue CBUF(struct control_msg, 64);
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "buffer_util.h"
|
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include "lock_util.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "recorder.h"
|
#include "recorder.h"
|
||||||
#include "video_buffer.h"
|
#include "video_buffer.h"
|
||||||
|
#include "util/buffer_util.h"
|
||||||
|
#include "util/lock.h"
|
||||||
|
#include "util/log.h"
|
||||||
|
|
||||||
// set the decoded frame as ready for rendering, and notify
|
// set the decoded frame as ready for rendering, and notify
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
device_read_info(socket_t device_socket, char *device_name, struct size *size) {
|
device_read_info(socket_t device_socket, char *device_name, struct size *size) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "net.h"
|
#include "util/net.h"
|
||||||
|
|
||||||
#define DEVICE_NAME_FIELD_LENGTH 64
|
#define DEVICE_NAME_FIELD_LENGTH 64
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <SDL2/SDL_assert.h>
|
#include <SDL2/SDL_assert.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "buffer_util.h"
|
#include "util/buffer_util.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
device_msg_deserialize(const unsigned char *buf, size_t len,
|
device_msg_deserialize(const unsigned char *buf, size_t len,
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "lock_util.h"
|
#include "util/lock.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
#define DEFAULT_PUSH_TARGET "/sdcard/"
|
#define DEFAULT_PUSH_TARGET "/sdcard/"
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include <SDL2/SDL_thread.h>
|
#include <SDL2/SDL_thread.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "cbuf.h"
|
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
#include "util/cbuf.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ACTION_INSTALL_APK,
|
ACTION_INSTALL_APK,
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <SDL2/SDL_timer.h>
|
#include <SDL2/SDL_timer.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "lock_util.h"
|
#include "util/lock.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
#define FPS_COUNTER_INTERVAL_MS 1000
|
#define FPS_COUNTER_INTERVAL_MS 1000
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "event_converter.h"
|
#include "event_converter.h"
|
||||||
#include "lock_util.h"
|
#include "util/lock.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
// Convert window coordinates (as provided by SDL_GetMouseState() to renderer
|
// Convert window coordinates (as provided by SDL_GetMouseState() to renderer
|
||||||
// coordinates (as provided in SDL mouse events)
|
// coordinates (as provided in SDL mouse events)
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "log.h"
|
|
||||||
#include "recorder.h"
|
#include "recorder.h"
|
||||||
|
#include "util/log.h"
|
||||||
|
|
||||||
struct args {
|
struct args {
|
||||||
struct scrcpy_options opts;
|
struct scrcpy_options opts;
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "device_msg.h"
|
#include "device_msg.h"
|
||||||
#include "lock_util.h"
|
#include "util/lock.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
receiver_init(struct receiver *receiver, socket_t control_socket) {
|
receiver_init(struct receiver *receiver, socket_t control_socket) {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <SDL2/SDL_thread.h>
|
#include <SDL2/SDL_thread.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "net.h"
|
#include "util/net.h"
|
||||||
|
|
||||||
// receive events from the device
|
// receive events from the device
|
||||||
// managed by the controller
|
// managed by the controller
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "lock_util.h"
|
#include "util/lock.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
static const AVRational SCRCPY_TIME_BASE = {1, 1000000}; // timestamps in us
|
static const AVRational SCRCPY_TIME_BASE = {1, 1000000}; // timestamps in us
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "queue.h"
|
#include "util/queue.h"
|
||||||
|
|
||||||
enum recorder_format {
|
enum recorder_format {
|
||||||
RECORDER_FORMAT_AUTO,
|
RECORDER_FORMAT_AUTO,
|
||||||
|
|
|
@ -18,15 +18,15 @@
|
||||||
#include "file_handler.h"
|
#include "file_handler.h"
|
||||||
#include "fps_counter.h"
|
#include "fps_counter.h"
|
||||||
#include "input_manager.h"
|
#include "input_manager.h"
|
||||||
#include "log.h"
|
|
||||||
#include "lock_util.h"
|
|
||||||
#include "net.h"
|
|
||||||
#include "recorder.h"
|
#include "recorder.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
#include "tiny_xpm.h"
|
#include "tiny_xpm.h"
|
||||||
#include "video_buffer.h"
|
#include "video_buffer.h"
|
||||||
|
#include "util/lock.h"
|
||||||
|
#include "util/log.h"
|
||||||
|
#include "util/net.h"
|
||||||
|
|
||||||
static struct server server = SERVER_INITIALIZER;
|
static struct server server = SERVER_INITIALIZER;
|
||||||
static struct screen screen = SCREEN_INITIALIZER;
|
static struct screen screen = SCREEN_INITIALIZER;
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "icon.xpm"
|
#include "icon.xpm"
|
||||||
#include "lock_util.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "tiny_xpm.h"
|
#include "tiny_xpm.h"
|
||||||
#include "video_buffer.h"
|
#include "video_buffer.h"
|
||||||
|
#include "util/lock.h"
|
||||||
|
#include "util/log.h"
|
||||||
|
|
||||||
#define DISPLAY_MARGINS 96
|
#define DISPLAY_MARGINS 96
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
#include "net.h"
|
#include "util/net.h"
|
||||||
|
|
||||||
#define SOCKET_NAME "scrcpy"
|
#define SOCKET_NAME "scrcpy"
|
||||||
#define SERVER_FILENAME "scrcpy-server"
|
#define SERVER_FILENAME "scrcpy-server"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "net.h"
|
#include "util/net.h"
|
||||||
|
|
||||||
struct server {
|
struct server {
|
||||||
char *serial;
|
char *serial;
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include "buffer_util.h"
|
|
||||||
#include "decoder.h"
|
#include "decoder.h"
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include "lock_util.h"
|
|
||||||
#include "log.h"
|
|
||||||
#include "recorder.h"
|
#include "recorder.h"
|
||||||
|
#include "util/buffer_util.h"
|
||||||
|
#include "util/lock.h"
|
||||||
|
#include "util/log.h"
|
||||||
|
|
||||||
#define BUFSIZE 0x10000
|
#define BUFSIZE 0x10000
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <SDL2/SDL_thread.h>
|
#include <SDL2/SDL_thread.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "net.h"
|
#include "util/net.h"
|
||||||
|
|
||||||
struct video_buffer;
|
struct video_buffer;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "log.h"
|
|
||||||
|
#include "util/log.h"
|
||||||
|
|
||||||
enum process_result
|
enum process_result
|
||||||
cmd_execute(const char *path, const char *const argv[], pid_t *pid) {
|
cmd_execute(const char *path, const char *const argv[], pid_t *pid) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "net.h"
|
#include "util/net.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
struct index {
|
struct index {
|
||||||
char c;
|
char c;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef LOCKUTIL_H
|
#ifndef LOCK_H
|
||||||
#define LOCKUTIL_H
|
#define LOCK_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <SDL2/SDL_mutex.h>
|
#include <SDL2/SDL_mutex.h>
|
|
@ -6,8 +6,8 @@
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "lock_util.h"
|
#include "util/lock.h"
|
||||||
#include "log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
video_buffer_init(struct video_buffer *vb, struct fps_counter *fps_counter,
|
video_buffer_init(struct video_buffer *vb, struct fps_counter *fps_counter,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "cbuf.h"
|
#include "util/cbuf.h"
|
||||||
|
|
||||||
struct int_queue CBUF(int, 32);
|
struct int_queue CBUF(int, 32);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <queue.h>
|
#include "util/queue.h"
|
||||||
|
|
||||||
struct foo {
|
struct foo {
|
||||||
int value;
|
int value;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "str_util.h"
|
#include "util/str_util.h"
|
||||||
|
|
||||||
static void test_xstrncpy_simple(void) {
|
static void test_xstrncpy_simple(void) {
|
||||||
char s[] = "xxxxxxxxxx";
|
char s[] = "xxxxxxxxxx";
|
||||||
|
|
Loading…
Reference in a new issue