2899
- 收藏
- 点赞
- 分享
- 举报
同一通道实现多个osd显示
在3516ev200上实现了编码通道的一路osd,用的是SDL,但是现在有个需求,要实现同一个编码通道的多个osd,而且每个osd的位置还必须实时调整,颜色实时配置,这个用SDL怎么弄????????????????
我一路osd是用HI_MPI_RGN_SetBitMap实现的:
if (OSDHandle != UNDEF_OSD_HANDLE && g_devCap.osd_attr.enable)
{
if (font EQU NULL)
{
zoom = round((float)g_devCap.vframeHead.videoWidth/cif_size.u32Width);
font = TTF_OpenFont(OSD_TTF_FILE, zoom*8);
if (font EQU NULL)
{
LOGE("Couldn't load %d pt font from %s: %s\n",
zoom*8, "ptsize", SDL_GetError());
continue;
}
}
temp = SDL_OSDtoBMP(timebuf, &stBitmap, font);
if (temp != NULL)
{
s32Ret = HI_MPI_RGN_SetBitMap(OSDHandle, &stBitmap);
SDL_FreeSurface(temp);
if (HI_SUCCESS != s32Ret)
{
LOGE("OSDHandle:%#X HI_MPI_RGN_SetBitMap error:%#x\n", OSDHandle, s32Ret);
}
}
else
{
FREE_FONT(font);
}
}
}
SDL_OSDtoBMP函数是这样的
SDL_Surface * SDL_OSDtoBMP(char *info, BITMAP_S *stBitmap, TTF_Font *font)
{
SDL_Surface *text;
SDL_Surface *temp = NULL;
SDL_PixelFormat fmt;
//SDL_Color forecol = {r:0xff, g:0xff, b:0xff, unused:0xff};
SDL_Color forecol = {r:0x8E, g:0x90, b:0xff, unused:0xff};
SDL_Rect rect;
int h,w;
char *p;
text = TTF_RenderUTF8_Solid(font, info, forecol);
memset(&fmt, 0x00, sizeof(fmt));
fmt.BitsPerPixel = 16;
fmt.BytesPerPixel = 2;
fmt.colorkey = 0xffffffff;
fmt.alpha = 0xff;
temp = SDL_ConvertSurface(text, &fmt, 0);
//SDL_SaveBMP(temp, "sys_time.bmp");
stBitmap->u32Width = temp->pitch / 2; //do not use temp->w
stBitmap->u32Height = temp->h;
stBitmap->pData = temp->pixels;
stBitmap->enPixelFormat = PIXEL_FORMAT_ARGB_1555;
SDL_FreeSurface(text);
return temp;
}
我一路osd是用HI_MPI_RGN_SetBitMap实现的:
if (OSDHandle != UNDEF_OSD_HANDLE && g_devCap.osd_attr.enable)
{
if (font EQU NULL)
{
zoom = round((float)g_devCap.vframeHead.videoWidth/cif_size.u32Width);
font = TTF_OpenFont(OSD_TTF_FILE, zoom*8);
if (font EQU NULL)
{
LOGE("Couldn't load %d pt font from %s: %s\n",
zoom*8, "ptsize", SDL_GetError());
continue;
}
}
temp = SDL_OSDtoBMP(timebuf, &stBitmap, font);
if (temp != NULL)
{
s32Ret = HI_MPI_RGN_SetBitMap(OSDHandle, &stBitmap);
SDL_FreeSurface(temp);
if (HI_SUCCESS != s32Ret)
{
LOGE("OSDHandle:%#X HI_MPI_RGN_SetBitMap error:%#x\n", OSDHandle, s32Ret);
}
}
else
{
FREE_FONT(font);
}
}
}
SDL_OSDtoBMP函数是这样的
SDL_Surface * SDL_OSDtoBMP(char *info, BITMAP_S *stBitmap, TTF_Font *font)
{
SDL_Surface *text;
SDL_Surface *temp = NULL;
SDL_PixelFormat fmt;
//SDL_Color forecol = {r:0xff, g:0xff, b:0xff, unused:0xff};
SDL_Color forecol = {r:0x8E, g:0x90, b:0xff, unused:0xff};
SDL_Rect rect;
int h,w;
char *p;
text = TTF_RenderUTF8_Solid(font, info, forecol);
memset(&fmt, 0x00, sizeof(fmt));
fmt.BitsPerPixel = 16;
fmt.BytesPerPixel = 2;
fmt.colorkey = 0xffffffff;
fmt.alpha = 0xff;
temp = SDL_ConvertSurface(text, &fmt, 0);
//SDL_SaveBMP(temp, "sys_time.bmp");
stBitmap->u32Width = temp->pitch / 2; //do not use temp->w
stBitmap->u32Height = temp->h;
stBitmap->pData = temp->pixels;
stBitmap->enPixelFormat = PIXEL_FORMAT_ARGB_1555;
SDL_FreeSurface(text);
return temp;
}
我来回答
回答0个
时间排序
认可量排序
暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片
相关问答
-
2013-03-17 17:46:50
-
2018-08-24 15:06:06
-
2021-03-19 17:07:04
-
2015-09-23 16:22:13
-
2016-05-06 13:45:13
-
2017-06-26 10:53:06
-
2020-10-28 17:33:23
-
2022-07-10 15:14:57
-
2018-09-09 10:44:49
-
2024-08-21 18:23:03
-
2019-01-03 15:23:22
-
2019-04-17 16:18:40
-
2017-06-25 02:02:49
-
2023-06-21 15:27:54
-
2018-08-01 16:14:09
-
42020-09-09 08:15:40
-
102015-06-27 10:19:58
-
2023-07-12 14:14:07
-
2023-05-31 20:48:33
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
10svp nnn目标检测不全
-
10hi35169dv500平台使用http协议推拉流UVC摄像头,帧率问题
-
10hi3516cv610关于YOLO优化和调优问题
-
10hi_mpi_vpss_get_chn_frame err:0xa0078016报错
-
5gk7205v200(hisi3516ev200)如何接入b656?
-
30pipe管道创建失败
-
10atc转换模型失败
-
20拍摄静止画面显示正常,拍摄运动的画面出现马赛克显示
-
100hi3516cv610 通过易百纳官方SDK中编译出的uboot env kernel,移植到自己的工程中,MPP初始化时出现内核拷贝数据到用户端时出现错误导致内核进入pain模式进而时内核重启
-
5hisi3519 gs2972 bt1120 转sdi 无法正常显示问题
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认

微信扫码分享
QQ好友