qn1535097110

qn1535097110

0个粉丝

21

问答

0

专栏

1

资料

qn1535097110  发布于  2020-07-14 10:36:01
采纳率 0%
21个问答
2396

同一通道实现多个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;
}


我来回答
回答0个
时间排序
认可量排序
易百纳技术社区暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
相关问答
无更多相似问答 去提问
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区