zoukankan      html  css  js  c++  java
  • 安卓与PC网络对接实现视频实时播放

    研究安卓网络通信一段时间了,  由于最近公司催的比较紧, 硬着头皮弄出来了.

    现在手机客户端终于能够连接流媒体服务器实时播放前端的视频流了.

    其实通信方面主要还是命令包的解析, 以及分包组包.

    比如要把以下的结构赋值, 就要进行以下函数的转化.

          /*
         *  

        TNetPackHead = record
          Flag: DWORD;  //0,1,2,3
          Level: TLevel;  //4,5,6,7
          cmd: Word;    //1633 8,9
          Size: Word;   // 10,11
          byChannel:   Byte;
          sServer: array[0..15] of char;
          sHost: array[0..15] of char;
          sMemo: array[0..15] of char;
          byStreamType: Byte;
        end;
         * */

        public byte[] OpenDvrInfo(String DvrIp,int iCmd, int ichan, int istream)
        {
        byte[] b = new byte[100];       
        byte[] temp;
        //分别将struct的成员格式为byte数组。       
        temp = toLH(1);
        System.arraycopy(temp, 0, b, 0, temp.length);
        temp = toLH(0);
        System.arraycopy(temp, 0, b, 4, temp.length);    
        temp = toLH2(iCmd);
        System.arraycopy(temp, 0, b, 6, temp.length); 
        temp = toLH2(10);
        System.arraycopy(temp, 0, b, 8, temp.length);
       
        b[12] = (byte)ichan;
        temp = DvrIp.getBytes();
        System.arraycopy(temp, 0, b, 13, DvrIp.length());
        System.arraycopy(temp, 0, b, 29, DvrIp.length());
        System.arraycopy(temp, 0, b, 45, DvrIp.length());
        b[61] = (byte)istream;
      
        return b;       
        }

  • 相关阅读:
    常见DOS命令
    前台传参到后台出现中文乱码问题
    Servlet.init() for servlet [spring-dispatcher] threw exception
    ES6-2
    ES6语法(一)
    JS区分对象类型
    ko数组
    sortable的基本属性
    MUI消息推送
    target和currentTarget
  • 原文地址:https://www.cnblogs.com/doorsky/p/3218043.html
Copyright © 2011-2022 走看看