博客
关于我
TSINGSEE青犀视频云边端H265播放器EasyPlayer-RTSP在C#版本增加OSD功能说明
阅读量:135 次
发布时间:2019-02-27

本文共 2100 字,大约阅读时间需要 7 分钟。

EasyPlayer-RTSP播放器项目是TSINGSEE青犀视频研发团队开发的H265编码视频播放器,经过多年的技术积累与实践打造,EasyPlayer播放器系列无论是在对接设备型号种类,还是在对接编码的兼容性上,都具备较高的可用性。

最近有用户在使用EasyPlayer-RTSP播放器时,提出C++版本有OSD叠加的功能,但C#版本没有这个功能。下面描述下如何增加这个功能。

EasyPlayer-RTSP C#版本的功能是继承于libEasyPlayer-RTSP.dll这个库,在C#版本中我们通过EasyPlayer-RTSP.NetSDK类重新封装了这个库的内容,现在需要在EasyPlayer-RTSP.NetSDK类中把OSD功能也封装进去。

  • 增加接口函数定义如下:
  • [DllImport(@"Lib\libEasyPlayer-RTSP.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "?EasyPlayer_ShowOSD@@YAHHHUtagEASY_PALYER_OSD@@@Z")]public static extern int EasyPlayer_ShowOSD(int channelId, int show, tagEASY_PALYER_OSD osd);
    1. 增加相关结构体定义如下:
    2. [StructLayoutAttribute(LayoutKind.Sequential)]public struct RECT{    public System.Int32 left;    public System.Int32 top;    public System.Int32 right;    public System.Int32 bottom;}[StructLayoutAttribute(LayoutKind.Sequential)]public struct tagEASY_PALYER_OSD{    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]    public string stOSD;    public System.UInt32 alpha;    //0-255    public System.UInt32 color;    //RGB(0xf9,0xf9,0xf9)    public System.UInt32 shadowcolor;    //RGB(0x4d,0x4d,0x4d) 全为0背景透明    public RECT rect;    //OSD基于图像右上角显示区域    public int size;    //just D3D Support}[StructLayoutAttribute(LayoutKind.Sequential)]public struct tagRECT{    public int left;    public int top;    public int right;    public int bottom;}
      1. 接口调用示例如下:
      2. // OSD显示PlayerSdk.tagEASY_PALYER_OSD osd;osd.alpha = 255;osd.size = 35;Color color = Color.FromArgb(255, 0, 255);int colorInt = ParseRGB(color);osd.color = (uint)colorInt;osd.rect.left = 10;osd.rect.right = 5000;osd.rect.top = 100;osd.rect.bottom = 800;Color color_shadowcolor = Color.FromArgb(0, 0, 0);int colorInt_shadowcolor = ParseRGB(color_shadowcolor);osd.shadowcolor = (uint)colorInt_shadowcolor;string ss = "这是EasyPlayer-RTSP-Win播放器 \r\n的字幕叠加接口的效果!!!\r\n以\"\\r\\n\"为换行结束符号\r\n注意:每行的长度不能超过128个字节\r\n总的OSD长度不能超过1024个字节";osd.stOSD = ss;PlayerSdk.EasyPlayer_ShowOSD(channelID, 1, osd);

        其中channelID为EasyPlayer_OpenStream()返回值。

        EasyPlayer播放器系列项目依赖其灵活控制、低延时、高稳定的特点,已经成熟运用于多个项目场景当中,其中包括手机直播、桌面直播、远程教育课堂直播等,同时在城市安防或者社区安防监控的视频播放当中也具备很好的兼容性。

    转载地址:http://sujd.baihongyu.com/

    你可能感兴趣的文章
    PostgreSQL 新增数据返回自增ID
    查看>>
    postgresql 更新多列数据
    查看>>
    PostgreSQL 服务启动后停止
    查看>>
    PostgreSQL 辟谣存在任意代码执行漏洞:消息不实
    查看>>
    PostgreSQL+PostGIS实现两坐标点之间最短路径查询算法函数(地图工具篇.12)
    查看>>
    Qt开发——简易调色板QPalette
    查看>>
    PostgreSQL-解决连接时遇到的乱码问题
    查看>>
    PostgreSQL15.2最新版本安装_远程连接_Navicat操作_pgAdmin操作_Windows10上安装---PostgreSQL工作笔记001
    查看>>
    PostgreSQL9.1 双机部署配置(主备数据同步)
    查看>>
    Qt开发——简易网络浏览器(一)
    查看>>
    Qt开发——简易成绩登记系统
    查看>>
    Postgresql中PL/pgSQL代码块的语法与使用-声明与赋值、IF语句、CASE语句、循环语句
    查看>>
    Postgresql中PL/pgSQL的游标、自定义函数、存储过程的使用
    查看>>
    Postgresql中的表结构和数据同步/数据传输到Mysql
    查看>>
    Postgresql中自增主键序列的使用以及数据传输时提示:错误:关系“xxx_xx_xx_seq“不存在
    查看>>
    postgreSQL入门命令
    查看>>
    PostgreSQL删除数据库报"ERROR: There is 1 other session using the database."
    查看>>
    Qt开发——爱情公寓人事管理系统
    查看>>
    PostgreSQL和Oracle两种数据库有啥区别?如何选择?
    查看>>
    Postgresql在Windows中使用pg_dump实现数据库(指定表)的导出与导入
    查看>>