OpenRTMFP/Cumulus开发笔记(5) Cumulus实时视频流的播放

一.定义一个窗口类:

package

{

   import flash.display.Sprite;

   public class Layerextends Sprite

   {

       //窗口层

       protectedvar _windowLayer:Sprite;

       publicfunction Layer()

       {

           init();

       }

       privatefunction init():void

       {

           _windowLayer =new Sprite();

           addChild(_windowLayer);

       }

       /**

        *窗口层

        */

       publicfunction get windowLayer():Sprite

       {

           return _windowLayer;

       }

   }

}

二.声明一个容器变量:

private var_container:Sprite;

三.给该容器变量赋值:

publicfunction setContainer(container:Sprite):void{

           _container = container;

        }

.播放视频:

publicfunction playVideo():void {

               buf.resetVideo();

               var video:Video =new Video();

               video.attachNetStream(buf.ns);

               _container.addChild(video);

       }

说明:buf是一个自己定义的视频处理类,里面需要有相关的NetStream成员变量,在接收到一帧一帧的视频数据时,经过处理,使用方法_ns.appendBytes(videoFrame.streamData);

播放接收到的实时视频帧,而video类主要用于显示视频,即方法video.attachNetStream(buf.ns);video类关联到相关的NetStream

.通常接收到的视频帧数据不包含flv的头格式,而在actionscript中需要播放的是flv格式的视频数据,所以,通常要为视频加上flv的头信息,如下:

      var firstTag:ByteArray =new ByteArray();

       firstTag.endian= Endian.BIG_ENDIAN;

       //video

       firstTag.writeByte(0x09);

       firstTag.position = 11;

       //4bits:type of frame 1 => key frame  + 4bits:CodecID  7 => AVC

       firstTag.writeByte(0x17);

       //AVCPacketType  0 => AVC sequence header

       firstTag.writeByte(0x00);

       //Composition time, 3 bytes 0 for the firsttag

       firstTag.writeByte(0x00);

       firstTag.writeByte(0x00);

       firstTag.writeByte(0x00);

      //TODOfirstTag.writeBytes(avcCfg);

       var firstTagLen:uint = firstTag.length;

       firstTag.writeUnsignedInt(firstTagLen);

       firstTag.position = 1;

       //3-byte DataSize

       firstTag.writeByte( ((firstTagLen - 11)>> 16) & 0xff);

       firstTag.writeByte( ((firstTagLen - 11)>>  8) & 0xff);

       firstTag.writeByte( ((firstTagLen -11)      ) & 0xff);

PS:初写文章,文笔生涩之处,各位请见谅,若有疑问或者交流的,可加本人YY号:301558660

转载请注明出处:山水间博客,http://blog.csdn.net/linyanwen99/article/details/8165662


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
您好,以下是Cumulus交换机配置V-STP的步骤: 1. 首先,确认您的交换机支持V-STP功能,并且已经启用了STP协议。 2. 进入交换机的配置模式。 3. 输入以下命令启用V-STP功能: ``` switch(config)# spanning-tree protocol-version rstp-mst switch(config)# spanning-tree vlan 1-4094 mode mstp ``` 其中,vlan 1-4094表示启用所有VLAN的MSTP模式。 4. 配置V-STP实例。您可以为每个VLAN配置一个实例,或者将多个VLAN分配到同一个实例中。 ``` switch(config)# spanning-tree mst configuration switch(config-mst)# name instance1 switch(config-mst)# revision 1 switch(config-mst)# instance 1 vlan 10-20 switch(config-mst)# instance 2 vlan 30-40 ``` 其中,instance1表示实例名称,revision 1表示版本号,vlan 10-20和vlan 30-40表示将这些VLAN分配到实例1和实例2中。 5. 配置V-STP端口。将每个端口配置为所属的VLAN和实例。 ``` switch(config)# interface swp1 switch(config-if)# switchport switch(config-if)# switchport mode trunk switch(config-if)# switchport trunk allowed vlan 10-20 switch(config-if)# spanning-tree mst instance 1 vlan 10-20 ``` 其中,swp1表示端口名称,switchport mode trunk表示将端口配置为trunk模式,switchport trunk allowed vlan 10-20表示允许VLAN 10-20通过该端口,spanning-tree mst instance 1 vlan 10-20表示将该端口配置为实例1中的VLAN 10-20。 6. 最后,保存并应用配置。 ``` switch# save switch# exit ``` 以上就是在Cumulus交换机上配置V-STP的步骤,希望能对您有所帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值