301
- 收藏
- 点赞
- 分享
- 举报
同一通道实现多个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
-
2015-09-23 16:22:13
-
2016-05-06 13:45:13
-
2017-06-26 10:53:06
-
2018-09-09 10:44:49
-
2019-01-03 15:23:22
-
2019-04-17 16:18:40
-
2017-06-25 02:02:49
-
2018-08-01 16:14:09
-
102015-06-27 10:19:58
-
2016-05-27 11:10:04
-
2019-09-20 16:32:04
-
2018-10-22 10:30:37
-
2016-09-22 18:08:08
-
2016-08-04 13:47:50
-
2008-07-06 19:07:02
-
2019-01-18 13:46:48
-
2018-10-14 09:07:10
无更多相似问答 去提问

点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认