1 commit a2ce46c6fde38d6ac54a8a2ee1a5b391e2ed2071
2 Author: Sebastian Kemper <sebastian_ml@gmx.net>
3 Date: Mon Nov 1 09:59:09 2021 +0100
5 [core] fix "--disable-libyuv"
7 Recent changes made it impossible to compile freeswitch without libyuv
10 src/switch_core_video.c: In function 'switch_img_read_from_file':
11 src/switch_core_video.c:3139:4: error: implicit declaration of function 'RAWToI420' [-Werror=implicit-function-declaration]
12 RAWToI420(data, width * 3,
14 src/switch_core_video.c:3148:4: error: implicit declaration of function 'ABGRToARGB' [-Werror=implicit-function-declaration]
15 ABGRToARGB(data, width * 4, img->planes[SWITCH_PLANE_PACKED], img->stride[SWITCH_PLANE_PACKED], width, height);
18 Fix this my adding/moving the checks for "SWITCH_HAVE_YUV".
20 Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
22 --- a/src/switch_core_video.c
23 +++ b/src/switch_core_video.c
24 @@ -3116,6 +3116,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
26 SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char* file_name, switch_img_fmt_t img_fmt)
28 +#ifdef SWITCH_HAVE_YUV
29 int width = 0, height = 0, channels = 0;
31 unsigned char *data = NULL;
32 @@ -3155,12 +3156,16 @@ SWITCH_DECLARE(switch_image_t *) switch_
34 stbi_image_free(data);
41 SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, const char* file_name, int quality)
43 +#ifndef SWITCH_HAVE_YUV
44 + return SWITCH_STATUS_FALSE;
47 unsigned char *data = NULL;
48 const char *ext = strrchr(file_name, '.');
49 @@ -3217,6 +3222,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
52 return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
56 typedef struct data_url_context_s {
57 @@ -3224,14 +3230,19 @@ typedef struct data_url_context_s {
61 +#ifdef SWITCH_HAVE_YUV
62 static void data_url_write_func(void *context, void *data, int size)
64 switch_buffer_t *buffer = (switch_buffer_t *)context;
65 switch_buffer_write(buffer, data, size);
69 SWITCH_DECLARE(switch_status_t) switch_img_data_url(switch_image_t *img, char **urlP, const char *type, int quality)
71 +#ifndef SWITCH_HAVE_YUV
72 + return SWITCH_STATUS_FALSE;
75 unsigned char *data = NULL;
76 int stride_in_bytes = 0;
77 @@ -3300,6 +3311,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
78 switch_buffer_destroy(&buffer);
80 return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
81 +#endif /* SWITCH_HAVE_YUV */
85 --- a/tests/unit/switch_core_video.c
86 +++ b/tests/unit/switch_core_video.c
87 @@ -48,6 +48,7 @@ FST_CORE_BEGIN("./conf")
91 +#ifdef SWITCH_HAVE_YUV
92 FST_TEST_BEGIN(data_url_test)
94 char *data_url = NULL;
95 @@ -88,6 +89,7 @@ FST_CORE_BEGIN("./conf")
96 unlink(argb_filename);
99 +#endif /* SWITCH_HAVE_YUV */
101 FST_TEST_BEGIN(img_patch)
103 @@ -239,6 +241,7 @@ FST_CORE_BEGIN("./conf")
107 +#ifdef SWITCH_HAVE_YUV
108 FST_TEST_BEGIN(stb_data_url)
110 switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 120, 60, 1);
111 @@ -321,6 +324,7 @@ FST_CORE_BEGIN("./conf")
112 unlink(jpg_write_filename);
115 +#endif /* SWITCH_HAVE_YUV */