/// <summary> /// 附加信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddScreenFontTSMenuItem_Click(object sender, EventArgs e) { int ret = -1; var rect = new Rect { X = 10, Y = 10, Width = panel1.Width, Height = panel1.Height }; var panelSize = this.panel1.ClientSize; EASY_PALYER_OSD fontInfo = new EASY_PALYER_OSD { alpha = 255, size = 35, color = (uint)ToArgb(Color.Red), shadowcolor = (uint)ToArgb(Color.Black), stOSD = "这是EasyPlayer-RTMP-Win播放器 \r\n的字幕叠加接口的效果!!!\r\n以\"\\r\\n\"为换行结束符号\r\n注意:每行的长度不能超过128个字节\r\n总的OSD长度不能超过1024个字节", rect = new tagRECT { left = (int)rect.X, top = (int)rect.Y, right = (int)rect.Width, bottom = (int)rect.Height } }; var checkState = (sender as ToolStripMenuItem).CheckState; if (checkState == CheckState.Unchecked) { ret = PlayerSdk.EasyPlayer_ShowOSD(channelID, fontInfo); (sender as ToolStripMenuItem).CheckState = CheckState.Checked; } if (checkState == CheckState.Checked) { ret = PlayerSdk.EasyPlayer_ShowOSD(channelID, fontInfo, false); (sender as ToolStripMenuItem).CheckState = CheckState.Unchecked; } }
public static int EasyPlayer_ShowOSD(int channelId, int show, Rectangle lpSrcRect, Color color, string stOSD, int size) { tagRECT rect = new tagRECT { left = (int)lpSrcRect.X, bottom = (int)lpSrcRect.Height, right = (int)lpSrcRect.Width, top = (int)lpSrcRect.Y }; EASY_PALYER_OSD osd = new EASY_PALYER_OSD { }; osd.stOSD = stOSD; osd.rect = rect; osd.size = size; osd.alpha = color.A; osd.color = (uint)(color.R << 16 | color.G << 8 | color.B); osd.shadowcolor = 0; return(EasyPlayer_ShowOSD(channelId, show, osd)); }
/// <summary> /// 附件文字显示. /// </summary> /// <param name="channelId">通道ID,EasyPlayer_OpenStream函数返回值.</param> /// <param name="isShow">是否显示,默认不显示.</param> /// <param name="lpSrcRect">设置渲染区域的矩形结构体.</param> /// <returns>System.Int32.</returns> public static int EasyPlayer_ShowOSD(int channelId, EASY_PALYER_OSD osdInfo, bool isShow = true) { int ret = EasyPlayer_ShowOSD(channelId, isShow ? 1 : 0, osdInfo); return(ret); }
private static extern int EasyPlayer_ShowOSD(int channelId, int show, EASY_PALYER_OSD osdInfo);
public static extern int EasyPlayer_ShowOSD(int channelId, int show, EASY_PALYER_OSD osd);