FS-8867: create conversion function stubs in the core so modules do not need to use libyuv directly

This commit is contained in:
Seven Du
2016-02-24 18:34:35 +08:00
committed by Michael Jerris
parent cd2c86b427
commit ed78d38994
6 changed files with 165 additions and 44 deletions
+24 -1
View File
@@ -339,7 +339,30 @@ SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width,
SWITCH_DECLARE(switch_img_position_t) parse_img_position(const char *name);
SWITCH_DECLARE(switch_img_fit_t) parse_img_fit(const char *name);
SWITCH_DECLARE(void) switch_img_find_position(switch_img_position_t pos, int sw, int sh, int iw, int ih, int *xP, int *yP);
SWITCH_DECLARE(switch_status_t) switch_img_convert(switch_image_t *src, switch_convert_fmt_t fmt, void *dest, switch_size_t *size);
/*!\brief convert img to raw format
*
* dest should be pre-allocated and big enough for the target fmt
*
* \param[in] src The image descriptor
* \param[in] dest The target memory address
* \param[in] size The size of target memory address used for bounds check
* \param[in] fmt The target format
*/
SWITCH_DECLARE(switch_status_t) switch_img_to_raw(switch_image_t *src, void *dest, switch_size_t size, switch_img_fmt_t fmt);
/*!\brief convert raw memory to switch_img_t
*
* if dest is NULL then a new img is created, user should destroy it later,
* otherwize it will re-used the dest img, and the dest img size must match the src width and height,
* width and height can be 0 in the latter case and it will figure out according to the dest img
*
* \param[in] dest The image descriptor
* \param[in] src The raw data memory address
* \param[in] fmt The raw data format
* \param[in] width The raw data width
* \param[in] height The raw data height
*/
SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void *src, switch_img_fmt_t fmt, int width, int height);
SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_bool_t full, const char *text);
SWITCH_DECLARE(switch_image_t *) switch_img_read_file(const char* file_name);
+27 -3
View File
@@ -59,9 +59,33 @@ SWITCH_BEGIN_EXTERN_C
#define VPX_IMG_FMT_HIGH 0x800 /**< Image uses 16bit framebuffer */
#endif
#define SWITCH_IMG_FMT_HIGH VPX_IMG_FMT_HIGH
#define SWITCH_IMG_FMT_I420 VPX_IMG_FMT_I420
#define SWITCH_IMG_FMT_ARGB VPX_IMG_FMT_ARGB
#define SWITCH_IMG_FMT_NONE VPX_IMG_FMT_NONE
#define SWITCH_IMG_FMT_RGB24 VPX_IMG_FMT_RGB24
#define SWITCH_IMG_FMT_RGB32 VPX_IMG_FMT_RGB32
#define SWITCH_IMG_FMT_RGB565 VPX_IMG_FMT_RGB565
#define SWITCH_IMG_FMT_RGB555 VPX_IMG_FMT_RGB555
#define SWITCH_IMG_FMT_UYVY VPX_IMG_FMT_UYVY
#define SWITCH_IMG_FMT_YUY2 VPX_IMG_FMT_YUY2
#define SWITCH_IMG_FMT_YVYU VPX_IMG_FMT_YVYU
#define SWITCH_IMG_FMT_BGR24 VPX_IMG_FMT_BGR24
#define SWITCH_IMG_FMT_RGB32_LE VPX_IMG_FMT_RGB32_LE
#define SWITCH_IMG_FMT_ARGB VPX_IMG_FMT_ARGB
#define SWITCH_IMG_FMT_ARGB_LE VPX_IMG_FMT_ARGB_LE
#define SWITCH_IMG_FMT_RGB565_LE VPX_IMG_FMT_RGB565_LE
#define SWITCH_IMG_FMT_RGB555_LE VPX_IMG_FMT_RGB555_LE
#define SWITCH_IMG_FMT_YV12 VPX_IMG_FMT_YV12
#define SWITCH_IMG_FMT_I420 VPX_IMG_FMT_I420
#define SWITCH_IMG_FMT_VPXYV12 VPX_IMG_FMT_VPXYV12
#define SWITCH_IMG_FMT_VPXI420 VPX_IMG_FMT_VPXI420
#define SWITCH_IMG_FMT_I422 VPX_IMG_FMT_I422
#define SWITCH_IMG_FMT_I444 VPX_IMG_FMT_I444
#define SWITCH_IMG_FMT_I440 VPX_IMG_FMT_I440
#define SWITCH_IMG_FMT_444A VPX_IMG_FMT_444A
#define SWITCH_IMG_FMT_I42016 VPX_IMG_FMT_I42016
#define SWITCH_IMG_FMT_I42216 VPX_IMG_FMT_I42216
#define SWITCH_IMG_FMT_I44416 VPX_IMG_FMT_I44416
#define SWITCH_IMG_FMT_I44016 VPX_IMG_FMT_I44016
/* experimental */
#define SWITCH_IMG_FMT_GD VPX_IMG_FMT_NONE
typedef vpx_img_fmt_t switch_img_fmt_t;