--- 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 * --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -48,13 +48,13 @@ #include #endif +#ifdef SWITCH_HAVE_YUV #define STB_IMAGE_IMPLEMENTATION #include "../libs/stb/stb_image.h" #define STB_IMAGE_WRITE_IMPLEMENTATION #include "../libs/stb/stb_image_write.h" -#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 @@ -3114,6 +3114,7 @@ SWITCH_DECLARE(switch_status_t) switch_i #endif +#ifdef SWITCH_HAVE_YUV SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char* file_name, switch_img_fmt_t img_fmt) { int width = 0, height = 0, channels = 0; @@ -3301,7 +3302,7 @@ SWITCH_DECLARE(switch_status_t) switch_i 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") } FST_TEARDOWN_END() +#ifdef SWITCH_HAVE_YUV FST_TEST_BEGIN(data_url_test) { char *data_url = NULL; @@ -88,6 +89,7 @@ FST_CORE_BEGIN("./conf") unlink(argb_filename); } FST_TEST_END() +#endif /* SWITCH_HAVE_YUV */ FST_TEST_BEGIN(img_patch) { @@ -239,6 +241,7 @@ FST_CORE_BEGIN("./conf") } FST_TEST_END() +#ifdef SWITCH_HAVE_YUV FST_TEST_BEGIN(stb_data_url) { switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 120, 60, 1); @@ -321,6 +324,7 @@ FST_CORE_BEGIN("./conf") unlink(jpg_write_filename); } FST_TEST_END() +#endif /* SWITCH_HAVE_YUV */ } FST_SUITE_END() }