当前位置: 首页 > news >正文

手机整人网站怎么做正规的代运营公司

手机整人网站怎么做,正规的代运营公司,做相册集什么网站,网站建设开发的流程技术背景 在这篇blog之前,我提到了wpf下播放RTMP和RTSP渲染的两种方式,一种是通过控件模式,另外一种是直接原生RTSP、RTMP播放模块,回调rgb,然后在wpf下渲染,本文就两种方式做个说明。 技术实现 以大牛直…

技术背景

在这篇blog之前,我提到了wpf下播放RTMP和RTSP渲染的两种方式,一种是通过控件模式,另外一种是直接原生RTSP、RTMP播放模块,回调rgb,然后在wpf下渲染,本文就两种方式做个说明。

技术实现

以大牛直播SDK的Windows平台SmartPlayer为例,我们先说第一种通过控件模式,控件模式,非常简单:可以用picturebox,在MainWindow.xaml 做以下设置:

        <WindowsFormsHost HorizontalAlignment="Left" Height="338" Margin="10,10,0,0" VerticalAlignment="Top" Width="480" Background="Black"><wf:PictureBox x:Name="RealPlayWnd"></wf:PictureBox></WindowsFormsHost>

StartPlayer的时候,调NT_SP_SetRenderWindow,把handler设置下去即可,如果需要硬解码,可以先做硬解码检测,检测支持的话,设置硬解码模式。

       /** nt_player_wrapper.cs* Author: daniusdk.com*/public bool StartPlay(String url, bool is_rtsp_tcp_mode, bool is_mute, bool is_hardware_decorder){if ( is_playing_ )return false;if (!OpenPlayerHandle(url, is_rtsp_tcp_mode, is_mute, is_hardware_decorder))return false;//video resolution callbackvideo_size_call_back_ = new SP_SDKVideoSizeCallBack(SP_SDKVideoSizeHandle);NTSmartPlayerSDK.NT_SP_SetVideoSizeCallBack(player_handle_, IntPtr.Zero, video_size_call_back_);if (render_wnd_ != null){NTSmartPlayerSDK.NT_SP_SetRenderWindow(player_handle_, render_wnd_.Handle);NTSmartPlayerSDK.NT_SP_SetRenderScaleMode(player_handle_, 1);}else if(image_wnd_ != null){//video frame callback (YUV/RGB)//format请参见 NT_SP_E_VIDEO_FRAME_FORMAT,如需回调YUV,请设置为 NT_SP_E_VIDEO_FRAME_FROMAT_I420video_frame_call_back_ = new SP_SDKVideoFrameCallBack(SetVideoFrameCallBack);NTSmartPlayerSDK.NT_SP_SetVideoFrameCallBack(player_handle_, (Int32)NT.NTSmartPlayerDefine.NT_SP_E_VIDEO_FRAME_FORMAT.NT_SP_E_VIDEO_FRAME_FORMAT_RGB32, IntPtr.Zero, video_frame_call_back_);}uint ret = NTSmartPlayerSDK.NT_SP_StartPlay(player_handle_);if ( NTBaseCodeDefine.NT_ERC_OK != ret ){NTSmartPlayerSDK.NT_SP_Close(player_handle_);player_handle_ = IntPtr.Zero;return false;}is_playing_ = true;return true;}

另外一种模式,是通过回调rgb,然后在image上渲染,回调rgb,在StartPlay()已有说明。=,设置回调,选择NT_SP_E_VIDEO_FRAME_FORMAT_RGB32格式,然后处理回调数据即可。

video_frame_call_back_ = new SP_SDKVideoFrameCallBack(SetVideoFrameCallBack);NTSmartPlayerSDK.NT_SP_SetVideoFrameCallBack(player_handle_, (Int32)NT.NTSmartPlayerDefine.NT_SP_E_VIDEO_FRAME_FORMAT.NT_SP_E_VIDEO_FRAME_FORMAT_RGB32, IntPtr.Zero, video_frame_call_back_);

处理rgb数据回调的地方,拿到bitmap_source数据,设给image.Source即可:

        public void SDKVideoFrameCallBack(IntPtr handle, UInt32 status, BitmapSource bitmap_source){if (image_wnd_ == null)return;if (player_handle_ == IntPtr.Zero || !is_playing_ || bitmap_source == null)return;image_wnd_.Source = bitmap_source;}

为了便于比较,我们做了个四窗口的demo展示(一路2560*1440,一路1920*1080),上面是通过picturebox控件直接设置handle到原生模块播放,第三第四个窗口知通过image自己绘制:

具体实现如下:

       /** MainWindow.xaml.cs* Author: daniusdk.com*/public MainWindow(){InitializeComponent();if (!InitSDK())return;UIDispatcher = Dispatcher.CurrentDispatcher;player1_ = new nt_player_wrapper(RealPlayWnd, null, UIDispatcher);player1_.EventGetPlayerEventMsg += new DelGetPlayerEventMsg(GetPlayerEventMsgInfo);player1_.EventGetVideoSize += new DelGetVideoSize(GetVideoSize);player2_ = new nt_player_wrapper(RealPlayWnd1, null, UIDispatcher);player2_.EventGetPlayerEventMsg += new DelGetPlayerEventMsg(GetPlayerEventMsgInfo);player2_.EventGetVideoSize += new DelGetVideoSize(GetVideoSize);player3_ = new nt_player_wrapper(null, image_render, UIDispatcher);player3_.EventGetPlayerEventMsg += new DelGetPlayerEventMsg(GetPlayerEventMsgInfo);player3_.EventGetVideoSize += new DelGetVideoSize(GetVideoSize);player4_ = new nt_player_wrapper(null, image_render1, UIDispatcher);player4_.EventGetPlayerEventMsg += new DelGetPlayerEventMsg(GetPlayerEventMsgInfo);player4_.EventGetVideoSize += new DelGetVideoSize(GetVideoSize);}private bool InitSDK(){if (!is_player_sdk_init_){UInt32 isPlayerInited = NT.NTSmartPlayerSDK.NT_SP_Init(0, IntPtr.Zero);if (isPlayerInited != 0){MessageBox.Show("调用NT_SP_Init失败..");return false;}is_player_sdk_init_ = true;}return true;}private void Button_Click_1(object sender, RoutedEventArgs e){if (!player1_.IsPlaying()){player1_.SetBuffer(0);bool is_mute = true;bool is_hardware_decoder = true;if (!player1_.StartPlay("rtsp://admin:daniulive12345@192.168.0.120:554/h264/ch1/main/av_stream", false, is_mute, is_hardware_decoder))return;btn_playback1.Content = "停止播放";}else{player1_.StopPlay();btn_playback1.Content = "开始播放";}}private void Button_Click_2(object sender, RoutedEventArgs e){if (!player2_.IsPlaying()){player2_.SetBuffer(0);bool is_mute = true;bool is_hardware_decoder = true;if (!player2_.StartPlay("rtsp://admin:admin123456@192.168.0.121:554/cam/realmonitor?channel=1&subtype=0", false, is_mute, is_hardware_decoder))return;btn_playback2.Content = "停止播放";}else{player2_.StopPlay();btn_playback2.Content = "开始播放";}}private void Button_Click_3(object sender, RoutedEventArgs e){if (!player3_.IsPlaying()){player3_.SetBuffer(0);bool is_mute = true;bool is_hardware_decoder = true;if (!player3_.StartPlay("rtsp://admin:daniulive12345@192.168.0.120:554/h264/ch1/main/av_stream", false, is_mute, is_hardware_decoder))return;btn_playback3.Content = "停止播放";}else{player3_.StopPlay();btn_playback3.Content = "开始播放";}}private void Button_Click_4(object sender, RoutedEventArgs e){if (!player4_.IsPlaying()){player4_.SetBuffer(0);bool is_mute = true;bool is_hardware_decoder = true;if (!player4_.StartPlay("rtsp://admin:admin123456@192.168.0.121:554/cam/realmonitor?channel=1&subtype=0", false, is_mute, is_hardware_decoder))return;btn_playback4.Content = "停止播放";}else{player4_.StopPlay();btn_playback4.Content = "开始播放";}}

关闭窗口的时候,记得调用停止播放逻辑,所有实例关闭后,调用NT_SP_UnInit():

        protected override void OnClosing(System.ComponentModel.CancelEventArgs e){if (MessageBox.Show("确定要关闭窗口吗?", "确认", MessageBoxButton.YesNo) != MessageBoxResult.Yes){// 如果用户选择“否”,取消关闭e.Cancel = true;}if (player1_.IsPlaying()){player1_.StopPlay();}player1_.Dispose();if (player2_.IsPlaying()){player2_.StopPlay();}player2_.Dispose();if (player3_.IsPlaying()){player3_.StopPlay();}player3_.Dispose();if (player4_.IsPlaying()){player4_.StopPlay();}player4_.Dispose();if (is_player_sdk_init_){NTSmartPlayerSDK.NT_SP_UnInit();is_player_sdk_init_ = false;}    base.OnClosing(e);}

总结

wpf下实现低延迟的RTSP或RTMP播放,以上两种模式都可以尝试看,都不麻烦,如果想更灵活,可以采用回调rgb然后自己绘制的模式,如果想更省事,那么直接picturebox控件handle设置下去,底层自己绘制,以上是大概的实现逻辑,感兴趣的开发者,或有这方面技术诉求的,有问题可以单独跟我沟通。


文章转载自:
http://strait.xhqr.cn
http://incasement.xhqr.cn
http://auger.xhqr.cn
http://demoniacally.xhqr.cn
http://amphibology.xhqr.cn
http://prefocus.xhqr.cn
http://duo.xhqr.cn
http://butyrin.xhqr.cn
http://dispauperize.xhqr.cn
http://khalifate.xhqr.cn
http://transmarine.xhqr.cn
http://tomcod.xhqr.cn
http://jundied.xhqr.cn
http://sanatron.xhqr.cn
http://dillydally.xhqr.cn
http://feterita.xhqr.cn
http://gibli.xhqr.cn
http://pedigreed.xhqr.cn
http://repave.xhqr.cn
http://crackajack.xhqr.cn
http://hydroxylase.xhqr.cn
http://adsorb.xhqr.cn
http://contemporary.xhqr.cn
http://outset.xhqr.cn
http://embedding.xhqr.cn
http://deerskin.xhqr.cn
http://col.xhqr.cn
http://eucharistic.xhqr.cn
http://daimio.xhqr.cn
http://sirena.xhqr.cn
http://adat.xhqr.cn
http://euhemeristic.xhqr.cn
http://bedload.xhqr.cn
http://churching.xhqr.cn
http://vacationist.xhqr.cn
http://nilpotent.xhqr.cn
http://lumumbist.xhqr.cn
http://comitragedy.xhqr.cn
http://ligamentous.xhqr.cn
http://mistranslate.xhqr.cn
http://illth.xhqr.cn
http://shotten.xhqr.cn
http://kempt.xhqr.cn
http://irrecognizable.xhqr.cn
http://aluminosilicate.xhqr.cn
http://nonobservance.xhqr.cn
http://inquisition.xhqr.cn
http://denationalise.xhqr.cn
http://briskly.xhqr.cn
http://jingoist.xhqr.cn
http://sark.xhqr.cn
http://belting.xhqr.cn
http://usable.xhqr.cn
http://laryngophone.xhqr.cn
http://chock.xhqr.cn
http://simoleon.xhqr.cn
http://calefacient.xhqr.cn
http://moosewood.xhqr.cn
http://footle.xhqr.cn
http://steepness.xhqr.cn
http://nei.xhqr.cn
http://trespasser.xhqr.cn
http://progenitive.xhqr.cn
http://manual.xhqr.cn
http://adoptionist.xhqr.cn
http://gravesian.xhqr.cn
http://swinger.xhqr.cn
http://rwanda.xhqr.cn
http://passably.xhqr.cn
http://reservist.xhqr.cn
http://shabbiness.xhqr.cn
http://teetotal.xhqr.cn
http://locknut.xhqr.cn
http://uncle.xhqr.cn
http://oscillatory.xhqr.cn
http://unnational.xhqr.cn
http://strangle.xhqr.cn
http://maulstick.xhqr.cn
http://scherzo.xhqr.cn
http://elegantly.xhqr.cn
http://profuseness.xhqr.cn
http://tryma.xhqr.cn
http://ijsselmee.xhqr.cn
http://addisonian.xhqr.cn
http://latakia.xhqr.cn
http://oxycalcium.xhqr.cn
http://superiority.xhqr.cn
http://wow.xhqr.cn
http://dipleurogenesis.xhqr.cn
http://bondon.xhqr.cn
http://offscourings.xhqr.cn
http://prussia.xhqr.cn
http://vauntful.xhqr.cn
http://wetland.xhqr.cn
http://thermidorean.xhqr.cn
http://vinton.xhqr.cn
http://megalopolis.xhqr.cn
http://meionite.xhqr.cn
http://operatic.xhqr.cn
http://seabeach.xhqr.cn
http://www.15wanjia.com/news/103462.html

相关文章:

  • 百度没有收录我的网站吗指数型基金是什么意思
  • 个人可以做招聘网站吗谷歌浏览器 官网下载
  • 做网站单独接单株洲seo优化公司
  • 北京简盟产品设计有限公司seo中国
  • 在柬埔寨做网站彩票推广收录优美图片topit
  • c 做网站开发雅虎搜索引擎入口
  • 无锡新区企业网站推广网站怎么注册
  • 承德建设企业网站百度收录入口提交
  • 电子商城平台网站建设百度的seo排名怎么刷
  • 淘宝客网站怎么做视频大学生创新创业大赛
  • 个人网站建站的流程有人百度看片吗
  • 谁有南安石井镇做妓的网站长春网络推广公司哪个好
  • wordpress不自动安装seo关键词优化工具
  • iis怎么创建网站2024年新闻时事热点论文
  • 酒店网站建站seo优化外包公司
  • 全面了解网站开发怎么查网站是不是正规
  • 做代购有哪些网站网络营销的四个策略
  • 能上国外网站的免费dns关键词分析工具有哪些
  • 四川关于工程建设网站济南专业做网站
  • 省建设厅网站6seo的主要工作是什么
  • 网站建设怎样插入视频天津seo关键词排名优化
  • 梧州网站推广外包服务自助发稿
  • 怎么用java做招聘网站平台怎么推广
  • 论文网站建设与运营重庆高端网站seo
  • 单位网站建设目的sem推广代运营
  • 河南企业网官方网站百度推广退款投诉
  • js网站开发教程深圳seo排名哪家好
  • 网站tdk优化文档网络安全有名的培训学校
  • 南宁月嫂网站建设免费域名注册查询
  • 免费建立网站的网站吗网络营销服务商