freeswitch: update 480-fix-libyuv-dependency.patch 705/head
authorSebastian Kemper <sebastian_ml@gmx.net>
Sat, 6 Nov 2021 11:29:16 +0000 (12:29 +0100)
committerSebastian Kemper <sebastian_ml@gmx.net>
Sat, 6 Nov 2021 11:29:18 +0000 (12:29 +0100)
Update the patch with the version that actually was applied upstream. No
functional change.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
net/freeswitch/patches/480-fix-libyuv-dependency.patch

index 9c5f851b0df597e89960254943d852aa97c0165b..0dbc19e000291953b410d29f518a8a00c1745aa9 100644 (file)
@@ -1,55 +1,87 @@
---- a/src/include/switch_core_video.h
-+++ b/src/include/switch_core_video.h
-@@ -394,6 +394,7 @@ SWITCH_DECLARE(switch_image_t *) switch_
- SWITCH_DECLARE(switch_status_t) switch_img_write_png(switch_image_t *img, char *file_name);
- SWITCH_DECLARE(switch_status_t) switch_png_open(switch_png_t **pngP, const char *file_name);
- SWITCH_DECLARE(void) switch_png_free(switch_png_t **pngP);
-+#ifdef SWITCH_HAVE_YUV
- SWITCH_DECLARE(switch_status_t) switch_img_data_url_png(switch_image_t *img, char **urlP);
- SWITCH_DECLARE(switch_status_t) switch_img_data_url(switch_image_t *img, char **urlP, const char *type, int quality);
-@@ -405,6 +406,7 @@ SWITCH_DECLARE(switch_image_t *) switch_
- * \param[in]    quality   Only used in jpg, 1 ~ 100
- */
- SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, const char* file_name, int quality);
-+#endif
- /*!\brief put a small img over a big IMG at position x,y, with alpha transparency
- *
+commit a2ce46c6fde38d6ac54a8a2ee1a5b391e2ed2071
+Author: Sebastian Kemper <sebastian_ml@gmx.net>
+Date:   Mon Nov 1 09:59:09 2021 +0100
+
+    [core] fix "--disable-libyuv"
+    
+    Recent changes made it impossible to compile freeswitch without libyuv
+    support.
+    
+    src/switch_core_video.c: In function 'switch_img_read_from_file':
+    src/switch_core_video.c:3139:4: error: implicit declaration of function 'RAWToI420' [-Werror=implicit-function-declaration]
+    RAWToI420(data, width * 3,
+    ^
+    src/switch_core_video.c:3148:4: error: implicit declaration of function 'ABGRToARGB' [-Werror=implicit-function-declaration]
+    ABGRToARGB(data, width * 4, img->planes[SWITCH_PLANE_PACKED], img->stride[SWITCH_PLANE_PACKED], width, height);
+    ^
+    
+    Fix this my adding/moving the checks for "SWITCH_HAVE_YUV".
+    
+    Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
+
 --- a/src/switch_core_video.c
 +++ b/src/switch_core_video.c
-@@ -48,13 +48,13 @@
- #include <gd.h>
- #endif
+@@ -3116,6 +3116,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
  
+ SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char* file_name, switch_img_fmt_t img_fmt)
+ {
 +#ifdef SWITCH_HAVE_YUV
- #define STB_IMAGE_IMPLEMENTATION
- #include "../libs/stb/stb_image.h"
+       int width = 0, height = 0, channels = 0;
+       int comp = STBI_rgb;
+       unsigned char *data = NULL;
+@@ -3155,12 +3156,16 @@ SWITCH_DECLARE(switch_image_t *) switch_
+       } else if (data) {
+               stbi_image_free(data);
+       }
++#endif
  
- #define STB_IMAGE_WRITE_IMPLEMENTATION
- #include "../libs/stb/stb_image_write.h"
+       return NULL;
+ }
  
--#ifdef SWITCH_HAVE_YUV
- static inline void switch_img_get_yuv_pixel(switch_image_t *img, switch_yuv_color_t *yuv, int x, int y);
- #endif
+ SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, const char* file_name, int quality)
+ {
++#ifndef SWITCH_HAVE_YUV
++      return SWITCH_STATUS_FALSE;
++#else
+       int comp = STBI_rgb;
+       unsigned char *data = NULL;
+       const char *ext = strrchr(file_name, '.');
+@@ -3217,6 +3222,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
+       free(data);
  
-@@ -3114,6 +3114,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
+       return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
++#endif
+ }
  
- #endif
+ typedef struct data_url_context_s {
+@@ -3224,14 +3230,19 @@ typedef struct data_url_context_s {
+       char **urlP;
+ } data_url_context_t;
  
 +#ifdef SWITCH_HAVE_YUV
SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char* file_name, switch_img_fmt_t img_fmt)
static void data_url_write_func(void *context, void *data, int size)
  {
-       int width = 0, height = 0, channels = 0;
-@@ -3301,7 +3302,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
+       switch_buffer_t *buffer = (switch_buffer_t *)context;
+       switch_buffer_write(buffer, data, size);
+ }
++#endif
+ SWITCH_DECLARE(switch_status_t) switch_img_data_url(switch_image_t *img, char **urlP, const char *type, int quality)
+ {
++#ifndef SWITCH_HAVE_YUV
++      return SWITCH_STATUS_FALSE;
++#else
+       int comp = STBI_rgb;
+       unsigned char *data = NULL;
+       int stride_in_bytes = 0;
+@@ -3300,6 +3311,7 @@ SWITCH_DECLARE(switch_status_t) switch_i
+       switch_buffer_destroy(&buffer);
  
        return ret ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
- }
--
 +#endif /* SWITCH_HAVE_YUV */
+ }
  
- SWITCH_DECLARE(switch_status_t) switch_img_letterbox(switch_image_t *img, switch_image_t **imgP, int width, int height, const char *color)
- {
 --- a/tests/unit/switch_core_video.c
 +++ b/tests/unit/switch_core_video.c
 @@ -48,6 +48,7 @@ FST_CORE_BEGIN("./conf")