Compare commits

..
Author SHA1 Message Date
Romain Vimont 60b7281cbc Fix compatibility with old FFmpeg
V4L2 sink used a "url" field format AVFormatContext which has been
introduced in lavf 58.7.100.

Fixes #2382 <https://github.com/Genymobile/scrcpy/issues/2382>

Refs <https://github.com/FFmpeg/FFmpeg/commit/ea3672b7d67c432724bdbc8de0221f869b6a04c6>
Refs <https://github.com/FFmpeg/FFmpeg/commit/fa8308d3d4f27d6fb38ac2069887a7b259f1c6ab>
2021-06-13 18:31:48 +02:00
5 changed files with 11 additions and 11 deletions
+3 -3
View File
@@ -709,15 +709,15 @@ There is no visual feedback, a log is printed to the console.
#### Push file to device #### Push file to device
To push a file to `/sdcard/Download/` on the device, drag & drop a (non-APK) To push a file to `/sdcard/` on the device, drag & drop a (non-APK) file to the
file to the _scrcpy_ window. _scrcpy_ window.
There is no visual feedback, a log is printed to the console. There is no visual feedback, a log is printed to the console.
The target directory can be changed on start: The target directory can be changed on start:
```bash ```bash
scrcpy --push-target=/sdcard/Movies/ scrcpy --push-target=/sdcard/Download/
``` ```
+1 -1
View File
@@ -133,7 +133,7 @@ but breaks the expected behavior of alpha keys in games (typically WASD).
.BI "\-\-push\-target " path .BI "\-\-push\-target " path
Set the target directory for pushing files to the device by drag & drop. It is passed as\-is to "adb push". Set the target directory for pushing files to the device by drag & drop. It is passed as\-is to "adb push".
Default is "/sdcard/Download/". Default is "/sdcard/".
.TP .TP
.BI "\-r, \-\-record " file .BI "\-r, \-\-record " file
+1 -1
View File
@@ -129,7 +129,7 @@ scrcpy_print_usage(const char *arg0) {
" --push-target path\n" " --push-target path\n"
" Set the target directory for pushing files to the device by\n" " Set the target directory for pushing files to the device by\n"
" drag & drop. It is passed as-is to \"adb push\".\n" " drag & drop. It is passed as-is to \"adb push\".\n"
" Default is \"/sdcard/Download/\".\n" " Default is \"/sdcard/\".\n"
"\n" "\n"
" -r, --record file.mp4\n" " -r, --record file.mp4\n"
" Record screen to file.\n" " Record screen to file.\n"
+1 -1
View File
@@ -6,7 +6,7 @@
#include "adb.h" #include "adb.h"
#include "util/log.h" #include "util/log.h"
#define DEFAULT_PUSH_TARGET "/sdcard/Download/" #define DEFAULT_PUSH_TARGET "/sdcard/"
static void static void
file_handler_request_destroy(struct file_handler_request *req) { file_handler_request_destroy(struct file_handler_request *req) {
+5 -5
View File
@@ -181,16 +181,16 @@ sc_v4l2_sink_open(struct sc_v4l2_sink *vs) {
// <https://github.com/FFmpeg/FFmpeg/commit/0694d8702421e7aff1340038559c438b61bb30dd> // <https://github.com/FFmpeg/FFmpeg/commit/0694d8702421e7aff1340038559c438b61bb30dd>
vs->format_ctx->oformat = (AVOutputFormat *) format; vs->format_ctx->oformat = (AVOutputFormat *) format;
#ifdef SCRCPY_LAVF_HAS_AVFORMATCONTEXT_URL #ifdef SCRCPY_LAVF_HAS_AVFORMATCONTEXT_URL
vs->format_ctx->url = strdup(vs->device_name); # define CTX_URL_FIELD url
#else
# define CTX_URL_FIELD filename
#endif
vs->format_ctx->CTX_URL_FIELD = strdup(vs->device_name);
if (!vs->format_ctx->url) { if (!vs->format_ctx->url) {
LOGE("Could not strdup v4l2 device name"); LOGE("Could not strdup v4l2 device name");
goto error_avformat_free_context; goto error_avformat_free_context;
return false; return false;
} }
#else
strncpy(vs->format_ctx->filename, vs->device_name,
sizeof(vs->format_ctx->filename));
#endif
AVStream *ostream = avformat_new_stream(vs->format_ctx, encoder); AVStream *ostream = avformat_new_stream(vs->format_ctx, encoder);
if (!ostream) { if (!ostream) {