private void 获取媒体信息ToolStripMenuItem_Click(object sender, EventArgs e) { int ret = -1; EASY_MEDIA_INFO_T _struct = new EASY_MEDIA_INFO_T(); ret = PlayerSDK.LibEasyPlayerPro_GetStreamInfo(palyerHandle, channelID, ref _struct); PlayerSDK.LibEasyPlayerPro_SetOverlayText(palyerHandle, channelID, string.Format("videoWidth:{0},videoHeight:{1}", _struct.videoWidth, _struct.videoHeight)); Thread.Sleep(1000); PlayerSDK.LibEasyPlayerPro_ClearOverlayText(palyerHandle, channelID); }
public static EASY_MEDIA_INFO_T Create_EASY_MEDIA_INFO_T() { EASY_MEDIA_INFO_T mediainfo = new EASY_MEDIA_INFO_T(); mediainfo.u8Vps = new System.Byte[256]; mediainfo.u8Sps = new System.Byte[256]; mediainfo.u8Pps = new System.Byte[128]; mediainfo.u8Sei = new System.Byte[128]; return(mediainfo); }
/// <summary> /// 创建RTMP推送的参数信息 /// </summary> /// <param name="mediaInfo"> 流媒体信息 </param> /// <param name="bufferKSize"> 缓冲区大小 </param> /// <returns></returns> public KeyValuePair <bool, string> InitMetadata(EASY_MEDIA_INFO_T mediaInfo, int bufferKSize = 1024) { if (!this.IsInit) { return(new KeyValuePair <bool, string>(false, "RTMP 未创建!")); } try { int ret = EasyRTMP_InitMetadata(this.RtmpHandle, mediaInfo, bufferKSize); if (ret == 0) { return(new KeyValuePair <bool, string>(true, "RTMP 创建媒体成功!")); } else { return(new KeyValuePair <bool, string>(false, string.Format("RTMP 创建媒体失败,错误代码:{0}", ret))); } } catch (System.Exception e) { return(new KeyValuePair <bool, string>(false, e.Message)); } }
private extern static int EasyRTMP_InitMetadata(IntPtr handle, EASY_MEDIA_INFO_T pstruStreamInfo, int bufferKSize);
public static extern uint EasyPusher_StartStream(System.IntPtr handle, System.IntPtr serverAddr, ushort port, System.IntPtr streamName, System.IntPtr username, System.IntPtr password, ref EASY_MEDIA_INFO_T pstruStreamInfo, uint bufferKSize, byte createlogfile);