Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7e11cb8aa | ||
|
|
2ef537997e | ||
|
|
778e60ce77 | ||
|
|
45d099e3de | ||
|
|
934bb8efb7 | ||
|
|
fcadb44d45 |
@@ -1,5 +1,7 @@
|
||||
# scrcpy (v1.19)
|
||||
|
||||

|
||||
|
||||
[Read in another language](#translations)
|
||||
|
||||
This application provides display and control of Android devices connected on
|
||||
|
||||
@@ -150,10 +150,7 @@ executable('scrcpy', src,
|
||||
c_args: [])
|
||||
|
||||
install_man('scrcpy.1')
|
||||
install_data('../data/icon.svg',
|
||||
rename: 'scrcpy.svg',
|
||||
install_dir: 'share/icons/hicolor/scalable/apps')
|
||||
install_data('../data/icon_256x256.png',
|
||||
install_data('../data/icon.png',
|
||||
rename: 'scrcpy.png',
|
||||
install_dir: 'share/icons/hicolor/256x256/apps')
|
||||
|
||||
|
||||
@@ -12,15 +12,9 @@
|
||||
#include "util/process.h"
|
||||
#include "util/str_util.h"
|
||||
|
||||
static const char *const scrcpy_icons[] = {
|
||||
#ifdef PORTABLE
|
||||
"icon.svg",
|
||||
"icon.png",
|
||||
#else
|
||||
PREFIX "/share/icons/hicolor/scalable/apps/scrcpy.svg"
|
||||
#define SCRCPY_PORTABLE_ICON_FILENAME "icon.png"
|
||||
#define SCRCPY_DEFAULT_ICON_PATH \
|
||||
PREFIX "/share/icons/hicolor/256x256/apps/scrcpy.png"
|
||||
#endif
|
||||
};
|
||||
|
||||
static char *
|
||||
get_envvar_icon_path(void) {
|
||||
@@ -49,10 +43,6 @@ get_envvar_icon_path(void) {
|
||||
|
||||
static AVFrame *
|
||||
decode_image(const char *path) {
|
||||
// The non-allocation errors are logged in debug mode, because several
|
||||
// paths might be tested sequentially. If the first fails but the second
|
||||
// succeeds, then we don't want error messages in the console.
|
||||
|
||||
AVFrame *result = NULL;
|
||||
|
||||
AVFormatContext *ctx = avformat_alloc_context();
|
||||
@@ -62,18 +52,18 @@ decode_image(const char *path) {
|
||||
}
|
||||
|
||||
if (avformat_open_input(&ctx, path, NULL, NULL) < 0) {
|
||||
LOGD("Could not open image codec: %s", path);
|
||||
LOGE("Could not open image codec: %s", path);
|
||||
goto free_ctx;
|
||||
}
|
||||
|
||||
if (avformat_find_stream_info(ctx, NULL) < 0) {
|
||||
LOGD("Could not find image stream info");
|
||||
LOGE("Could not find image stream info");
|
||||
goto close_input;
|
||||
}
|
||||
|
||||
int stream = av_find_best_stream(ctx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);
|
||||
if (stream < 0 ) {
|
||||
LOGD("Could not find best image stream");
|
||||
LOGE("Could not find best image stream");
|
||||
goto close_input;
|
||||
}
|
||||
|
||||
@@ -81,18 +71,23 @@ decode_image(const char *path) {
|
||||
|
||||
AVCodec *codec = avcodec_find_decoder(params->codec_id);
|
||||
if (!codec) {
|
||||
LOGD("Could not find image decoder");
|
||||
LOGE("Could not find image decoder");
|
||||
goto close_input;
|
||||
}
|
||||
|
||||
AVCodecContext *codec_ctx = avcodec_alloc_context3(codec);
|
||||
if (!codec_ctx) {
|
||||
LOGE("Could not allocate codec context");
|
||||
goto close_input;
|
||||
}
|
||||
|
||||
if (avcodec_parameters_to_context(codec_ctx, params) < 0) {
|
||||
LOGD("Could not fill codec context");
|
||||
LOGE("Could not fill codec context");
|
||||
goto free_codec_ctx;
|
||||
}
|
||||
|
||||
if (avcodec_open2(codec_ctx, codec, NULL) < 0) {
|
||||
LOGD("Could not open image codec");
|
||||
LOGE("Could not open image codec");
|
||||
goto free_codec_ctx;
|
||||
}
|
||||
|
||||
@@ -110,7 +105,7 @@ decode_image(const char *path) {
|
||||
}
|
||||
|
||||
if (av_read_frame(ctx, packet) < 0) {
|
||||
LOGD("Could not read frame");
|
||||
LOGE("Could not read frame");
|
||||
av_packet_free(&packet);
|
||||
av_frame_free(&frame);
|
||||
goto close_codec;
|
||||
@@ -118,14 +113,14 @@ decode_image(const char *path) {
|
||||
|
||||
int ret;
|
||||
if ((ret = avcodec_send_packet(codec_ctx, packet)) < 0) {
|
||||
LOGD("Could not send icon packet: %d", ret);
|
||||
LOGE("Could not send icon packet: %d", ret);
|
||||
av_packet_free(&packet);
|
||||
av_frame_free(&frame);
|
||||
goto close_codec;
|
||||
}
|
||||
|
||||
if ((ret = avcodec_receive_frame(codec_ctx, frame)) != 0) {
|
||||
LOGD("Could not receive icon frame: %d", ret);
|
||||
LOGE("Could not receive icon frame: %d", ret);
|
||||
av_packet_free(&packet);
|
||||
av_frame_free(&frame);
|
||||
goto close_codec;
|
||||
@@ -236,6 +231,7 @@ load_from_path(const char *path) {
|
||||
int ret = SDL_SetPaletteColors(palette, colors, 0, 256);
|
||||
if (ret) {
|
||||
LOGE("Could not set palette colors");
|
||||
SDL_FreeSurface(surface);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@@ -263,21 +259,18 @@ scrcpy_icon_load() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < ARRAY_LEN(scrcpy_icons); ++i) {
|
||||
#ifndef PORTABLE
|
||||
icon = load_from_path(scrcpy_icons[i]);
|
||||
if (icon) {
|
||||
LOGD("Using icon: %s", scrcpy_icons[i]);
|
||||
}
|
||||
LOGD("Using icon: " SCRCPY_DEFAULT_ICON_PATH);
|
||||
icon = load_from_path(SCRCPY_DEFAULT_ICON_PATH);
|
||||
#else
|
||||
icon_path = get_local_file_path(scrcpy_icons[i]);
|
||||
icon = load_from_path(icon_path);
|
||||
if (icon) {
|
||||
LOGD("Using icon (portable): %s", icon_path);
|
||||
}
|
||||
free(icon_path);
|
||||
#endif
|
||||
icon_path = get_local_file_path(SCRCPY_PORTABLE_ICON_FILENAME);
|
||||
if (!icon_path) {
|
||||
LOGE("Could not get icon path");
|
||||
}
|
||||
LOGD("Using icon (portable): %s", icon_path);
|
||||
icon = load_from_path(icon_path);
|
||||
free(icon_path);
|
||||
#endif
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
@@ -94,8 +94,7 @@ dist-win32: build-server build-win32
|
||||
cp "$(WIN32_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||
cp data/scrcpy-console.bat "$(DIST)/$(WIN32_TARGET_DIR)"
|
||||
cp data/scrcpy-noconsole.vbs "$(DIST)/$(WIN32_TARGET_DIR)"
|
||||
cp data/icon_256x256.png "$(DIST)/$(WIN32_TARGET_DIR)/icon.png"
|
||||
cp data/icon.svg "$(DIST)/$(WIN32_TARGET_DIR)"
|
||||
cp data/icon.png "$(DIST)/$(WIN32_TARGET_DIR)"
|
||||
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/avutil-56.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/avcodec-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/avformat-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||
@@ -112,8 +111,7 @@ dist-win64: build-server build-win64
|
||||
cp "$(WIN64_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||
cp data/scrcpy-console.bat "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||
cp data/scrcpy-noconsole.vbs "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||
cp data/icon_256x256.png "$(DIST)/$(WIN64_TARGET_DIR)/icon.png"
|
||||
cp data/icon.svg "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||
cp data/icon.png "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||
cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/avutil-56.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||
cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/avcodec-58.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||
cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/avformat-58.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||
|
||||
Reference in New Issue
Block a user