FreeSWITCH API Documentation
1.7.0
|
Go to the source code of this file.
Data Structures | |
struct | pos_el |
struct | fit_el |
struct | switch_img_txt_handle_s |
Macros | |
#define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
#define | MAX(a, b) ((a) > (b) ? (a) : (b)) |
#define | CLAMP(val) MAX(0, MIN(val, 255)) |
#define | MAX_GRADIENT 8 |
#define | SWITCH_IMG_MAX_WIDTH 1920 * 2 |
#define | SWITCH_IMG_MAX_HEIGHT 1080 * 2 |
Functions | |
static void | switch_img_get_rgb_pixel (switch_image_t *img, switch_rgb_color_t *rgb, int x, int y) |
static void | switch_img_draw_pixel (switch_image_t *img, int x, int y, switch_rgb_color_t *color) |
Convert RGB color to YUV. More... | |
switch_img_position_t | parse_img_position (const char *name) |
switch_img_fit_t | parse_img_fit (const char *name) |
switch_bool_t | switch_core_has_video (void) |
switch_image_t * | switch_img_alloc (switch_image_t *img, switch_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align) |
Open a descriptor, allocating storage for the underlying image. More... | |
switch_image_t * | switch_img_wrap (switch_image_t *img, switch_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align, unsigned char *img_data) |
Open a descriptor, using existing storage for the underlying image. More... | |
int | switch_img_set_rect (switch_image_t *img, unsigned int x, unsigned int y, unsigned int w, unsigned int h) |
Set the rectangle identifying the displayed portion of the image. More... | |
void | switch_img_rotate (switch_image_t **img, switch_image_rotation_mode_t mode) |
Flip the image vertically (top for bottom) More... | |
void | switch_img_free (switch_image_t **img) |
Close an image descriptor. More... | |
void | switch_img_patch (switch_image_t *IMG, switch_image_t *img, int x, int y) |
patch a small img to a big IMG at position x,y More... | |
void | switch_img_patch_rect (switch_image_t *IMG, int X, int Y, switch_image_t *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h) |
patch part of a small img (x,y,w,h) to a big IMG at position X,Y More... | |
void | switch_img_copy (switch_image_t *img, switch_image_t **new_img) |
Copy image to a new image. More... | |
void | switch_img_rotate_copy (switch_image_t *img, switch_image_t **new_img, switch_image_rotation_mode_t mode) |
switch_image_t * | switch_img_copy_rect (switch_image_t *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h) |
Copy part of an image to a new image. More... | |
void | switch_img_fill (switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color) |
Fill image with color. More... | |
void | switch_img_overlay (switch_image_t *IMG, switch_image_t *img, int x, int y, uint8_t percent) |
put a small img over a big IMG at position x,y, with alpha transparency More... | |
static void | scv_tag (void *buffer, int w, int x, int y, uint8_t n) |
void | switch_img_add_text (void *buffer, int w, int x, int y, char *s) |
void | switch_color_set_rgb (switch_rgb_color_t *color, const char *str) |
Set RGB color with a string. More... | |
void | switch_color_set_yuv (switch_yuv_color_t *color, const char *str) |
Set YUV color with a string. More... | |
static void | init_gradient_table (switch_img_txt_handle_t *handle) |
switch_status_t | switch_img_txt_handle_create (switch_img_txt_handle_t **handleP, const char *font_family, const char *font_color, const char *bgcolor, uint16_t font_size, double angle, switch_memory_pool_t *pool) |
Created a text handle. More... | |
void | switch_img_txt_handle_destroy (switch_img_txt_handle_t **handleP) |
Free a text handle. More... | |
uint32_t | switch_img_txt_handle_render (switch_img_txt_handle_t *handle, switch_image_t *img, int x, int y, const char *text, const char *font_family, const char *font_color, const char *bgcolor, uint16_t font_size, double angle) |
Render text to an img. More... | |
switch_image_t * | switch_img_write_text_img (int w, int h, switch_bool_t full, const char *text) |
void | switch_img_patch_hole (switch_image_t *IMG, switch_image_t *img, int x, int y, switch_image_rect_t *rect) |
switch_status_t | switch_img_patch_png (switch_image_t *img, int x, int y, const char *file_name) |
switch_image_t * | switch_img_read_png (const char *file_name, switch_img_fmt_t img_fmt) |
switch_status_t | switch_img_write_png (switch_image_t *img, char *file_name) |
switch_status_t | switch_img_letterbox (switch_image_t *img, switch_image_t **imgP, int width, int height, const char *color) |
switch_status_t | switch_img_fit (switch_image_t **srcP, int width, int height, switch_img_fit_t fit) |
switch_status_t | switch_img_to_raw (switch_image_t *src, void *dest, switch_size_t size, switch_img_fmt_t fmt) |
convert img to raw format More... | |
switch_status_t | switch_img_from_raw (switch_image_t *dest, void *src, switch_img_fmt_t fmt, int width, int height) |
convert raw memory to switch_img_t More... | |
switch_status_t | switch_img_scale (switch_image_t *src, switch_image_t **destP, int width, int height) |
void | switch_img_find_position (switch_img_position_t pos, int sw, int sh, int iw, int ih, int *xP, int *yP) |
switch_image_t * | switch_img_read_file (const char *file_name) |
switch_status_t | switch_I420_copy (const uint8_t *src_y, int src_stride_y, const uint8_t *src_u, int src_stride_u, const uint8_t *src_v, int src_stride_v, uint8_t *dst_y, int dst_stride_y, uint8_t *dst_u, int dst_stride_u, uint8_t *dst_v, int dst_stride_v, int width, int height) |
I420 to I420 Copy. More... | |
switch_status_t | switch_I420_copy2 (uint8_t *src_planes[], int src_stride[], uint8_t *dst_planes[], int dst_stride[], int width, int height) |
Variables | |
static struct pos_el | POS_TABLE [] |
static struct fit_el | IMG_FIT_TABLE [] |
static uint8_t | scv_art [14][16] |
Definition at line 770 of file switch_core_video.c.
#define MAX | ( | a, | |
b | |||
) | ((a) > (b) ? (a) : (b)) |
Definition at line 286 of file switch_core_video.c.
#define MAX_GRADIENT 8 |
Definition at line 808 of file switch_core_video.c.
Referenced by init_gradient_table().
#define MIN | ( | a, | |
b | |||
) | ((a) < (b) ? (a) : (b)) |
Definition at line 282 of file switch_core_video.c.
Referenced by switch_img_copy_rect(), switch_img_fill(), switch_img_overlay(), switch_img_patch(), switch_img_patch_hole(), and switch_img_patch_rect().
#define SWITCH_IMG_MAX_HEIGHT 1080 * 2 |
Definition at line 1273 of file switch_core_video.c.
#define SWITCH_IMG_MAX_WIDTH 1920 * 2 |
Definition at line 1272 of file switch_core_video.c.
|
static |
Definition at line 827 of file switch_core_video.c.
References switch_rgb_color_s::b, switch_img_txt_handle_s::bgcolor, switch_img_txt_handle_s::color, switch_rgb_color_s::g, switch_img_txt_handle_s::gradient_table, MAX_GRADIENT, and switch_rgb_color_s::r.
Referenced by switch_img_txt_handle_create(), and switch_img_txt_handle_render().
switch_img_fit_t parse_img_fit | ( | const char * | name | ) |
Definition at line 139 of file switch_core_video.c.
References fit_el::fit, fit_el::name, switch_assert, and SWITCH_FIT_SIZE.
switch_img_position_t parse_img_position | ( | const char * | name | ) |
Definition at line 107 of file switch_core_video.c.
References pos_el::name, pos_el::pos, POS_NONE, and switch_assert.
|
static |
void switch_color_set_rgb | ( | switch_rgb_color_t * | color, |
const char * | color_str | ||
) |
Set RGB color with a string.
Color string should be in #RRGGBB format
[out] | color | RGB color pointer |
[in] | color_str | Color string in #RRGGBB format |
Definition at line 734 of file switch_core_video.c.
References zstr.
Referenced by switch_color_set_yuv(), switch_core_media_bug_patch_spy_frame(), switch_img_letterbox(), switch_img_txt_handle_create(), switch_img_txt_handle_render(), switch_img_write_text_img(), and video_helper_thread().
void switch_color_set_yuv | ( | switch_yuv_color_t * | color, |
const char * | color_str | ||
) |
Set YUV color with a string.
Color string should be in #RRGGBB format
[out] | color | YUV color pointer |
[in] | color_str | Color string in #RRGGBB format |
Definition at line 792 of file switch_core_video.c.
References switch_color_set_rgb().
switch_bool_t switch_core_has_video | ( | void | ) |
Definition at line 156 of file switch_core_video.c.
References SWITCH_FALSE, and SWITCH_TRUE.
switch_status_t switch_I420_copy | ( | const uint8_t * | src_y, |
int | src_stride_y, | ||
const uint8_t * | src_u, | ||
int | src_stride_u, | ||
const uint8_t * | src_v, | ||
int | src_stride_v, | ||
uint8_t * | dst_y, | ||
int | dst_stride_y, | ||
uint8_t * | dst_u, | ||
int | dst_stride_u, | ||
uint8_t * | dst_v, | ||
int | dst_stride_v, | ||
int | width, | ||
int | height | ||
) |
I420 to I420 Copy.
Definition at line 2252 of file switch_core_video.c.
References SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_I420_copy2 | ( | uint8_t * | src_planes[], |
int | src_stride[], | ||
uint8_t * | dst_planes[], | ||
int | dst_stride[], | ||
int | width, | ||
int | height | ||
) |
Definition at line 2270 of file switch_core_video.c.
References SWITCH_PLANE_U, SWITCH_PLANE_V, SWITCH_PLANE_Y, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
void switch_img_add_text | ( | void * | buffer, |
int | w, | ||
int | x, | ||
int | y, | ||
char * | s | ||
) |
Definition at line 712 of file switch_core_video.c.
References scv_tag().
switch_image_t* switch_img_alloc | ( | switch_image_t * | img, |
switch_img_fmt_t | fmt, | ||
unsigned int | d_w, | ||
unsigned int | d_h, | ||
unsigned int | align | ||
) |
Open a descriptor, allocating storage for the underlying image.
Returns a descriptor for storing an image of the given format. The storage for the descriptor is allocated on the heap.
[in] | img | Pointer to storage for descriptor. If this parameter is NULL, the storage for the descriptor will be allocated on the heap. |
[in] | fmt | Format for the image |
[in] | d_w | Width of the image |
[in] | d_h | Height of the image |
[in] | align | Alignment, in bytes, of the image buffer and each row in the image(stride). |
Definition at line 169 of file switch_core_video.c.
References SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_GD, switch_img_free(), and vpx_img_alloc().
Referenced by switch_img_copy(), switch_img_from_raw(), switch_img_letterbox(), switch_img_rotate(), switch_img_rotate_copy(), switch_img_scale(), switch_img_write_text_img(), video_bug_thread(), and video_helper_thread().
void switch_img_copy | ( | switch_image_t * | img, |
switch_image_t ** | new_img | ||
) |
Copy image to a new image.
if new_img is NULL, a new image is allocated if new_img is not NULL but not the same size as img, new_img is destroyed and a new new_img is allocated else, copy the img data to the new_img
[in] | img | Image descriptor |
[out] | new_img | New Image descriptor, NULL if out of memory |
Definition at line 420 of file switch_core_video.c.
References switch_assert, switch_img_alloc(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, switch_img_free(), SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, and SWITCH_PLANE_Y.
Referenced by find_free_frame(), switch_core_media_bug_patch_spy_frame(), switch_core_media_bug_push_spy_frame(), switch_core_session_read_video_frame(), switch_core_session_write_video_frame(), switch_frame_dup(), switch_img_copy_rect(), switch_img_letterbox(), and video_write_overlay_callback().
switch_image_t* switch_img_copy_rect | ( | switch_image_t * | img, |
uint32_t | x, | ||
uint32_t | y, | ||
uint32_t | w, | ||
uint32_t | h | ||
) |
Copy part of an image to a new image.
[in] | img | Image descriptor |
[in] | x | Leftmost pos to be read from |
[in] | y | Topmost pos to be read from |
[in] | w | Max width to be read from |
[in] | h | Max height to be read from |
Definition at line 496 of file switch_core_video.c.
References MIN, switch_assert, switch_img_copy(), SWITCH_IMG_FMT_PLANAR, switch_img_free(), switch_img_set_rect(), SWITCH_PLANE_PACKED, SWITCH_PLANE_Y, and vpx_img_wrap().
Referenced by switch_core_media_bug_patch_spy_frame().
|
inlinestatic |
Convert RGB color to YUV.
[in] | rgb | RGB color pointer |
[out] | yuv | YUV color pointer |
Convert YUV color to RGB
[in] | yuv | YUV color pointer |
[out] | rgb | RGB color pointer |
Draw a pixel on an image
[in] | img | Image descriptor |
[in] | x | leftmost pos |
[in] | y | topmost pos |
[in] | color | RGB color |
Definition at line 530 of file switch_core_video.c.
References switch_rgb_color_s::a, switch_rgb_color_s::b, vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, switch_rgb_color_s::g, vpx_image::planes, switch_rgb_color_s::r, vpx_image::stride, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, SWITCH_PLANE_Y, switch_yuv_color_s::u, switch_yuv_color_s::v, and switch_yuv_color_s::y.
Referenced by switch_img_overlay(), and switch_img_patch().
void switch_img_fill | ( | switch_image_t * | img, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
switch_rgb_color_t * | color | ||
) |
Fill image with color.
[in] | img | Image descriptor |
[in] | x | Leftmost pos to be read from |
[in] | y | Topmost pos to be read from |
[in] | w | Max width to be read from |
[in] | h | Max height to be read from |
[in] | color | RGB color |
Definition at line 556 of file switch_core_video.c.
References memset(), MIN, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, SWITCH_PLANE_Y, switch_yuv_color_s::u, switch_yuv_color_s::v, and switch_yuv_color_s::y.
Referenced by switch_core_media_bug_patch_spy_frame(), switch_img_letterbox(), switch_img_write_text_img(), and video_helper_thread().
void switch_img_find_position | ( | switch_img_position_t | pos, |
int | sw, | ||
int | sh, | ||
int | iw, | ||
int | ih, | ||
int * | xP, | ||
int * | yP | ||
) |
Definition at line 2160 of file switch_core_video.c.
References POS_CENTER_BOT, POS_CENTER_MID, POS_CENTER_TOP, POS_LEFT_BOT, POS_LEFT_MID, POS_LEFT_TOP, POS_NONE, POS_RIGHT_BOT, POS_RIGHT_MID, and POS_RIGHT_TOP.
Referenced by switch_core_media_bug_patch_spy_frame(), and video_write_overlay_callback().
switch_status_t switch_img_fit | ( | switch_image_t ** | srcP, |
int | width, | ||
int | height, | ||
switch_img_fit_t | fit | ||
) |
Definition at line 1927 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, switch_assert, SWITCH_FIT_SCALE, SWITCH_FIT_SIZE_AND_SCALE, switch_img_free(), switch_img_scale(), SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_media_bug_patch_spy_frame(), and video_write_overlay_callback().
void switch_img_free | ( | switch_image_t ** | img | ) |
Close an image descriptor.
Frees all allocated storage associated with an image descriptor.
[in] | img | pointer to pointer of Image descriptor |
Definition at line 264 of file switch_core_video.c.
References SWITCH_IMG_FMT_GD, switch_safe_free, and vpx_img_free().
Referenced by switch_core_media_bug_close(), switch_core_media_bug_patch_spy_frame(), switch_core_session_write_video_frame(), switch_frame_buffer_free(), switch_frame_free(), switch_img_alloc(), switch_img_copy(), switch_img_copy_rect(), switch_img_fit(), switch_img_letterbox(), switch_img_patch_rect(), switch_img_rotate(), switch_img_rotate_copy(), switch_ivr_video_write_overlay_session(), video_bug_thread(), video_helper_thread(), video_write_overlay_callback(), and video_write_thread().
switch_status_t switch_img_from_raw | ( | switch_image_t * | dest, |
void * | src, | ||
switch_img_fmt_t | fmt, | ||
int | width, | ||
int | height | ||
) |
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
[in] | dest | The image descriptor |
[in] | src | The raw data memory address |
[in] | fmt | The raw data format |
[in] | width | The raw data width |
[in] | height | The raw data height |
Definition at line 2063 of file switch_core_video.c.
References SWITCH_CHANNEL_LOG, switch_img_alloc(), SWITCH_IMG_FMT_I420, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
|
inlinestatic |
Definition at line 614 of file switch_core_video.c.
References switch_rgb_color_s::a, switch_rgb_color_s::b, vpx_image::d_h, vpx_image::d_w, vpx_image::fmt, switch_rgb_color_s::g, vpx_image::planes, switch_rgb_color_s::r, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, and SWITCH_PLANE_PACKED.
Referenced by switch_img_overlay(), and switch_img_patch().
switch_status_t switch_img_letterbox | ( | switch_image_t * | img, |
switch_image_t ** | imgP, | ||
int | width, | ||
int | height, | ||
const char * | color | ||
) |
Definition at line 1882 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, switch_assert, switch_color_set_rgb(), switch_img_alloc(), switch_img_copy(), switch_img_fill(), SWITCH_IMG_FMT_I420, switch_img_free(), switch_img_patch(), switch_img_scale(), and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_session_write_video_frame().
void switch_img_overlay | ( | switch_image_t * | IMG, |
switch_image_t * | img, | ||
int | x, | ||
int | y, | ||
uint8_t | percent | ||
) |
put a small img over a big IMG at position x,y, with alpha transparency
Both IMG and img must be non-NULL
[in] | IMG | The BIG Image descriptor |
[in] | img | The small Image descriptor |
[in] | x | Leftmost pos |
[in] | y | Topmost pos |
[in] | percent | Alaha value from 0(completely transparent) to 100(opaque) |
Definition at line 634 of file switch_core_video.c.
References switch_rgb_color_s::b, switch_rgb_color_s::g, MIN, switch_rgb_color_s::r, switch_assert, switch_img_draw_pixel(), SWITCH_IMG_FMT_I420, and switch_img_get_rgb_pixel().
Referenced by video_write_overlay_callback().
void switch_img_patch | ( | switch_image_t * | IMG, |
switch_image_t * | img, | ||
int | x, | ||
int | y | ||
) |
patch a small img to a big IMG at position x,y
Both IMG and img must be non-NULL
[in] | IMG | The BIG Image descriptor |
[in] | img | The small Image descriptor |
[in] | x | Leftmost pos to patch to |
[in] | y | Topmost pos to patch to |
Definition at line 289 of file switch_core_video.c.
References switch_rgb_color_s::a, switch_rgb_color_s::b, switch_rgb_color_s::g, MIN, switch_rgb_color_s::r, switch_assert, SWITCH_CHANNEL_LOG, switch_img_draw_pixel(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_GD, SWITCH_IMG_FMT_I420, switch_img_get_rgb_pixel(), SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PLANE_PACKED, SWITCH_PLANE_U, SWITCH_PLANE_V, and SWITCH_PLANE_Y.
Referenced by switch_core_media_bug_patch_spy_frame(), switch_img_letterbox(), switch_img_patch_rect(), and video_bug_thread().
void switch_img_patch_hole | ( | switch_image_t * | IMG, |
switch_image_t * | img, | ||
int | x, | ||
int | y, | ||
switch_image_rect_t * | rect | ||
) |
Definition at line 1232 of file switch_core_video.c.
References MIN, switch_assert, SWITCH_IMG_FMT_I420, SWITCH_PLANE_U, SWITCH_PLANE_V, and SWITCH_PLANE_Y.
switch_status_t switch_img_patch_png | ( | switch_image_t * | img, |
int | x, | ||
int | y, | ||
const char * | file_name | ||
) |
Definition at line 1862 of file switch_core_video.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), and SWITCH_STATUS_FALSE.
void switch_img_patch_rect | ( | switch_image_t * | IMG, |
int | X, | ||
int | Y, | ||
switch_image_t * | img, | ||
uint32_t | x, | ||
uint32_t | y, | ||
uint32_t | w, | ||
uint32_t | h | ||
) |
patch part of a small img (x,y,w,h) to a big IMG at position X,Y
Both IMG and img must be non-NULL
[in] | IMG | The BIG Image descriptor |
[in] | X | Leftmost pos to patch to IMG |
[in] | Y | Topmost pos to patch to IMG |
[in] | img | The small Image descriptor |
[in] | x | Leftmost pos to be read from img |
[in] | y | Topmost pos to be read from |
[in] | w | Max width to be read from img |
[in] | h | Max height to be read from img |
Definition at line 392 of file switch_core_video.c.
References MIN, vpx_image::planes, SWITCH_IMG_FMT_PLANAR, switch_img_free(), switch_img_patch(), switch_img_set_rect(), SWITCH_PLANE_PACKED, SWITCH_PLANE_Y, and vpx_img_wrap().
switch_image_t* switch_img_read_file | ( | const char * | file_name | ) |
Definition at line 2246 of file switch_core_video.c.
switch_image_t* switch_img_read_png | ( | const char * | file_name, |
switch_img_fmt_t | img_fmt | ||
) |
Definition at line 1868 of file switch_core_video.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, and switch_log_printf().
Referenced by switch_ivr_video_write_overlay_session(), and video_helper_thread().
void switch_img_rotate | ( | switch_image_t ** | img, |
switch_image_rotation_mode_t | mode | ||
) |
Flip the image vertically (top for bottom)
Adjusts the image descriptor's pointers and strides to make the image be referenced upside-down.
[in] | img | Image descriptor |
Definition at line 231 of file switch_core_video.c.
References vpx_image::planes, SRM_270, SRM_90, vpx_image::stride, switch_assert, switch_img_alloc(), SWITCH_IMG_FMT_I420, switch_img_free(), SWITCH_PLANE_U, SWITCH_PLANE_V, and SWITCH_PLANE_Y.
void switch_img_rotate_copy | ( | switch_image_t * | img, |
switch_image_t ** | new_img, | ||
switch_image_rotation_mode_t | mode | ||
) |
Definition at line 459 of file switch_core_video.c.
References SRM_270, SRM_90, switch_assert, switch_img_alloc(), SWITCH_IMG_FMT_I420, switch_img_free(), SWITCH_PLANE_U, SWITCH_PLANE_V, and SWITCH_PLANE_Y.
switch_status_t switch_img_scale | ( | switch_image_t * | src, |
switch_image_t ** | destP, | ||
int | width, | ||
int | height | ||
) |
Definition at line 2113 of file switch_core_video.c.
References vpx_image::fmt, vpx_image::planes, vpx_image::stride, switch_assert, SWITCH_CHANNEL_LOG, switch_img_alloc(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PLANE_PACKED, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_media_bug_patch_spy_frame(), switch_img_fit(), switch_img_letterbox(), and video_bug_thread().
int switch_img_set_rect | ( | switch_image_t * | img, |
unsigned int | x, | ||
unsigned int | y, | ||
unsigned int | w, | ||
unsigned int | h | ||
) |
Set the rectangle identifying the displayed portion of the image.
Updates the displayed rectangle (aka viewport) on the image surface to match the specified coordinates and size.
[in] | img | Image descriptor |
[in] | x | leftmost column |
[in] | y | topmost row |
[in] | w | width |
[in] | h | height |
Definition at line 218 of file switch_core_video.c.
References vpx_img_set_rect().
Referenced by switch_img_copy_rect(), and switch_img_patch_rect().
switch_status_t switch_img_to_raw | ( | switch_image_t * | src, |
void * | dest, | ||
switch_size_t | size, | ||
switch_img_fmt_t | fmt | ||
) |
convert img to raw format
dest should be pre-allocated and big enough for the target fmt
[in] | src | The image descriptor |
[in] | dest | The target memory address |
[in] | size | The size of target memory address used for bounds check |
[in] | fmt | The target format |
Definition at line 2034 of file switch_core_video.c.
References switch_assert, SWITCH_CHANNEL_LOG, SWITCH_IMG_FMT_I420, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_img_txt_handle_create | ( | switch_img_txt_handle_t ** | handleP, |
const char * | font_family, | ||
const char * | font_color, | ||
const char * | bgcolor, | ||
uint16_t | font_size, | ||
double | angle, | ||
switch_memory_pool_t * | pool | ||
) |
Created a text handle.
[out] | handleP | Pointer to the text handle pointer |
[in] | font_family | Font family |
[in] | font_color | Font color in #RRGGBB format |
[in] | bgcolor | Background color in #RRGGBB format |
[in] | font_size | Font size in point |
[in] | angle | Angle to rotate |
[in] | pool | APR memory pool |
Definition at line 843 of file switch_core_video.c.
References switch_img_txt_handle_s::angle, switch_img_txt_handle_s::bgcolor, switch_img_txt_handle_s::color, switch_img_txt_handle_s::font_family, switch_img_txt_handle_s::font_size, switch_directories::fonts_dir, switch_img_txt_handle_s::free_pool, init_gradient_table(), pool, switch_img_txt_handle_s::pool, SWITCH_CHANNEL_LOG, switch_color_set_rgb(), switch_core_alloc, switch_core_destroy_memory_pool, switch_core_new_memory_pool, switch_core_sprintf(), switch_core_strdup, switch_file_exists(), SWITCH_GLOBAL_dirs, switch_is_file_path(), SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_PATH_SEPARATOR, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and zstr.
Referenced by switch_img_write_text_img().
void switch_img_txt_handle_destroy | ( | switch_img_txt_handle_t ** | handleP | ) |
Free a text handle.
[in] | handleP | Pointer to the text handle pointer |
Definition at line 900 of file switch_core_video.c.
References switch_img_txt_handle_s::free_pool, pool, switch_img_txt_handle_s::pool, switch_assert, and switch_core_destroy_memory_pool.
Referenced by switch_img_write_text_img().
uint32_t switch_img_txt_handle_render | ( | switch_img_txt_handle_t * | handle, |
switch_image_t * | img, | ||
int | x, | ||
int | y, | ||
const char * | text, | ||
const char * | font_family, | ||
const char * | font_color, | ||
const char * | bgcolor, | ||
uint16_t | font_size, | ||
double | angle | ||
) |
Render text to an img.
[in] | handle | Pointer to the text handle pointer |
[in] | img | The image to be render text on |
[in] | x | Leftmost position |
[in] | y | Topmost position |
[in] | text | Text to render |
[in] | font_family | Font to use, NULL to use the handle font |
[in] | font_color | Font color, NULL to use the handle color |
[in] | bgcolor | Background color, NULL for transparency |
[in] | font_size | Font size in point |
[in] | angle | Angle to rotate |
Definition at line 998 of file switch_core_video.c.
References init_gradient_table(), switch_assert, SWITCH_CHANNEL_LOG, switch_color_set_rgb(), switch_core_strdup, SWITCH_FALSE, SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_TRUE, switch_u8_get_char(), and zstr.
Referenced by switch_img_write_text_img().
switch_image_t* switch_img_wrap | ( | switch_image_t * | img, |
switch_img_fmt_t | fmt, | ||
unsigned int | d_w, | ||
unsigned int | d_h, | ||
unsigned int | align, | ||
unsigned char * | img_data | ||
) |
Open a descriptor, using existing storage for the underlying image.
Returns a descriptor for storing an image of the given format. The storage for descriptor has been allocated elsewhere, and a descriptor is desired to "wrap" that storage.
[in] | img | Pointer to storage for descriptor. If this parameter is NULL, the storage for the descriptor will be allocated on the heap. |
[in] | fmt | Format for the image |
[in] | d_w | Width of the image |
[in] | d_h | Height of the image |
[in] | align | Alignment, in bytes, of each row in the image. |
[in] | img_data | Storage to use for the image |
Definition at line 204 of file switch_core_video.c.
References vpx_img_wrap().
switch_status_t switch_img_write_png | ( | switch_image_t * | img, |
char * | file_name | ||
) |
Definition at line 1874 of file switch_core_video.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), and SWITCH_STATUS_FALSE.
switch_image_t* switch_img_write_text_img | ( | int | w, |
int | h, | ||
switch_bool_t | full, | ||
const char * | text | ||
) |
Definition at line 1125 of file switch_core_video.c.
References vpx_image::d_h, vpx_image::d_w, end_of, memset(), vpx_image::planes, switch_assert, switch_color_set_rgb(), switch_img_alloc(), switch_img_fill(), SWITCH_IMG_FMT_ARGB, SWITCH_IMG_FMT_I420, switch_img_txt_handle_create(), switch_img_txt_handle_destroy(), switch_img_txt_handle_render(), SWITCH_PLANE_PACKED, switch_safe_free, switch_split, and zstr.
|
static |
Definition at line 131 of file switch_core_video.c.
|
static |
Definition at line 92 of file switch_core_video.c.
|
static |
Definition at line 681 of file switch_core_video.c.