Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2019-05-06 17:30:24 +0300
committerMark Thompson <sw@jkqxz.net>2019-06-03 00:58:22 +0300
commita4448637380d9397a7ea5d644e9853af90a66a89 (patch)
tree82fcc5a87c5dc48927f20a5fe60b97fc51fb2835
parent1f8b36329f20ea08eafe3823b1e1b3785d74768d (diff)
ffmpeg_hw: Treat empty device string as no device setting
The implementation will use some default in this case. The empty string is not a meaningful device for any existing hardware type, and indeed OpenCL treats it identically to no device already to work around the lack of this setting on the command line.
-rw-r--r--fftools/ffmpeg_hw.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fftools/ffmpeg_hw.c b/fftools/ffmpeg_hw.c
index d454ae7179..962d8f7d5a 100644
--- a/fftools/ffmpeg_hw.c
+++ b/fftools/ffmpeg_hw.c
@@ -155,10 +155,12 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
++p;
q = strchr(p, ',');
if (q) {
- device = av_strndup(p, q - p);
- if (!device) {
- err = AVERROR(ENOMEM);
- goto fail;
+ if (q - p > 0) {
+ device = av_strndup(p, q - p);
+ if (!device) {
+ err = AVERROR(ENOMEM);
+ goto fail;
+ }
}
err = av_dict_parse_string(&options, q + 1, "=", ",", 0);
if (err < 0) {
@@ -168,7 +170,8 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
}
err = av_hwdevice_ctx_create(&device_ref, type,
- device ? device : p, options, 0);
+ q ? device : p[0] ? p : NULL,
+ options, 0);
if (err < 0)
goto fail;