diff options
2 files changed, 97 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch new file mode 100644 index 0000000000..cc21435dde --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | From 7c558e8ef9375aea953d1e7c854b25947c967f76 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Fri, 7 Jun 2024 23:09:54 -0700 | ||
| 4 | Subject: [PATCH] uvcgadget: Use g_path_get_basename instead of libc basename | ||
| 5 | |||
| 6 | Musl does not implement GNU basename and have fixed a bug where the | ||
| 7 | prototype was leaked into string.h [1], which resullts in compile errors | ||
| 8 | with GCC-14 and Clang-17+ | ||
| 9 | |||
| 10 | | sys/uvcgadget/configfs.c:262:21: error: call to undeclared function 'basename' | ||
| 11 | ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] | ||
| 12 | | 262 | const char *v = basename (globbuf.gl_pathv[i]); | ||
| 13 | | | ^ | ||
| 14 | |||
| 15 | Use glib function instead makes it portable across musl and glibc on | ||
| 16 | linux | ||
| 17 | |||
| 18 | [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7a | ||
| 19 | |||
| 20 | Upstream-Status: Backport [https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/7006] | ||
| 21 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 22 | --- | ||
| 23 | .../gst-plugins-bad/sys/uvcgadget/configfs.c | 18 ++++++++++++------ | ||
| 24 | 1 file changed, 12 insertions(+), 6 deletions(-) | ||
| 25 | |||
| 26 | --- a/sys/uvcgadget/configfs.c | ||
| 27 | +++ b/sys/uvcgadget/configfs.c | ||
| 28 | @@ -7,7 +7,7 @@ | ||
| 29 | * Contact: Kieran Bingham <kieran.bingham@ideasonboard.com> | ||
| 30 | */ | ||
| 31 | |||
| 32 | -/* To provide basename and asprintf from the GNU library. */ | ||
| 33 | +/* To provide asprintf from the GNU library. */ | ||
| 34 | #define _GNU_SOURCE | ||
| 35 | |||
| 36 | #include <dirent.h> | ||
| 37 | @@ -259,9 +259,10 @@ udc_find_video_device (const char *udc, | ||
| 38 | } | ||
| 39 | |||
| 40 | if (i < globbuf.gl_pathc) { | ||
| 41 | - const char *v = basename (globbuf.gl_pathv[i]); | ||
| 42 | + gchar *v = g_path_get_basename (globbuf.gl_pathv[i]); | ||
| 43 | |||
| 44 | video = path_join ("/dev", v); | ||
| 45 | + g_free (v); | ||
| 46 | } | ||
| 47 | |||
| 48 | globfree (&globbuf); | ||
| 49 | @@ -894,6 +895,7 @@ configfs_parse_uvc_function (const char | ||
| 50 | { | ||
| 51 | struct uvc_function_config *fc; | ||
| 52 | char *fpath; | ||
| 53 | + gchar *bname; | ||
| 54 | int ret = 0; | ||
| 55 | |||
| 56 | fc = malloc (sizeof *fc); | ||
| 57 | @@ -923,11 +925,10 @@ configfs_parse_uvc_function (const char | ||
| 58 | * Parse the function configuration. Remove the gadget name qualifier | ||
| 59 | * from the function name, if any. | ||
| 60 | */ | ||
| 61 | - if (function) | ||
| 62 | - function = basename (function); | ||
| 63 | + bname = g_path_get_basename (function); | ||
| 64 | |||
| 65 | fc->udc = attribute_read_str (fpath, "../../UDC"); | ||
| 66 | - fc->video = udc_find_video_device (fc->udc, function); | ||
| 67 | + fc->video = udc_find_video_device (fc->udc, bname); | ||
| 68 | if (!fc->video) { | ||
| 69 | ret = -ENODEV; | ||
| 70 | goto done; | ||
| 71 | @@ -942,6 +943,7 @@ done: | ||
| 72 | } | ||
| 73 | |||
| 74 | free (fpath); | ||
| 75 | + g_free (bname); | ||
| 76 | |||
| 77 | return fc; | ||
| 78 | } | ||
| 79 | @@ -979,12 +981,16 @@ configfs_parse_uvc_videodev (int fd, con | ||
| 80 | char *function = NULL; | ||
| 81 | char rpath[PATH_MAX]; | ||
| 82 | char *res; | ||
| 83 | + gchar *bname; | ||
| 84 | |||
| 85 | res = realpath (video, rpath); | ||
| 86 | if (!res) | ||
| 87 | return NULL; | ||
| 88 | |||
| 89 | - function = video_find_config_name (basename (rpath)); | ||
| 90 | + bname = g_path_get_basename (rpath); | ||
| 91 | + function = video_find_config_name (bname); | ||
| 92 | + g_free (bname); | ||
| 93 | + | ||
| 94 | if (!function) | ||
| 95 | return NULL; | ||
| 96 | |||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.24.3.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.24.3.bb index dbd504e87d..ccb1a54456 100644 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.24.3.bb +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.24.3.bb | |||
| @@ -9,6 +9,7 @@ SRC_URI = "https://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad | |||
| 9 | file://0001-fix-maybe-uninitialized-warnings-when-compiling-with.patch \ | 9 | file://0001-fix-maybe-uninitialized-warnings-when-compiling-with.patch \ |
| 10 | file://0002-avoid-including-sys-poll.h-directly.patch \ | 10 | file://0002-avoid-including-sys-poll.h-directly.patch \ |
| 11 | file://0004-opencv-resolve-missing-opencv-data-dir-in-yocto-buil.patch \ | 11 | file://0004-opencv-resolve-missing-opencv-data-dir-in-yocto-buil.patch \ |
| 12 | file://0001-uvcgadget-Use-g_path_get_basename-instead-of-libc-ba.patch \ | ||
| 12 | " | 13 | " |
| 13 | SRC_URI[sha256sum] = "e90f26c7dc9c76f4aa599b758cfd6d8c10d6a0b9cb265ba2c3c9bdf3888558f8" | 14 | SRC_URI[sha256sum] = "e90f26c7dc9c76f4aa599b758cfd6d8c10d6a0b9cb265ba2c3c9bdf3888558f8" |
| 14 | 15 | ||
